Skip to main content

Crate skif_cli

Crate skif_cli 

Source
Expand description

The skif command line as a library: a thin consumer of the skif library.

It is the only code that reads the environment, prints, prompts, writes files, spawns a process and opens a network connection (skif update only); run returns an exit code and no function below calls std::process::exit, except the panic hook that install_panic_hook puts in place for the skif binary. The npm addon calls run; the binary calls run_to_exit, which behaves the same but leaves the memory of a run to the operating system.

Structs§

CliError
A failure that stops skif from checking the repository.

Enums§

Kind
Machine-readable category of a failure.

Functions§

install_panic_hook
Keeps the JSON contract when skif itself panics: in --format json mode stdout still receives exactly one error document (kind internal) and the process exits 2, instead of aborting with a bare message on stderr.
lint_to_json
Lints the workspace containing path, or with recursive every root at or below it, and returns the report as the JSON document --format json prints.
run
Runs the CLI with args (the first item is the program name, as in std::env::args_os) and returns the exit code. The npm addon calls this; the skif binary calls run_to_exit, which differs only in what happens to memory, so their behaviour cannot drift.
run_to_exit
Like run, for a process that exits as soon as this returns: the lint command leaves its diagnostics, workspace model and file caches to the operating system instead of freeing them one allocation at a time, a measurable part of a large run. Never call it from a long-lived host such as the npm addon: that memory would leak on every call.