pub enum OffloadCommand {
Hosts,
Probe,
Derive {
worktree: PathBuf,
host: Option<String>,
keep: bool,
},
}Expand description
The subcommands of majordomus offload: hosts reads the declaration and contacts
nobody, probe measures every declared host over ssh and names the one a derive would
take, and derive sends a worktree there and stages what the derive changed.
use clap::Parser;
use majordomus_cli::cli::{Cli, Command, OffloadCommand};
// with nothing named, the current directory is derived on the host the probe chooses
let cli = Cli::try_parse_from(["majordomus", "offload", "derive"]).unwrap();
let Command::Offload(offload) = cli.command else { panic!("expected `offload`") };
let OffloadCommand::Derive { worktree, host, keep } = offload.command else { panic!() };
assert_eq!((worktree.to_str(), host, keep), (Some("."), None, false));
let cli = Cli::try_parse_from(["majordomus", "offload", "derive", "../wt", "--host", "lundra", "--keep"]).unwrap();
let Command::Offload(offload) = cli.command else { panic!("expected `offload`") };
let OffloadCommand::Derive { worktree, host, keep } = offload.command else { panic!() };
assert_eq!((worktree.to_str(), host.as_deref(), keep), (Some("../wt"), Some("lundra"), true));Variants§
Hosts
The declared hosts and their limits, the queue and the remote layout, as the declaration states them; reads no host. A repository that declares none says so and exits 0
Probe
Measure every declared host — free space, derives running or waiting — and name the one a derive would take; exit 12 when none can take one
Derive
Derive a worktree on a declared host and stage what it changed; nothing is committed or pushed. Exit 2 on an untracked file or an unresolved merge, 10 when the derive fails, 11 when it deletes a tracked file, 12 when no host can take it, 75 when the queue’s wait runs out
Trait Implementations§
Source§impl Debug for OffloadCommand
impl Debug for OffloadCommand
Source§impl FromArgMatches for OffloadCommand
impl FromArgMatches for OffloadCommand
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 OffloadCommand
impl Subcommand for OffloadCommand
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