From 72d36bb8aa1ff8f5fb6cf3e90e89cfec25a702e2 Mon Sep 17 00:00:00 2001 From: berrysweet Date: Tue, 11 Jul 2023 10:19:03 +0200 Subject: [PATCH] fix: correct order of operations during loading Config files now get loaded or created before args are parsed. This allows a default configuration to be generated by running `livejrnl-rs` without needing to pass required args. --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 7a451e1..f9d62e7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,6 +18,7 @@ const APP_NAME: &str = "livejrnl-rs"; const ERR_JOURNAL_NOT_FOUND: &str = "ERROR: No journal data specified.\n\nUsage:\n\tjrnl --format json | livejrnl-rs"; fn main() { + let config_data = load_config(); let args: LaunchArgs = LaunchArgs::parse_args_default_or_exit(); //println!("{:#?}", args); @@ -33,7 +34,6 @@ fn main() { let journal: Journal = util::journal::parse_journal_json(&jrnl_json); //println!("{:#?}", journal); - let config_data = load_config(); match config_data { Ok(config_data) => { println!("{:#?}", config_data); -- libgit2 1.7.2