From 088af3ca1c5968878e4ba868f7701f2a9276ff55 Mon Sep 17 00:00:00 2001 From: Code pianist <77950104+1739616529@users.noreply.github.com> Date: Sat, 10 Aug 2024 03:14:07 +0800 Subject: [PATCH] feat: nsv command config/list add command config/list. use config/list command print to nsv config foramt to terminal --- crates/nsv/src/command/config.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/crates/nsv/src/command/config.rs b/crates/nsv/src/command/config.rs index 7566237..61963ae 100644 --- a/crates/nsv/src/command/config.rs +++ b/crates/nsv/src/command/config.rs @@ -25,6 +25,9 @@ impl Command for Config { ConfigSubCommand::Get(get) => { get.apply(core).await?; } + ConfigSubCommand::List(get) => { + get.apply(core).await?; + } } Ok(()) } @@ -36,6 +39,8 @@ pub enum ConfigSubCommand { Set(ConfigSubSet), #[clap(name = "get", bin_name = "get")] Get(ConfigSubGet), + #[clap(name = "list", bin_name = "list")] + List(ConfigSubList), } @@ -70,3 +75,16 @@ impl Command for ConfigSubGet { Ok(()) } } + + +#[derive(clap::Parser, Debug)] +pub struct ConfigSubList { +} + +#[async_trait] +impl Command for ConfigSubList { + async fn apply(&self, core: &mut NsvCore) -> Result<(), NsvCoreError>{ + print_log_info!("config list: \n{}", &core.config); + Ok(()) + } +}