forked from DGNum/colmena
Convert build arguments to type-safe clap derive
This commit is contained in:
parent
87f4e3a676
commit
cdfc1f15a1
1 changed files with 18 additions and 18 deletions
|
@ -1,25 +1,25 @@
|
||||||
use clap::{builder::PossibleValuesParser, Arg, Args, Command as ClapCommand};
|
use clap::{Args, Command as ClapCommand};
|
||||||
|
|
||||||
use crate::util;
|
use crate::nix::Goal;
|
||||||
|
|
||||||
pub use super::apply::run;
|
pub use super::apply::run;
|
||||||
use super::apply::DeployOpts;
|
use super::apply::DeployOpts;
|
||||||
|
|
||||||
pub fn subcommand() -> ClapCommand {
|
#[derive(Debug, Args)]
|
||||||
let command = ClapCommand::new("build")
|
#[command(
|
||||||
.about("Build configurations but not push to remote machines")
|
name = "build",
|
||||||
.long_about(
|
about = "Build configurations but not push to remote machines",
|
||||||
r#"Build configurations but not push to remote machines
|
long_about = r#"Build configurations but not push to remote machines
|
||||||
|
|
||||||
This subcommand behaves as if you invoked `apply` with the `build` goal."#,
|
This subcommand behaves as if you invoked `apply` with the `build` goal."#
|
||||||
)
|
)]
|
||||||
.arg(
|
pub struct Opts {
|
||||||
Arg::new("goal")
|
#[command(flatten)]
|
||||||
.hide(true)
|
deploy: DeployOpts,
|
||||||
.default_value("build")
|
#[arg(hide = true, default_value_t = Goal::Build)]
|
||||||
.value_parser(PossibleValuesParser::new(["build"]))
|
goal: Goal,
|
||||||
.num_args(1),
|
}
|
||||||
);
|
|
||||||
|
pub fn subcommand() -> ClapCommand {
|
||||||
util::register_selector_args(DeployOpts::augment_args_for_update(command))
|
Opts::augment_args(ClapCommand::new("build"))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue