Skip to main content

cli_engine/output/
mod.rs

1//! Structured output envelopes and renderers.
2//!
3//! Command handlers return JSON-serializable data and a backend system id. The
4//! middleware wraps that data in an [`Envelope`], applies filtering, pagination,
5//! JMESPath expressions, field projection, and then renders the result as JSON,
6//! human text, or TOON.
7//!
8//! JSON is the default for the Rust crate. Human output is intended for terminal
9//! readability, and TOON remains available as an explicit migration format.
10
11mod envelope;
12mod fields;
13mod human;
14mod json;
15mod pipeline;
16mod renderer;
17mod schema;
18mod toon;
19
20pub use crate::error::{DetailedError, ExitCoder, exit_code_for_error, exit_code_for_exit_coder};
21pub use envelope::{
22    Envelope, ErrorEnvelope, Metadata, NextAction, NextActionParam, PaginationMeta,
23    build_detailed_error_envelope, build_error_envelope,
24};
25pub use fields::{FieldTree, filter_fields, parse_fields};
26pub(crate) use human::terminal_width;
27pub use human::{
28    Alignment, HumanViewDef, HumanViewFn, HumanViewRegistry, HumanViewRenderer, TableColumn,
29    global_human_view_registry_snapshot, lookup_global_human_view_columns,
30    lookup_global_human_view_func, register_global_human_view, register_global_human_view_func,
31    render_human, render_human_with_registry, render_human_with_registry_for_schema,
32    render_human_with_registry_selected, render_human_with_view,
33};
34pub use json::render_json;
35pub use pipeline::{PipelineOpts, apply_pipeline};
36pub use renderer::{
37    OutputFormat, RendererFactory, is_valid_output_format, render, render_data, render_data_format,
38    render_detailed_error, render_detailed_error_format, render_error, render_error_format,
39    render_format, write_render,
40};
41pub(crate) use schema::no_schema_response;
42pub use schema::{
43    FieldInfo, OutputField, OutputSchema, SchemaInfo, SchemaRegistry, fields_for,
44    fields_from_json_schema, format_help_section, get_global_schema_by_path,
45    global_schema_registry_snapshot, json_schema_for, json_schema_info,
46    register_global_json_schema, register_global_schema, register_global_schema_fields,
47    register_global_schema_info,
48};
49pub use toon::render_toon;