Skip to main content

Module diagnostic

Module diagnostic 

Source
Expand description

What a user reads when a command line does not parse.

Held to clap’s shape on purpose. mise’s users read clap’s errors today, and the help output on either side of this is already byte-identical to usage-lib’s — so the error text is the last thing an adopter’s users would notice changing, and the aim is that they do not.

The skeleton, measured from clap 4 rather than remembered:

error: unexpected argument '--fore' found

  tip: a similar argument exists: '--force'

Usage: mise use [OPTIONS] [TOOL@VERSION]…

For more information, try '--help'.

Two deliberate departures. The usage line is ours — the same one --help prints, rendered from the spec — because an error that disagrees with the help about how a command is spelled is worse than one that disagrees with clap. And which errors carry a usage block follows clap: the ones about the shape of the command line do, the ones about a single value do not.

Structs§

ArgvSpan
The bytes within one argv word responsible for a diagnostic.
Report
A parse outcome ready for a JSON reporter, editor, or another diagnostic framework.
Style
Whether to colour, and what with.

Enums§

Code
A stable machine-readable category for one parse outcome.

Functions§

render
Render error the way a user should read it.
render_view
Render a parse failure through a spec-declared executable view.
render_warnings
Render the deprecations a command line used, the way a user should read them.
report
Describe a parse outcome as stable fields plus the ordinary plain-text rendering.
report_view
Describe a parse outcome through a spec-declared executable view.