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
This commit is contained in:
Chris Tate
2026-04-13 23:39:11 -05:00
committed by GitHub
parent 50323499c8
commit ddf6d6a2af
+25
View File
@@ -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);