Skip to main content

machine_readable_errors

Function machine_readable_errors 

Source
pub fn machine_readable_errors<I>(args: I, stdout_is_terminal: bool) -> bool
where I: IntoIterator, I::Item: AsRef<str>,
Expand description

Whether errors should be machine-readable, decided from the raw command line.

Only needed when the parser rejected the arguments before --output could be resolved. Mirrors OutputConfig::new: an explicit text request wins over an explicit json one, and with neither, a non-terminal stdout means a machine is reading. A value after -- is positional, so the scan stops there.

This inspects a command line that has already failed to parse, so a literal --json sitting in an option’s value can steer the format. That only changes how an error is rendered, never whether one occurs.