From 5e94a18496396e31ee7fa8fd0a809ba2e1c1cdf1 Mon Sep 17 00:00:00 2001 From: Coty Rosenblath Date: Mon, 12 Jan 2026 12:17:13 +0700 Subject: [PATCH] Fix CLI stripping --interactive and similar snapshot flags (#9) * Fix --interactive flag being stripped for snapshot command The clean_args function was removing all --prefixed arguments, which incorrectly stripped command-specific flags like --interactive, --compact, --depth, and --selector. Changed to only strip known global flags. * Update Cargo.lock --------- Co-authored-by: Claude --- cli/src/flags.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cli/src/flags.rs b/cli/src/flags.rs index 223734e..fc2749b 100644 --- a/cli/src/flags.rs +++ b/cli/src/flags.rs @@ -41,6 +41,9 @@ pub fn clean_args(args: &[String]) -> Vec { let mut result = Vec::new(); let mut skip_next = false; + // Global flags that should be stripped from command args + const GLOBAL_FLAGS: &[&str] = &["--json", "--full", "--headed", "--debug"]; + for arg in args.iter() { if skip_next { skip_next = false; @@ -50,9 +53,11 @@ pub fn clean_args(args: &[String]) -> Vec { skip_next = true; continue; } - if !arg.starts_with("--") && arg != "-f" { - result.push(arg.clone()); + // Only strip known global flags, not command-specific flags + if GLOBAL_FLAGS.contains(&arg.as_str()) || arg == "-f" { + continue; } + result.push(arg.clone()); } result }