Skip to main content

Module output

Module output 

Source
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), and code is the exit status.
Outcome
A successful run’s result.

Enums§

Format
JSON or text, from --json/--text (see super::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 --text or --json before any -- decides. Format::of reads the order here, and a command line that failed to parse has nothing else to read.