From 501bb7217be3eb60c1a66f49390545295d442ebc Mon Sep 17 00:00:00 2001 From: Denis Drakhnia Date: Sat, 1 Jun 2024 07:59:23 +0300 Subject: [PATCH] master: add cmd line option to dump default config --- master/src/cli.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/master/src/cli.rs b/master/src/cli.rs index aea551c..75297d0 100644 --- a/master/src/cli.rs +++ b/master/src/cli.rs @@ -63,6 +63,7 @@ pub fn parse() -> Result { ); opts.optopt("p", "port", &port_help, "PORT"); opts.optopt("c", "config", "config path", "PATH"); + opts.optflag("", "dump-config", "print default config"); opts.optopt("s", "stats-format", "stats format string", "FMT"); opts.optopt("I", "stats-interval", "stats interval", "SECONDS"); @@ -78,6 +79,11 @@ pub fn parse() -> Result { process::exit(0); } + if matches.opt_present("dump-config") { + println!("{}", include_str!("../config/default.toml")); + process::exit(0); + } + if let Some(value) = matches.opt_str("log") { match config::parse_log_level(value.as_ref()) { Some(level) => cli.log_level = Some(level),