(snapshot: &Value, format: DescribeUiFormat)
| 1 | fn print_describe_ui(snapshot: &Value, format: DescribeUiFormat) -> anyhow::Result<()> { |
| 2 | match format { |
| 3 | DescribeUiFormat::Json => println_json(snapshot), |
| 4 | DescribeUiFormat::CompactJson => { |
| 5 | println!( |
| 6 | "{}", |
| 7 | serde_json::to_string(&compact_accessibility_snapshot(snapshot))? |
| 8 | ); |
| 9 | Ok(()) |
| 10 | } |
| 11 | DescribeUiFormat::Agent => { |
| 12 | print!("{}", render_agent_accessibility_tree(snapshot)); |
| 13 | Ok(()) |
| 14 | } |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | fn compact_accessibility_snapshot(snapshot: &Value) -> Value { |
| 19 | let roots = snapshot |