pub struct OutputConfig {
pub json: bool,
pub quiet: bool,
}Fields§
§json: boolWhether to emit JSON on stdout for data output.
quiet: boolImplementations§
Source§impl OutputConfig
impl OutputConfig
Sourcepub fn new(format: OutputFormat, quiet: bool) -> Self
pub fn new(format: OutputFormat, quiet: bool) -> Self
Build from the --output enum and --quiet flag.
--output auto (the default) emits JSON when stdout is not a TTY.
An explicit text or json always wins.
Sourcepub fn print_data(&self, data: &str)
pub fn print_data(&self, data: &str)
Print one line of data to stdout.
Sourcepub fn print_message(&self, msg: &str)
pub fn print_message(&self, msg: &str)
Print informational message to stderr; suppressed by –quiet.
Sourcepub fn print_required_prompt(&self, msg: &str)
pub fn print_required_prompt(&self, msg: &str)
Print an interactive prompt that the user MUST see to proceed.
Device-code prompts (verification URL, user code) are interactive
instructions, not optional status messages. They are emitted
unconditionally to stderr regardless of --quiet or --json.
Stderr is used even in --json mode to keep the JSON stdout stream
clean and parseable by agents.
Sourcepub fn print_json(&self, value: &Value)
pub fn print_json(&self, value: &Value)
Print serialized JSON to stdout.
Sourcepub fn render_error(&self, err: &CliError) -> i32
pub fn render_error(&self, err: &CliError) -> i32
Render a structured error.
The error envelope {"error": {"kind": "...", "message": "...", "exit_code": N}} is always written as a single JSON line to stderr,
so that consumers can extract it mechanically regardless of output mode.
In plain-text mode we also print a human-readable prefix on stderr.
Returns the exit code the caller should use.
Trait Implementations§
Source§impl Clone for OutputConfig
impl Clone for OutputConfig
Source§fn clone(&self) -> OutputConfig
fn clone(&self) -> OutputConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more