From 450ec49bf0e0482f3744468dda07f3f770285205 Mon Sep 17 00:00:00 2001 From: EliasSchriefer Date: Tue, 13 Jul 2021 13:30:16 +0000 Subject: [PATCH] Fix database-path not being read from config `database-path` in config was correct, but was being overwritten by `--database-path` option. In a test case the option was not given, but clap/structopt marked it as `present`. The occurrences were `0` though. --- src/main.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 4c25055..320da7b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -28,12 +28,11 @@ async fn main() -> Result<(), Box> { let mut config = Config::get(&options).await?; - if clap_matches.is_present("database-path") { - config.database_path = options.database_path; + if clap_matches.occurrences_of("database-path") > 0 { + config.database_path = options.database_path.clone(); } - #[cfg(debug_assertions)] - println!("{:?}", config); + dbg!(&config); #[cfg(feature = "sqlite")] let mut sqlite_connection = RwLock::new(sqlite::connect(&config.database_path).await?);