pub struct EvidenceArgs {
pub repo: RepoArgs,
pub command: EvidenceCommand,
pub format: OutputFormat,
}Expand description
majordomus evidence. The output shape is global, so it reads the way a person writes
it — evidence show --findings --format json — and is declared once.
use clap::Parser;
use majordomus_cli::cli::{Cli, Command, EvidenceArgs, EvidenceCommand, OutputFormat};
let cli = Cli::try_parse_from([
"majordomus", "evidence", "show", "--findings", "--format", "json",
])
.unwrap();
let args: EvidenceArgs = match cli.command {
Command::Evidence(args) => args,
other => panic!("expected `evidence`, parsed {other:?}"),
};
// `--format` is declared once and reaches every subcommand, so it parses where a
// person writes it rather than only before the subcommand
assert!(matches!(args.format, OutputFormat::Json));
assert!(matches!(args.command, EvidenceCommand::Show { findings: true, .. }));
// the group runs nothing of its own: every runnable path here is a capability's
assert!(Cli::try_parse_from(["majordomus", "evidence"]).is_err());Fields§
§repo: RepoArgsWhere and how the repository is read.
command: EvidenceCommandshow, claim, proves, record or stamp. Required: the group runs nothing of its own,
so that every runnable path here is one a capability declares
rather than one classified command-line-only in cli::local.
format: OutputFormatOutput shape
Trait Implementations§
Source§impl Args for EvidenceArgs
impl Args for EvidenceArgs
Source§fn group_id() -> Option<Id>
fn group_id() -> Option<Id>
Report the [
ArgGroup::id][crate::ArgGroup::id] for this set of argumentsSource§fn augment_args<'b>(__clap_app: Command) -> Command
fn augment_args<'b>(__clap_app: Command) -> Command
Source§fn augment_args_for_update<'b>(__clap_app: Command) -> Command
fn augment_args_for_update<'b>(__clap_app: Command) -> Command
Append to [
Command] so it can instantiate self via
[FromArgMatches::update_from_arg_matches_mut] Read moreSource§impl Debug for EvidenceArgs
impl Debug for EvidenceArgs
Source§impl FromArgMatches for EvidenceArgs
impl FromArgMatches for EvidenceArgs
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>
Assign values from
ArgMatches to self.Source§fn update_from_arg_matches_mut(
&mut self,
__clap_arg_matches: &mut ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
Assign values from
ArgMatches to self.Auto Trait Implementations§
impl Freeze for EvidenceArgs
impl RefUnwindSafe for EvidenceArgs
impl Send for EvidenceArgs
impl Sync for EvidenceArgs
impl Unpin for EvidenceArgs
impl UnsafeUnpin for EvidenceArgs
impl UnwindSafe for EvidenceArgs
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more