2025-08-20 06:50:35 +09:00
|
|
|
use clap::Args;
|
2025-08-22 07:56:26 +09:00
|
|
|
use caretta_core::{config::PartialConfig, utils::runnable::Runnable};
|
2025-08-20 06:50:35 +09:00
|
|
|
use crate::cli::ConfigArgs;
|
|
|
|
|
|
|
|
#[derive(Debug, Args)]
|
|
|
|
pub struct ConfigListCommandArgs{
|
|
|
|
#[command(flatten)]
|
|
|
|
config: ConfigArgs,
|
|
|
|
#[arg(short,long)]
|
|
|
|
all: bool
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Runnable for ConfigListCommandArgs {
|
2025-08-21 07:40:33 +09:00
|
|
|
async fn run(self, app_name: &'static str) {
|
2025-08-22 07:56:26 +09:00
|
|
|
let config: PartialConfig = if self.all {
|
|
|
|
self.config.into_config(app_name).await.into()
|
|
|
|
} else {
|
|
|
|
self.config.to_partial_config_without_default(app_name).await
|
|
|
|
};
|
|
|
|
println!("{}", config.into_toml().unwrap())
|
|
|
|
|
2025-08-20 06:50:35 +09:00
|
|
|
}
|
|
|
|
}
|