From b304a4188c71877e54373d72109be034d455953b Mon Sep 17 00:00:00 2001 From: Giulio Leone Date: Sun, 1 Mar 2026 19:23:23 +0100 Subject: [PATCH] fix: correct misleading output for cookies clear and tab close (#556) (#563) Bug 1: `cookies clear` printed 'Request log cleared' instead of 'Cookies cleared' because the output handler matched the generic `{ cleared: true }` response shape without checking the action context. Now uses the `action` parameter to distinguish `cookies_clear` from `requests --clear`. Bug 2: `tab close` printed 'Browser closed' instead of 'Tab closed' because the output handler matched the generic `{ closed: ... }` response shape without checking the action context. Now uses the `action` parameter to distinguish `tab_close` from `close` (full browser close). Closes #556 --- cli/src/output.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/cli/src/output.rs b/cli/src/output.rs index 0006477..498e6bb 100644 --- a/cli/src/output.rs +++ b/cli/src/output.rs @@ -318,10 +318,14 @@ pub fn print_response_with_opts(resp: &Response, action: Option<&str>, opts: &Ou } return; } - // Cleared requests + // Cleared (cookies or request log) if let Some(cleared) = data.get("cleared").and_then(|v| v.as_bool()) { if cleared { - println!("{} Request log cleared", color::success_indicator()); + let label = match action { + Some("cookies_clear") => "Cookies cleared", + _ => "Request log cleared", + }; + println!("{} {}", color::success_indicator(), label); return; } } @@ -382,9 +386,13 @@ pub fn print_response_with_opts(resp: &Response, action: Option<&str>, opts: &Ou } return; } - // Closed + // Closed (browser or tab) if data.get("closed").is_some() { - println!("{} Browser closed", color::success_indicator()); + let label = match action { + Some("tab_close") => "Tab closed", + _ => "Browser closed", + }; + println!("{} {}", color::success_indicator(), label); return; } // Recording start (has "started" field)