caretta_sync_cli/cli/config/
list.rs

1use crate::cli::ConfigArgs;
2use caretta_sync_core::{config::PartialConfig, utils::runnable::Runnable};
3use clap::Args;
4
5#[derive(Debug, Args)]
6pub struct ConfigListCommandArgs {
7    #[command(flatten)]
8    config: ConfigArgs,
9    #[arg(short, long)]
10    all: bool,
11}
12
13impl Runnable for ConfigListCommandArgs {
14    #[tokio::main]
15    async fn run(self, app_name: &'static str) {
16        let config: PartialConfig = if self.all {
17            self.config.into_config(app_name).await.into()
18        } else {
19            self.config
20                .to_partial_config_without_default(app_name)
21                .await
22        };
23        println!("{}", config.into_toml().unwrap())
24    }
25}