From 6a93b756e9397f98884e946b84bb4ce5a5f5636e Mon Sep 17 00:00:00 2001 From: akbash Date: Thu, 10 Sep 2026 13:21:27 +0300 Subject: fix: accept session names after option terminator (#3222) refs #3220 Co-authored-by: akbash-bot <300245827+akbash-bot@users.noreply.github.com> --- src/cli.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/cli.rs') diff --git a/src/cli.rs b/src/cli.rs index ea643f6a..d4ae2f84 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -966,8 +966,11 @@ fn parse_session_json_only(args: &[String], usage: &str) -> Result { fn parse_session_name_and_json(args: &[String], usage: &str) -> Result<(String, bool), i32> { let mut name = None; let mut json = false; + let mut options_ended = false; for arg in args { - if arg == "--json" { + if !options_ended && arg == "--" { + options_ended = true; + } else if !options_ended && arg == "--json" { json = true; } else if name.is_none() { name = Some(arg.clone()); @@ -1087,6 +1090,16 @@ mod tests { ); } + #[test] + fn session_name_parser_accepts_option_terminator() { + for name in ["-h", "--json"] { + assert_eq!( + super::parse_session_name_and_json(&["--".to_string(), name.to_string()], "usage",), + Ok((name.to_string(), false)) + ); + } + } + #[test] fn parse_env_assignment_accepts_empty_values() { assert_eq!( -- cgit v1.2.3