diff options
| author | lukeflo | 2025-02-21 20:17:27 +0100 |
|---|---|---|
| committer | lukeflo | 2025-02-21 20:17:27 +0100 |
| commit | ddb6326c1896b82b759d930fb08ea46a820e275a (patch) | |
| tree | 8fd4db8081770e0c4b4bdbf3c680c48637da8a03 /src/bibiman.rs | |
| parent | f60be8b6b1e5987613081c9ad8d63a26a1a1bac9 (diff) | |
| download | bibiman-ddb6326c1896b82b759d930fb08ea46a820e275a.tar.gz bibiman-ddb6326c1896b82b759d930fb08ea46a820e275a.zip | |
parse config file
+ set default values for config fields
+ merge fields named in the config file with default values
+ values from file take precedence over default values
+ to accomplish this, all config values are wrapped in `Option<T>`
Diffstat (limited to 'src/bibiman.rs')
| -rw-r--r-- | src/bibiman.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/bibiman.rs b/src/bibiman.rs index ecddc4c..b68b0fa 100644 --- a/src/bibiman.rs +++ b/src/bibiman.rs @@ -85,8 +85,8 @@ impl Bibiman { // Constructs a new instance of [`App`]. pub fn new(args: &mut CLIArgs, cfg: &mut BibiConfig) -> Result<Self> { let mut main_bibfiles: Vec<PathBuf> = args.pos_args.clone(); - if cfg.general.bibfiles.is_some() { - main_bibfiles.append(cfg.general.bibfiles.as_mut().unwrap()) + if cfg.general.as_ref().unwrap().bibfiles.is_some() { + main_bibfiles.append(cfg.general.as_mut().unwrap().bibfiles.as_mut().unwrap()) }; let main_bibfiles = cliargs::parse_files(main_bibfiles); let main_biblio = BibiSetup::new(&main_bibfiles); @@ -381,7 +381,7 @@ impl Bibiman { tui.exit()?; // Use VISUAL or EDITOR. Set "vi" as last fallback let mut cmd: Command = EditorBuilder::new() - .source(cfg.general.editor.clone()) + .source(cfg.general.as_ref().unwrap().editor.clone()) .environment() .source(Some("vi")) .build() |
