From bf76cef889257a56b29f892816cff827b34c23da Mon Sep 17 00:00:00 2001 From: akbash Date: Thu, 10 Sep 2026 16:10:44 +0300 Subject: fix: accept machine add options before the SSH target (#3897) refs #3883 Co-authored-by: akbash-bot <300245827+akbash-bot@users.noreply.github.com> --- src/cli/machine.rs | 132 +++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 109 insertions(+), 23 deletions(-) (limited to 'src/cli') diff --git a/src/cli/machine.rs b/src/cli/machine.rs index 3e93d101..ab84041e 100644 --- a/src/cli/machine.rs +++ b/src/cli/machine.rs @@ -89,62 +89,84 @@ fn list(args: &[String]) -> std::io::Result { Ok(0) } -fn add(args: &[String]) -> std::io::Result { +#[derive(Debug, PartialEq, Eq)] +struct AddArgs { + target: String, + label: String, + session: String, +} + +fn parse_add_args(args: &[String]) -> Result { let args = super::expand_equals_args(args, &["--label", "--remote-session"]); - let Some(target) = args.first().filter(|value| !value.starts_with('-')) else { - eprintln!( - "usage: herdr machine add --label