diff --git a/src/command/repl.rs b/src/command/repl.rs index c132cdc..5a3e25c 100644 --- a/src/command/repl.rs +++ b/src/command/repl.rs @@ -1,6 +1,6 @@ use std::io::Write; -use clap::{ArgMatches, Command as ClapCommand, FromArgMatches, Args}; +use clap::{ArgMatches, Args, Command as ClapCommand, FromArgMatches}; use tempfile::Builder as TempFileBuilder; use tokio::process::Command; @@ -12,12 +12,11 @@ use crate::nix::info::NixCheck; #[command( name = "repl", about = "Start an interactive REPL with the complete configuration", - long_about = - r#"Start an interactive REPL with the complete configuration + long_about = r#"Start an interactive REPL with the complete configuration In the REPL, you can inspect the configuration interactively with tab completion. The node configurations are accessible under the `nodes` -attribute set."#, +attribute set."# )] pub struct Opts {} diff --git a/src/command/upload_keys.rs b/src/command/upload_keys.rs index 16555d4..2ce213f 100644 --- a/src/command/upload_keys.rs +++ b/src/command/upload_keys.rs @@ -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, util}; pub use super::apply::run; use super::apply::DeployOpts; -pub fn subcommand() -> ClapCommand { - let command = ClapCommand::new("upload-keys") - .about("Upload keys to remote hosts") - .long_about( - r#"Upload keys to remote hosts +#[derive(Debug, Args)] +#[command( + name = "upload-keys", + about = "Upload keys to remote hosts", + long_about = r#"Upload keys to remote hosts -This subcommand behaves as if you invoked `apply` with the pseudo `keys` goal."#, - ) - .arg( - Arg::new("goal") - .hide(true) - .default_value("keys") - .value_parser(PossibleValuesParser::new(["keys"])) - .num_args(1), - ); - - util::register_selector_args(DeployOpts::augment_args_for_update(command)) +This subcommand behaves as if you invoked `apply` with the pseudo `keys` goal."# +)] +pub struct Opts { + #[command(flatten)] + deploy: DeployOpts, + #[arg(hide = true, default_value_t = Goal::Build)] + goal: Goal, +} + +pub fn subcommand() -> ClapCommand { + Opts::augment_args(ClapCommand::new("upload-keys")) }