From 68a6aa6a0f0d2c9a9e3c8c967f622cdeb35c3034 Mon Sep 17 00:00:00 2001 From: Frank Bell Date: Thu, 2 May 2024 11:04:25 +0100 Subject: [PATCH 1/3] feat(help): possible values --- crates/pop-cli/src/commands/new/parachain.rs | 21 ++++++++++++++++---- crates/pop-parachains/src/templates.rs | 12 ++++++++--- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/crates/pop-cli/src/commands/new/parachain.rs b/crates/pop-cli/src/commands/new/parachain.rs index 737b0808..7fae6f90 100644 --- a/crates/pop-cli/src/commands/new/parachain.rs +++ b/crates/pop-cli/src/commands/new/parachain.rs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0 use crate::style::{style, Theme}; use anyhow::Result; -use clap::Args; +use clap::{builder::PossibleValue, Args}; use std::{ fs, path::{Path, PathBuf}, @@ -9,20 +9,23 @@ use std::{ use cliclack::{clear_screen, confirm, input, intro, log, outro, outro_cancel, set_theme}; use pop_parachains::{instantiate_template_dir, Config, Git, GitHub, Provider, Release, Template}; +use strum::VariantArray; #[derive(Args)] pub struct NewParachainCommand { #[arg(help = "Name of the project. If empty assistance in the process will be provided.")] pub(crate) name: Option, #[arg( - help = "Template provider. Options are pop or parity (deprecated).", - default_value = "pop" + help = "Template provider.", + default_value = Provider::Pop.as_ref(), + value_parser = crate::enum_variants!(Provider) )] pub(crate) provider: Option, #[arg( short = 't', long, - help = "Template to use: 'base' for Pop and 'cpt' and 'fpt' for Parity templates" + help = "Template to use.", + value_parser = crate::enum_variants!(Template) )] pub(crate) template: Option