pub struct EconomicsExplainArgs {
pub repo: RepoArgs,
pub format: OutputFormat,
pub metric: String,
}Expand description
majordomus economics explain. The metric is a required positional identifier, spelled
as the summary lists it; one the methodology does not declare is refused as not found,
with the declared metrics named, rather than answered with an empty explanation.
use clap::Parser;
use majordomus_cli::cli::{
Cli, Command, EconomicsCommand, EconomicsExplainArgs, OutputFormat,
};
fn explain_of(argv: &[&str]) -> EconomicsExplainArgs {
let cli = Cli::try_parse_from(argv.iter().copied()).unwrap();
let Command::Economics(args) = cli.command else { panic!("economics") };
let EconomicsCommand::Explain(explain) = args.command else { panic!("explain") };
explain
}
let e = explain_of(&["majordomus", "economics", "explain", "effective_token_reduction"]);
assert_eq!(e.metric, "effective_token_reduction");
assert_eq!(e.format, OutputFormat::Text);
// there is no default metric to explain
assert!(Cli::try_parse_from(["majordomus", "economics", "explain"]).is_err());Fields§
§repo: RepoArgsWhere and how the repository is read.
format: OutputFormatOutput shape
metric: StringThe metric, e.g. effective_token_reduction
Trait Implementations§
Source§impl Args for EconomicsExplainArgs
impl Args for EconomicsExplainArgs
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 EconomicsExplainArgs
impl Debug for EconomicsExplainArgs
Source§impl FromArgMatches for EconomicsExplainArgs
impl FromArgMatches for EconomicsExplainArgs
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 EconomicsExplainArgs
impl RefUnwindSafe for EconomicsExplainArgs
impl Send for EconomicsExplainArgs
impl Sync for EconomicsExplainArgs
impl Unpin for EconomicsExplainArgs
impl UnsafeUnpin for EconomicsExplainArgs
impl UnwindSafe for EconomicsExplainArgs
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