From 1e8ac37e8dae291241dcb2d5575f076cb6a6c832 Mon Sep 17 00:00:00 2001 From: Lukas Malkmus Date: Mon, 23 Feb 2026 15:53:36 +0100 Subject: [PATCH] cli: only warn about --annotate when explicitly passed via CLI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The warning "⚠ --annotate only applies to the screenshot command" fires on every non-screenshot command when annotate is set in config. This is noisy for users who set it as a persistent default. Add cli_annotate tracking (matching the existing cli_* pattern) so the warning only fires when --annotate is passed as a CLI flag. --- cli/src/commands.rs | 3 ++- cli/src/flags.rs | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/cli/src/commands.rs b/cli/src/commands.rs index bdd9965ba..232c98953 100644 --- a/cli/src/commands.rs +++ b/cli/src/commands.rs @@ -83,7 +83,7 @@ pub fn parse_command(args: &[String], flags: &Flags) -> Result = args[1..].iter().map(|s| s.as_str()).collect(); let id = gen_id(); - if flags.annotate && cmd != "screenshot" { + if flags.cli_annotate && cmd != "screenshot" { eprintln!( "{} --annotate only applies to the screenshot command", color::warning_indicator() @@ -1863,6 +1863,7 @@ mod tests { cli_proxy: false, cli_proxy_bypass: false, cli_allow_file_access: false, + cli_annotate: false, annotate: false, color_scheme: None, } diff --git a/cli/src/flags.rs b/cli/src/flags.rs index 21b404941..c2a1e6d34 100644 --- a/cli/src/flags.rs +++ b/cli/src/flags.rs @@ -215,6 +215,7 @@ pub struct Flags { pub cli_proxy: bool, pub cli_proxy_bypass: bool, pub cli_allow_file_access: bool, + pub cli_annotate: bool, } pub fn parse_flags(args: &[String]) -> Flags { @@ -293,6 +294,7 @@ pub fn parse_flags(args: &[String]) -> Flags { cli_proxy: false, cli_proxy_bypass: false, cli_allow_file_access: false, + cli_annotate: false, }; let mut i = 0; @@ -429,6 +431,7 @@ pub fn parse_flags(args: &[String]) -> Flags { "--annotate" => { let (val, consumed) = parse_bool_arg(args, i); flags.annotate = val; + flags.cli_annotate = true; if consumed { i += 1; } } "--color-scheme" => { @@ -658,6 +661,19 @@ mod tests { assert!(flags.cli_profile); } + #[test] + fn test_cli_annotate_tracking() { + let flags = parse_flags(&args("--annotate screenshot")); + assert!(flags.cli_annotate); + assert!(flags.annotate); + } + + #[test] + fn test_cli_annotate_not_set_without_flag() { + let flags = parse_flags(&args("screenshot")); + assert!(!flags.cli_annotate); + } + #[test] fn test_cli_multiple_flags_tracking() { let flags = parse_flags(&args(