diff --git a/src/main.rs b/src/main.rs index c277efc..7dd429d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -376,12 +376,12 @@ fn setup_logger() { builder.init(); } -async fn load_config_file(config: Config) -> Result { - match config.config_file.as_ref() { +async fn load_config_file(opt: Config) -> Result { + match opt.config_file.as_ref() { Some(path) => { debug!(?path, "loading config file"); let toml = tokio::fs::read_to_string(&path).await?; - let config: Config = match toml::from_str(&toml) { + let mut config: Config = match toml::from_str(&toml) { Ok(c) => c, Err(e) => panic!( "\nfatal error: parsing config file at {} failed:\n\n{}\n\n", @@ -389,10 +389,11 @@ async fn load_config_file(config: Config) -> Result { e ), }; + config.dry_run |= opt.dry_run; Ok(config) } - None => Ok(config), + None => Ok(opt), } }