From e25d6e9c5670b1cb43f5cfece73acbb972f11214 Mon Sep 17 00:00:00 2001 From: Simone Margaritelli Date: Wed, 20 Dec 2023 15:11:33 +0100 Subject: [PATCH] fix: check --cmd-binary only if cmd plugin is used --- src/plugins/cmd/mod.rs | 6 +++++- src/plugins/cmd/options.rs | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/cmd/mod.rs b/src/plugins/cmd/mod.rs index 400d7a9..867fa56 100644 --- a/src/plugins/cmd/mod.rs +++ b/src/plugins/cmd/mod.rs @@ -64,7 +64,11 @@ impl Plugin for Command { fn setup(&mut self, opts: &Options) -> Result<(), Error> { self.opts = opts.cmd.clone(); - Ok(()) + if self.opts.cmd_binary.is_empty() { + Err("please provide --cmd-binary and optionally --cmd-args".to_owned()) + } else { + Ok(()) + } } async fn attempt(&self, creds: &Credentials, timeout: Duration) -> Result, Error> { diff --git a/src/plugins/cmd/options.rs b/src/plugins/cmd/options.rs index 8bcfbfd..0f499b1 100644 --- a/src/plugins/cmd/options.rs +++ b/src/plugins/cmd/options.rs @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; #[derive(Parser, Debug, Serialize, Deserialize, Clone, Default)] #[group(skip)] pub(crate) struct Options { - #[clap(long)] + #[clap(long, default_value = "")] /// Command binary path. pub cmd_binary: String,