Skip to main content

Module cli

Module cli 

Source
Expand description

decl check / decl evaluate / decl validate / decl fmt (cli.ts). Output is byte-identical to the reference implementation’s CLI so the three implementations can be diffed (tests/parity/differential.py).

Structs§

Overrides
decl evaluate: (exit code, the document for stdout, diagnostics tagged with the file each is reported against, bare stderr lines to print after them). What to emit, and where (§5.5): each --output name[=file] names a root — an output, or an input bound by –input or demanded through its fallback — and the file its document goes to (stdout without one); with no –output, the entry module’s exported outputs, as one object keyed by name, on stdout the overrides of the declared forms: --format, --indent / --pretty (docs/tooling/05_render.md §3.4); json is the –json report

Functions§

check_files
decl check: load each entry (following imports), report load diagnostics and every module’s static findings, tagged with their file
evaluate
decl evaluate: (exit code, the text for stdout, the diagnostics tagged with their file, the bare stderr lines that follow them); a usage error is exit 2 with its line already printed
file_tag
the file a diagnostic is reported against: the entry module by the path given on the command line, any other module by its absolute path
form_overrides
--format json|yaml, --indent n, --pretty: the layout of every document emitted (docs/tooling/05_render.md §3.4, §4); None for a usage error
input_binds
the documents named by --input, each bound to the module that declares its input (§10): name=doc.json; Err carries the exit code of a usage error (already printed) the documents named by –input, each bound to the module that declares its input (§10): name=doc.json. A usage error (bad spec, unknown input) is printed and returned as exit 2; a document that cannot be read or is not well-formed JSON is returned as one E6004 diagnostic (exit 1)
main
the command line: returns the process exit code
open_universe
the module graph of an entry file inside its package universe (manifest and lock diagnostics first), as the reference CLI opens it
run_once
The command line of a process that exits when the command returns (the decl binary). Such a process need not take apart what an evaluation built: dropping the runtime and sweeping its cycles only delays the exit, and the operating system reclaims the memory at once. main itself keeps the full teardown, for callers that live on.
validate_file
single-file validation, module-aware like check and evaluate: load the universe, check every module, then evaluate with the --input documents bound (none bound is fine: fallbacks apply). Diagnostics come tagged with the file each is reported against; Err carries a usage exit code as a negative