Expand description
Process-wide output level for --quiet / --verbose (dogfood-0.63.0, #2401).
-q, --quiet and -v, --verbose are declared as clap globals on
crate::Cli, so clap prints them in the Options block of all 104
subcommands’ --help. Until this module existed nothing read them: in
v0.63.0 apr inspect m.apr and apr inspect m.apr --quiet produced
byte-identical stdout on 14 of 16 sampled commands, apr hex m.apr --quiet still wrote 303 972 bytes, and apr gbnf-lint ... -q still
printed the full PASS report. Only list and lint — the two commands
that happened to receive quiet as a parameter — honoured it.
Threading a quiet parameter into every command is the design that
already failed: it is the same forwarding bug --offline had (see
[crate::commands::offline]), where three commands forgot to pass the
flag along and the control was silently inert. So this is a latch,
set once in crate::execute_command, plus a crate-wide shadow of
println!/print! that consults it. A command cannot disarm --quiet
by forgetting to plumb a parameter, because it never receives one.
Semantics:
--quietsuppresses ordinary stdout. stderr is untouched, so theerror: ...line printed bycrate::cli_mainand the process exit code both survive — “errors only”, as the help text promises.--quietdoes not suppress--json: the JSON document is the machine-readable payload a script asked for, and swallowing it would make--json --quietuseless.stdout_suppressedreturns false whenever--jsonis in effect.- A command that implements its own richer quiet semantics opts out of
the blanket gate with [
emitln!]/[emit!]. Two do:apr list --quietmust still print one model identifier per line (contractapr-list-quiet-wiring-v1F-LIST-QUIET-001), andapr lint --quietfilters its table down to errors rather than going silent. --verboseraises the level so commands can print detail they otherwise elide; seeis_verboseand [vprintln!].--quietwins over--verbosewhen both are given.
Structs§
- Verbosity
Scope - RAII guard returned by
scope; restores the previous thread values.
Enums§
- Level
- How much ordinary stdout a run should produce.
Functions§
- is_
quiet - True iff
--quietwas given. - is_
verbose - True iff
--verbosewas given (and--quietwas not). - json_
enabled - True iff
--jsonis in effect for this call. - latch
- Record the run’s output level. Called once from
execute_command. - level
- The level in effect for this call.
- preamble_
lines - The
--verbosepreambleexecute_commandprints before dispatching. - resolve
- Resolve the two flags into one level.
- scope
- Override the level for the current thread until the guard drops.
- stdout_
suppressed - The single decision the shadowed
println!/print!consult.