Skip to main content

Module render

Module render 

Source
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 (Text default, Json), declared once at the root of the clap tree with clap::Arg::global(true) so it propagates to every subcommand without per-leaf re-declaration.
  • output — generic helper that picks tabled-table or pretty-printed JSON based on OutputMode, prints to stdout with a trailing newline. Wraps rtb_tui::render_table and rtb_tui::render_json so 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§

OutputMode
Output rendering mode for any subcommand that prints structured data.

Functions§

output
Render rows per mode and write to stdout. Wraps rtb_tui::render_table for OutputMode::Text and rtb_tui::render_json for OutputMode::Json.
strip_global_output
Remove the global --output flag (and its value) from an args_os() vector before a subcommand_passthrough subtree re-parses with its own clap definition.