pub struct OffloadArgs {
pub repo: RepoArgs,
pub declaration: Option<PathBuf>,
pub command: OffloadCommand,
pub format: OutputFormat,
}Expand description
majordomus offload. The declaration is the repository’s own unless --declaration
names a file; the output shape is global, as for worktree.
use clap::Parser;
use majordomus_cli::cli::{Cli, Command, OffloadArgs, OffloadCommand, OutputFormat};
let cli = Cli::try_parse_from([
"majordomus", "offload", "probe", "--format", "json", "--declaration", "hosts.yaml",
])
.unwrap();
let Command::Offload(offload) = cli.command else { panic!("expected `offload`") };
let offload: OffloadArgs = offload;
assert!(matches!(offload.command, OffloadCommand::Probe));
assert_eq!(offload.format, OutputFormat::Json);
assert_eq!(offload.declaration.unwrap().to_str(), Some("hosts.yaml"));
// there is no default subcommand: an offload names what it does
assert!(Cli::try_parse_from(["majordomus", "offload"]).is_err());Fields§
§repo: RepoArgsWhere the repository is found; its index is read for the declaration.
declaration: Option<PathBuf>Read this derive-offload declaration file instead of the repository’s
command: OffloadCommandThe subcommand.
format: OutputFormatOutput shape
Trait Implementations§
Source§impl Args for OffloadArgs
impl Args for OffloadArgs
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 OffloadArgs
impl Debug for OffloadArgs
Source§impl FromArgMatches for OffloadArgs
impl FromArgMatches for OffloadArgs
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 OffloadArgs
impl RefUnwindSafe for OffloadArgs
impl Send for OffloadArgs
impl Sync for OffloadArgs
impl Unpin for OffloadArgs
impl UnsafeUnpin for OffloadArgs
impl UnwindSafe for OffloadArgs
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