Expand description
Output rendering — the seam every v0.4 ops subcommand uses to
honour the global --output text|json flag.
Two pieces:
OutputMode— clap-parseable enum (Textdefault,Json), declared once at the root of the clap tree withclap::Arg::global(true)so it propagates to every subcommand without per-leaf re-declaration.output— generic helper that pickstabled-table or pretty-printed JSON based onOutputMode, prints to stdout with a trailing newline. Wrapsrtb_tui::render_tableandrtb_tui::render_jsonso every rendering site goes through one path.
Subcommands that own their own clap subtree (subcommand_passthrough = true) re-parse the global flag from std::env::args_os() via
OutputMode::from_args_os.
Enums§
- Output
Mode - Output rendering mode for any subcommand that prints structured data.
Functions§
- output
- Render
rowspermodeand write to stdout. Wrapsrtb_tui::render_tableforOutputMode::Textandrtb_tui::render_jsonforOutputMode::Json. - strip_
global_ output - Remove the global
--outputflag (and its value) from anargs_os()vector before asubcommand_passthroughsubtree re-parses with its own clap definition.