qemu_command_builder/
plugin.rs1use bon::Builder;
2use std::path::PathBuf;
3
4use crate::to_command::ToCommand;
5
6#[derive(Default, Builder)]
7pub struct Plugin {
8 file: Option<PathBuf>,
9 args: Option<Vec<(String, String)>>,
10}
11
12impl ToCommand for Plugin {
13 fn to_command(&self) -> Vec<String> {
14 let mut cmd = vec![];
15
16 cmd.push("-plugin".to_string());
17
18 let mut args = vec![];
19
20 if let Some(file) = &self.file {
21 args.push(format!("file={}", file.display()));
22 }
23 if let Some(argss) = &self.args {
24 for arg in argss {
25 args.push(format!("{}={}", arg.0, arg.1));
26 }
27 }
28 cmd.push(args.join(","));
29 cmd
30 }
31}