diff --git a/src/main.rs b/src/main.rs index 680fcb1..fc5fbb1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -34,7 +34,11 @@ enum HlctlCommand { The configuration file located at $HOME/.config/herbstluftwm/hlctl.toml"#)] Save, /// Print the toml config to stdout - PrintConfig, + PrintConfig { + /// Print default config instead of config that `save` would use + #[arg(short, long)] + default: bool, + }, /// Start the top panel Panel, } @@ -46,7 +50,7 @@ fn main() { match args.command { HlctlCommand::Init => init(), HlctlCommand::Save => save(), - HlctlCommand::PrintConfig => print_config(), + HlctlCommand::PrintConfig { default } => print_config(default), HlctlCommand::Panel => { if let Err(err) = panel::panel(&merged_config()) { error!("panel: {err}"); @@ -105,8 +109,13 @@ fn merged_config() -> Config { collected } -fn print_config() { - println!("{}", merged_config().serialize().unwrap()) +fn print_config(default: bool) { + let cfg = if default { + Config::default() + } else { + merged_config() + }; + println!("{}", cfg.serialize().unwrap()) } fn save() {