diff --git a/src/main.rs b/src/main.rs index 1d02b45..df230e3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -61,6 +61,9 @@ fn setup() -> Result { // get new argv from recipe let argv = recipe.to_argv(options.plugin.as_ref().unwrap_or(&"".to_string()))?; + + log::debug!(" argv={:?}", &argv); + // repopulate the options from this argv options.try_update_from(argv).map_err(|e| e.to_string())?; } diff --git a/src/plugins/cmd/mod.rs b/src/plugins/cmd/mod.rs index 3055c38..3678c0d 100644 --- a/src/plugins/cmd/mod.rs +++ b/src/plugins/cmd/mod.rs @@ -5,8 +5,8 @@ use async_trait::async_trait; use ctor::ctor; use crate::session::{Error, Loot}; +use crate::Options; use crate::Plugin; -use crate::{utils, Options}; use crate::creds::Credentials; @@ -30,16 +30,13 @@ impl Command { } async fn run(&self, creds: &Credentials) -> Result { - let (target, port) = utils::parse_target(&creds.target, 0)?; - let args = shell_words::split( &self .opts .cmd_args .replace("{USERNAME}", &creds.username) .replace("{PASSWORD}", &creds.password) - .replace("{TARGET}", &target) - .replace("{PORT}", &format!("{}", port)), + .replace("{TARGET}", &creds.target), ) .unwrap(); @@ -81,7 +78,7 @@ impl Plugin for Command { let stdout = String::from_utf8_lossy(&out.stdout); let stderr = String::from_utf8_lossy(&out.stderr); if !stderr.is_empty() { - log::error!("{}", stderr); + log::debug!("{}", stderr); } log::debug!("{}", &stdout); diff --git a/src/recipe/mod.rs b/src/recipe/mod.rs index 69cebcc..22e4afd 100644 --- a/src/recipe/mod.rs +++ b/src/recipe/mod.rs @@ -135,7 +135,9 @@ impl Recipe { for (arg_name, arg_value) in &self.args { argv.push(format!("--{}", arg_name)); - argv.push(self.parse_arg(arg_value, &mut ctx)?); + if arg_value != "null" { + argv.push(self.parse_arg(arg_value, &mut ctx)?); + } } // print context