aboutsummaryrefslogtreecommitdiff
path: root/src/app.rs
diff options
context:
space:
mode:
authorlukeflo2025-02-21 20:17:27 +0100
committerlukeflo2025-02-21 20:17:27 +0100
commitddb6326c1896b82b759d930fb08ea46a820e275a (patch)
tree8fd4db8081770e0c4b4bdbf3c680c48637da8a03 /src/app.rs
parentf60be8b6b1e5987613081c9ad8d63a26a1a1bac9 (diff)
downloadbibiman-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/app.rs')
-rw-r--r--src/app.rs12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/app.rs b/src/app.rs
index 55f49de..b3778af 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -364,11 +364,7 @@ impl App {
pub fn open_connected_file(cfg: &BibiConfig, file: &OsStr) -> Result<()> {
// Build command to execute pdf-reader. 'xdg-open' is Linux standard
- let cmd = match &cfg.general.pdf_opener {
- Some(c) => c,
- None => &select_opener(),
- };
-
+ let cmd = cfg.general.as_ref().unwrap().pdf_opener.as_ref().unwrap();
// If necessary, replace ~ with /home dir
let file = PathBuf::from(file);
@@ -388,11 +384,7 @@ pub fn open_connected_file(cfg: &BibiConfig, file: &OsStr) -> Result<()> {
pub fn open_connected_link(cfg: &BibiConfig, link: &str) -> Result<()> {
// Build command to execute pdf-reader. 'xdg-open' is Linux standard
- let cmd = match &cfg.general.url_opener {
- Some(c) => c,
- None => &select_opener(),
- };
-
+ let cmd = cfg.general.as_ref().unwrap().url_opener.as_ref().unwrap();
// Pass filepath as argument, pipe stdout and stderr to /dev/null
// to keep the TUI clean (where is it piped on Windows???)
let _ = Command::new(cmd)