Skip to main content

Crate mkit_cli

Crate mkit_cli 

Source
Expand description

mkit CLI crate, exposed as a library so integration tests can drive commands in-process.

The binary is src/main.rs; everything else is a module here so unit tests and integration tests can link without shelling out. mkit-cli is explicitly publish = false — it is monorepo-internal plumbing, not a stable API.

Modules§

clap_shim
Bridge between clap-derive command structs and mkit’s sysexits contract.
cli
CLI surface constants shared by the main dispatcher and the snapshot tests.
commands
Subcommand implementations. Each top-level command is its own module.
config
.mkit/config parser / writer and XDG path helpers.
editor
$EDITOR / $VISUAL spawn helper for mkit commit.
exit
sysexits(3)-style exit codes for the mkit CLI.
format
Human-oriented output formatters — the CLI’s thin presentation layer. Anything that emits canonical on-disk or wire bytes belongs in mkit-core (serialize.rs, pack.rs, etc.), not here.
remote_dispatch
URL-scheme → Transport dispatch for mkit push / mkit pull.
signal
Signal handling — SIGINT / SIGTERM set a graceful-shutdown flag that long-running operations (push / pull / clone / log) poll at natural checkpoints, so a Ctrl-C aborts cleanly with exit::TEMPFAIL (75) rather than leaving a half-finished transfer.
term
Terminal helpers — ANSI color gating and POSIX getenv wrappers.

Functions§

dispatch
Dispatch a single argv invocation. Takes the full argv including argv[0]. Returns the exit code the binary should pass to std::process::exit.