pub struct ServedArgs {
pub repo: RepoArgs,
pub command: ServedCommand,
pub format: OutputFormat,
}Expand description
majordomus served: what a deployment serves, observed from outside and judged against
a commit. ServedArgs carries the repository the question is asked of, the subcommand
and the output shape.
use clap::Parser;
use majordomus_cli::cli::{Cli, Command, ServedArgs, ServedCommand};
let cli = Cli::try_parse_from(["majordomus", "served", "show"]).unwrap();
let Command::Served(args) = cli.command else { panic!("served") };
let _: ServedArgs = args; // the group's own arguments
fn parse(args: &[&str]) -> ServedCommand {
let Command::Served(a) = Cli::try_parse_from(args).unwrap().command else { panic!() };
a.command
}
assert!(matches!(
parse(&["majordomus", "served", "observe", "--commit", "origin/master", "--dry-run"]),
ServedCommand::Observe { commit: Some(c), dry_run: true, .. } if c == "origin/master"
));
assert!(matches!(
parse(&["majordomus", "served", "show", "--deployment", "pages"]),
ServedCommand::Show { deployment: Some(d), commit: None } if d == "pages"
));
assert!(Cli::try_parse_from(["majordomus", "served"]).is_err());Fields§
§repo: RepoArgsWhere and how the repository is read.
command: ServedCommandobserve, forge or show.
format: OutputFormatOutput shape
Trait Implementations§
Source§impl Args for ServedArgs
impl Args for ServedArgs
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 ServedArgs
impl Debug for ServedArgs
Source§impl FromArgMatches for ServedArgs
impl FromArgMatches for ServedArgs
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 ServedArgs
impl RefUnwindSafe for ServedArgs
impl Send for ServedArgs
impl Sync for ServedArgs
impl Unpin for ServedArgs
impl UnsafeUnpin for ServedArgs
impl UnwindSafe for ServedArgs
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