aboutsummaryrefslogtreecommitdiff
path: root/src/config.rs
diff options
context:
space:
mode:
authorlukeflo2025-05-24 17:31:33 +0200
committerlukeflo2025-05-24 17:31:33 +0200
commit28030fd0830478872be2b9e86b74e0c054a96111 (patch)
tree1d5029f00bc42a81378529816eaf55e162b9ce4f /src/config.rs
parent7fe5acb85b9e665ec83f590942ee78b8c90d6aae (diff)
downloadbibiman-28030fd0830478872be2b9e86b74e0c054a96111.tar.gz
bibiman-28030fd0830478872be2b9e86b74e0c054a96111.zip
implemented a workflow, but citekey matching still buggy
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs
index d554c58..1532d31 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -51,6 +51,11 @@ const DEFAULT_CONFIG: &str = r##"
## Use absolute paths (~ for HOME works). Otherwise, loading might not work.
# file_prefix = "/some/path/prefix"
+## Path to folder (with subfolders) containing PDF files with the basename
+## of the format "citekey.pdf". Other PDF basenames are not accepted.
+## Use absolute paths (~ for HOME works). Otherwise, loading might not work.
+# pdf_path = "/path/to/pdf/folder"
+
# [colors]
## Default values for dark-themed terminal
## Possible values are:
@@ -84,6 +89,7 @@ pub struct General {
pub pdf_opener: String,
pub url_opener: String,
pub file_prefix: Option<PathBuf>,
+ pub pdf_path: Option<PathBuf>,
}
/// Substruct [colors] in config.toml
@@ -110,6 +116,7 @@ impl Default for BibiConfig {
pdf_opener: select_opener(),
url_opener: select_opener(),
file_prefix: None,
+ pdf_path: None,
},
colors: Colors {
main_text_color: Color::Indexed(250),
@@ -140,6 +147,14 @@ impl BibiConfig {
Ok(cfg_file)
}
+ /// overwright config values with values set explicitly through the
+ /// command line interface
+ pub fn cli_overwright(&mut self, args: &CLIArgs) {
+ if args.pdf_path.is_some() {
+ self.general.pdf_path = args.pdf_path.clone();
+ }
+ }
+
/// Activates the default color scheme for light background terminals
pub fn light_colors(&mut self) {
self.colors.main_text_color = Color::Indexed(235);