pub enum EvidenceCommand {
Show {
state: Option<String>,
status: Option<String>,
findings: bool,
check: bool,
presented: Option<String>,
presented_tree: Option<String>,
},
Claim {
id: String,
},
Proves {
id: String,
},
Record {
suite: Option<PathBuf>,
crate_output: Option<PathBuf>,
origin: Option<String>,
provenance: Vec<String>,
coverage: Option<PathBuf>,
ledger: Option<String>,
run_record: Option<PathBuf>,
},
Stamp {
producer: Option<String>,
report: Option<PathBuf>,
exclude: Vec<String>,
out: Option<PathBuf>,
},
}Expand description
The subcommands of majordomus evidence: the whole matrix, one claim, one test, and
the recorder.
show, claim and proves are the command line of evidence.report,
evidence.claim and evidence.test; record is the command line of
evidence.record, which is a command line and nothing else because it writes a tracked
file and this server is read-only; stamp is the command line of evidence.stamp, a
read offered only here because it reads a path its caller names. The capability is
evidence.test and the command is
proves — test is a word the fish completion adapter refuses, so the command line
spells the relation with the verb rather than renaming the identity.
use clap::Parser;
use majordomus_cli::cli::{Cli, Command, EvidenceCommand};
fn parse(args: &[&str]) -> EvidenceCommand {
let cli = Cli::try_parse_from(args.iter().copied()).unwrap();
let Command::Evidence(args) = cli.command else { panic!("evidence") };
args.command
}
assert!(matches!(
parse(&["majordomus", "evidence", "show", "--state", "stale"]),
EvidenceCommand::Show { state: Some(s), check: false, .. } if s == "stale"
));
assert!(matches!(
parse(&["majordomus", "evidence", "claim", "evidence-both-directions"]),
EvidenceCommand::Claim { id } if id == "evidence-both-directions"
));
assert!(matches!(
parse(&["majordomus", "evidence", "proves", "crate:why"]),
EvidenceCommand::Proves { id } if id == "crate:why"
));
assert!(Cli::try_parse_from(["majordomus", "evidence", "test", "crate:why"]).is_err());
// recording reads a report a runner already wrote; it runs no test
assert!(matches!(
parse(&["majordomus", "evidence", "record", "--suite", "tmp/report.tsv"]),
EvidenceCommand::Record { suite: Some(p), origin: None, .. } if p.ends_with("report.tsv")
));
// a run measures the checkout it left; the recording carries that measurement
assert!(matches!(
parse(&["majordomus", "evidence", "stamp", "--report", "suite.tsv", "--exclude", "dist"]),
EvidenceCommand::Stamp { report: Some(r), exclude, .. }
if r.ends_with("suite.tsv") && exclude == ["dist"]
));
assert!(matches!(
parse(&[
"majordomus", "evidence", "record", "--suite", "s.tsv", "--provenance", "p.json",
"--provenance", "crate=c.json", "--ledger", "local",
]),
EvidenceCommand::Record { provenance, ledger: Some(l), .. }
if provenance == ["p.json", "crate=c.json"] && l == "local"
));Variants§
Show
Every claim against the evidence recorded for it
Fields
state: Option<String>Only claims in this proof state (proven, inputs_unchanged, stale, failing, not_run, unrunnable, no_test)
Claim
One claim: its proof state, the execution behind it, and how to reproduce it
Proves
One test: its latest execution and every claim it proves
Record
Record a run that happened into the ledger
Fields
crate_output: Option<PathBuf>A file holding cargo test’s output, for the crate’s own integration tests
Stamp
Measure the checkout as a run left it, for record --provenance
Trait Implementations§
Source§impl Debug for EvidenceCommand
impl Debug for EvidenceCommand
Source§impl FromArgMatches for EvidenceCommand
impl FromArgMatches for EvidenceCommand
Source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
Source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches,
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>
Source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Source§fn update_from_arg_matches_mut<'b>(
&mut self,
__clap_arg_matches: &mut ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches_mut<'b>( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Source§impl Subcommand for EvidenceCommand
impl Subcommand for EvidenceCommand
Source§fn augment_subcommands<'b>(__clap_app: Command) -> Command
fn augment_subcommands<'b>(__clap_app: Command) -> Command
Source§fn augment_subcommands_for_update<'b>(__clap_app: Command) -> Command
fn augment_subcommands_for_update<'b>(__clap_app: Command) -> Command
Command] so it can instantiate self via
[FromArgMatches::update_from_arg_matches_mut] Read moreSource§fn has_subcommand(__clap_name: &str) -> bool
fn has_subcommand(__clap_name: &str) -> bool
Self can parse a specific subcommand