Expand description
What a tool prints: a JSON result by default, text on request, and a structured error on stderr whose code is the exit status.
JSON is written here rather than through serde: the values are a handful of scalars, arrays and objects, and a writer this size keeps the tools’ dependencies to their argument parser.
Structs§
- CliError
- A failure: printed as
{"error": message, "code": code}on stderr (or<tool>: <message>with--text), andcodeis the exit status. - Outcome
- A successful run’s result.
Enums§
- Format
- JSON or text, from
--json/--text(seesuper::format_args). - Json
- A JSON value, with object keys kept in the order they were added so the output reads the way the code builds it.
Constants§
- EXIT_
FAILED - Exit status: the operation failed.
- EXIT_
UNSUPPORTED - Exit status: the verb exists, and this driver cannot do it — not implemented yet, or the format is read-only.
- EXIT_
USAGE - Exit status: the command line was wrong (clap’s own choice as well).
Functions§
- finish
- Print a run’s result or failure and turn it into the exit status.
- render
- What a run’s result or failure prints, and its exit status, without
printing it: see
super::Response. - text_
requested - Whether a raw command line asks for text: the last
--textor--jsonbefore any--decides.Format::ofreads the order here, and a command line that failed to parse has nothing else to read.