From 4c6f60208f196314a8ed72b279bc54511de5d57c Mon Sep 17 00:00:00 2001 From: Simone Margaritelli Date: Mon, 15 Jan 2024 18:21:52 +0100 Subject: [PATCH] fix: using --cmd-binary instead of --target --- src/plugins/cmd/mod.rs | 7 ++----- src/plugins/cmd/options.rs | 4 ++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/plugins/cmd/mod.rs b/src/plugins/cmd/mod.rs index f15f6a6..6f42eae 100644 --- a/src/plugins/cmd/mod.rs +++ b/src/plugins/cmd/mod.rs @@ -20,14 +20,12 @@ fn register() { #[derive(Clone)] pub(crate) struct Command { opts: options::Options, - binary: String, } impl Command { pub fn new() -> Self { Command { opts: options::Options::default(), - binary: String::default(), } } @@ -45,9 +43,9 @@ impl Command { ) .unwrap(); - log::debug!("{} {}", &self.binary, args.join(" ")); + log::debug!("{} {}", &self.opts.cmd_binary, args.join(" ")); - let child = std::process::Command::new(&self.binary) + let child = std::process::Command::new(&self.opts.cmd_binary) .args(&args) .stdin(Stdio::null()) .stdout(Stdio::piped()) @@ -66,7 +64,6 @@ impl Plugin for Command { } fn setup(&mut self, opts: &Options) -> Result<(), Error> { - self.binary = opts.target.clone().unwrap(); self.opts = opts.cmd.clone(); Ok(()) } diff --git a/src/plugins/cmd/options.rs b/src/plugins/cmd/options.rs index f9e41a8..987e657 100644 --- a/src/plugins/cmd/options.rs +++ b/src/plugins/cmd/options.rs @@ -4,6 +4,10 @@ use serde::{Deserialize, Serialize}; #[derive(Parser, Debug, Serialize, Deserialize, Clone, Default)] #[group(skip)] pub(crate) struct Options { + #[clap(long)] + /// Command arguments. + pub cmd_binary: String, + #[clap(long, default_value = "")] /// Command arguments. {USERNAME}, {PASSWORD}, {TARGET} and {PORT} can be used as placeholders. pub cmd_args: String,