From ddf6d6a2af78c2b8944cbee71a7575fc12a1d8ab Mon Sep 17 00:00:00 2001 From: Chris Tate Date: Mon, 13 Apr 2026 23:39:11 -0500 Subject: [PATCH] fix: print data for `get box` and `get styles` in text mode (#1231) (#1233) The text-mode output formatter had branches for most `get` subcommand response shapes but was missing handlers for `boundingbox` and `styles`. Both commands fell through to the default "Done" message instead of printing the returned data. Closes #1231 --- cli/src/output.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/cli/src/output.rs b/cli/src/output.rs index 338959b..f23301d 100644 --- a/cli/src/output.rs +++ b/cli/src/output.rs @@ -296,6 +296,31 @@ pub fn print_response_with_opts(resp: &Response, action: Option<&str>, opts: &Ou println!("{}", count); return; } + // Bounding box (get box) + if action == Some("boundingbox") { + if let Some(obj) = data.as_object() { + let x = obj.get("x").and_then(|v| v.as_f64()).unwrap_or(0.0); + let y = obj.get("y").and_then(|v| v.as_f64()).unwrap_or(0.0); + let w = obj.get("width").and_then(|v| v.as_f64()).unwrap_or(0.0); + let h = obj.get("height").and_then(|v| v.as_f64()).unwrap_or(0.0); + println!("x: {}", x); + println!("y: {}", y); + println!("width: {}", w); + println!("height: {}", h); + } + return; + } + // Computed styles (get styles) + if let Some(styles) = data.get("styles").and_then(|v| v.as_object()) { + for (key, val) in styles { + let display = match val.as_str() { + Some(s) => s.to_string(), + None => val.to_string(), + }; + println!("{}: {}", key, display); + } + return; + } // Boolean results if let Some(visible) = data.get("visible").and_then(|v| v.as_bool()) { println!("{}", visible);