version, doctor and init¶
The three built-ins with no inner clap subtree. They take no flags of their own and
accept --output only in the sense that they ignore it, since none of them renders
through rtb_cli::render::output.
version¶
Prints the tool's version information to stdout.
| Line | Source | Shown when |
|---|---|---|
<name> <version> |
ToolMetadata::name, VersionInfo::version |
always |
commit: |
VersionInfo::commit |
the field is Some |
built: |
VersionInfo::date |
the field is Some |
target: |
std::env::consts::ARCH and ::OS |
always |
commit and date are None unless the tool's build.rs populates them;
version_info!() sets only the version, from CARGO_PKG_VERSION.
target: is not a Rust target triple. It is <arch>-<os>, so a GNU/Linux
x86-64 build prints x86_64-linux, not x86_64-unknown-linux-gnu. The full triple
is computed separately, by rtb-update, for asset naming.
Feature: Version. Exit code: always 0.
doctor¶
Runs every health check registered into rtb_cli::health::HEALTH_CHECKS and prints
one line per check, in registration order.
$ mytool doctor
[OK ] config-file: parsed cleanly
[WARN] keychain: locked, falling back to env
[FAIL] api-token: no credential resolved
| Verdict | Label | Effect on exit code |
|---|---|---|
HealthStatus::Ok |
OK |
none |
HealthStatus::Warn |
WARN |
none |
HealthStatus::Fail |
FAIL |
run fails |
Any Fail makes the command return an error with code rtb::doctor::failed and
help text see the report above for which checks failed. Warn never fails the
run.
A tool with no registered checks prints nothing and exits 0. Silence means "no
checks", not "all healthy".
Feature: Doctor. See
Add a health check.
init¶
Runs every initialiser registered into rtb_cli::init::INITIALISERS, in
registration order, skipping any that reports itself already configured.
With nothing registered:
For each initialiser the command awaits is_configured(&app); true prints the
[SKIP] line and moves on, false prints [RUN] and awaits configure(&app).
The first configure that returns an error aborts the whole command. Later
initialisers do not run, and the ones that already ran are not undone. Write
configure to be idempotent, because a re-run after a failure repeats everything
that has not since reported itself configured.
Feature: Init. Exit code 0 unless an initialiser errored.