From 0b2ded4fac07140d3448a16e726c511e68863e05 Mon Sep 17 00:00:00 2001 From: ivan-aksamentov Date: Fri, 8 Sep 2023 07:44:21 +0200 Subject: [PATCH] refactor(cli): simplify check for completions cli args --- packages_rs/nextclade-cli/src/cli/nextclade_cli.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/packages_rs/nextclade-cli/src/cli/nextclade_cli.rs b/packages_rs/nextclade-cli/src/cli/nextclade_cli.rs index b40772240..bf45763db 100644 --- a/packages_rs/nextclade-cli/src/cli/nextclade_cli.rs +++ b/packages_rs/nextclade-cli/src/cli/nextclade_cli.rs @@ -27,13 +27,6 @@ lazy_static! { pub static ref SHELLS: Vec<&'static str> = ["bash", "elvish", "fish", "fig", "powershell", "zsh"].to_vec(); } -pub fn check_shells(value: &str) -> Result { - SHELLS - .contains(&value) - .then_some(value.to_owned()) - .ok_or_else(|| eyre!("Unknown shell: '{value}'. Possible values: {}", SHELLS.join(", "))) -} - #[derive(Parser, Debug)] #[clap(name = "nextclade")] #[clap(author, version)] @@ -69,7 +62,7 @@ pub enum NextcladeCommands { /// Completions { /// Name of the shell to generate appropriate completions - #[clap(value_name = "SHELL", default_value_t = String::from("bash"), value_parser = check_shells)] + #[clap(value_name = "SHELL", default_value_t = String::from("bash"), value_parser = SHELLS.clone())] shell: String, },