Expand description
choir doctor — one command that answers “why did that fail?”.
Every other command in this binary assumes its surroundings: that
git is on the path, that curl can reach a node, that the auth
file is readable and not world-readable, that the node it is about
to talk to is actually up. When one of those is false the failure
surfaces wherever it happens to be noticed — a subprocess exit
status, a curl error, a 401 — and the reader has to work backwards
from a symptom to a cause.
This module checks all of them up front and reports each one with the command that fixes it. It is the only place in the crate that treats a missing dependency as a finding rather than an error: nothing here aborts on the first failure, because “git is missing” and “the node is unreachable” are independently useful and a reader who has both wants both in one pass.
§Examples
use choir_cli::doctor::{Check, Status};
let checks = vec![
Check::pass("git", "/usr/bin/git"),
Check::fail("mergiraf", "not on PATH").with_fix("brew install mergiraf"),
];
assert_eq!(Status::worst(&checks), Status::Fail);
assert_eq!(choir_cli::doctor::exit_code(&checks), 1);Structs§
- Check
- One thing that was checked, and what to do when it is wrong.
Enums§
- Status
- How a single check came out.
Functions§
- exit_
code - The exit code for a set of checks: 0 when nothing failed, 1 when something did.
- heading
- The line above the checks: what this machine is set up as.
- host
- The six facts that describe a machine hosting a node, as opposed to one talking to somebody else’s.
- on_path
- Finds an executable on
PATH, the way exec does. - report
- Renders the checks as the report the command prints.
- run
- Runs every check.