Skip to main content

Crate dimvexa_cli

Crate dimvexa_cli 

Source
Expand description

The command-line front end of dimvexa.

dimvexa convert VALUE FROM TO [--exact] [--json] [--config NAME_OR_PATH]... [--density NAME_OR_VALUE]
dimvexa VALUE FROM TO [--exact] [--json]        shorthand
dimvexa units [--groups | GROUP | UNIT] [--json]  list units by quantity, one group, or one unit
dimvexa configs [NAME_OR_PATH] [--json]          what the shipped configs (or a file) contain

This crate contains no conversion logic: it parses arguments, calls the public library API and formats the result, so it cannot disagree with the library. It always uses the exact path; the decimal it prints is the exact result rounded once to the nearest f64 (0 ulp), never the fast path’s result. The library’s fast path is within 1 ulp (linear) or 2 ulp (affine) of that value (docs/precision.md).

Exit codes: 0 success, 1 conversion refused or invalid input, 2 usage error. With --json, errors are printed to stdout as JSON (schema dimvexa.convert/2, see docs/schemas/; units --json uses dimvexa.units/3, configs --json dimvexa.configs/1) and the exit code stays non-zero. The error code is one of the library’s stable codes (dimvexa::Error::ALL_CODES) or usage.

Structs§

Color
Whether each output stream may carry ANSI colour. Off unless the caller turns it on (the binary does so for a terminal, honouring NO_COLOR).

Functions§

run
Runs the command line args (without the program name), writing to out and err. Returns the process exit code.
run_with
Like run, with ANSI colour on the streams color names. JSON output is never coloured.