Skip to main content

should_output_json

Function should_output_json 

Source
pub fn should_output_json(cli: &Cli, config: Option<&Config>) -> bool
Expand description

Determine if output should be JSON.

Resolution order (later wins):

  1. user config output.format (or auto if unset)
  2. repo config output.format (falls back to user config)
  3. --output {auto|json|text} CLI flag
  4. --json CLI flag (deprecated; routes to JSON and emits a one-shot stderr warning the first time it fires in a process)

auto resolves by stream type: text on a TTY, JSON when piped.