Fix upload-keys command

This commit is contained in:
i1i1 2023-08-10 02:02:18 +03:00 committed by Zhaofeng Li
parent ed23d1da67
commit ce0782ccac
2 changed files with 21 additions and 22 deletions

View file

@ -1,6 +1,6 @@
use std::io::Write; 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 tempfile::Builder as TempFileBuilder;
use tokio::process::Command; use tokio::process::Command;
@ -12,12 +12,11 @@ use crate::nix::info::NixCheck;
#[command( #[command(
name = "repl", name = "repl",
about = "Start an interactive REPL with the complete configuration", about = "Start an interactive REPL with the complete configuration",
long_about = long_about = r#"Start an interactive REPL with the complete configuration
r#"Start an interactive REPL with the complete configuration
In the REPL, you can inspect the configuration interactively with tab In the REPL, you can inspect the configuration interactively with tab
completion. The node configurations are accessible under the `nodes` completion. The node configurations are accessible under the `nodes`
attribute set."#, attribute set."#
)] )]
pub struct Opts {} pub struct Opts {}

View file

@ -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; pub use super::apply::run;
use super::apply::DeployOpts; use super::apply::DeployOpts;
pub fn subcommand() -> ClapCommand { #[derive(Debug, Args)]
let command = ClapCommand::new("upload-keys") #[command(
.about("Upload keys to remote hosts") name = "upload-keys",
.long_about( about = "Upload keys to remote hosts",
r#"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."#, This subcommand behaves as if you invoked `apply` with the pseudo `keys` goal."#
) )]
.arg( pub struct Opts {
Arg::new("goal") #[command(flatten)]
.hide(true) deploy: DeployOpts,
.default_value("keys") #[arg(hide = true, default_value_t = Goal::Build)]
.value_parser(PossibleValuesParser::new(["keys"])) goal: Goal,
.num_args(1), }
);
pub fn subcommand() -> ClapCommand {
util::register_selector_args(DeployOpts::augment_args_for_update(command)) Opts::augment_args(ClapCommand::new("upload-keys"))
} }