aboutsummaryrefslogtreecommitdiff
path: root/src/cliargs.rs
diff options
context:
space:
mode:
authorlukeflo2025-06-03 17:38:49 +0200
committerlukeflo2025-06-03 17:38:49 +0200
commitd7236320fde1994fa38c5d8b85c9f81f1559fff4 (patch)
treea3ff2fe49886d6bd33f0c6627d07669b377cbd22 /src/cliargs.rs
parent1dcb24c381990bdead5fa3df2fb95d74b176a8c1 (diff)
parent201aecebcd7c85127df9c43da01fdafc3465e53e (diff)
downloadbibiman-d7236320fde1994fa38c5d8b85c9f81f1559fff4.tar.gz
bibiman-d7236320fde1994fa38c5d8b85c9f81f1559fff4.zip
Merge pull request 'pdf-by-filename' (#28) from pdf-by-filename-#27 into main
Implemented PDF dir: + now you can set a `pdf_path` variable in the config and throuch the CLI flag `--pdf-dir` + this dir will be searched recursivley for PDF files which mathc a citekey from the used `.bib` files and connects with them + every entry can have multiple PDFs with the citekey-basename in different subdirs + the bibfile itself will not be altered + additionally, i rewrote the internal popup code for easier contribution
Diffstat (limited to 'src/cliargs.rs')
-rw-r--r--src/cliargs.rs19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/cliargs.rs b/src/cliargs.rs
index d4fac46..04886d1 100644
--- a/src/cliargs.rs
+++ b/src/cliargs.rs
@@ -33,6 +33,7 @@ pub struct CLIArgs {
pub pos_args: Vec<PathBuf>,
pub cfg_path: Option<PathBuf>,
pub light_theme: bool,
+ pub pdf_path: Option<PathBuf>,
}
impl CLIArgs {
@@ -55,6 +56,9 @@ impl CLIArgs {
Short('v') | Long("version") => args.versionarg = true,
Short('c') | Long("config-file") => args.cfg_path = Some(parser.value()?.parse()?),
Long("light-terminal") => args.light_theme = true,
+ Long("pdf-dir") => {
+ args.pdf_path = Some(parser.value()?.parse()?);
+ }
// Value(pos_arg) => parse_files(&mut args, pos_arg),
Value(pos_arg) => args.pos_args.push(pos_arg.into()),
_ => return Err(arg.unexpected()),
@@ -122,11 +126,16 @@ POSITIONAL ARGS:
Both can be passed multiple times
FLAGS:
- -h, --help Show this help and exit
- -v, --version Show the version and exit
- -c, --config-file Path to config file used for current session.
- Takes precedence over standard config file.
- --light-terminal Enable color mode for light terminal background",
+ -h, --help Show this help and exit
+ -v, --version Show the version and exit
+ -c, --config-file=<value> Path to config file used for current session.
+ Takes precedence over standard config file.
+ --light-terminal Enable color mode for light terminal background
+ --pdf-dir=<value> Use PDF files named by citekey at the given path and its
+ subdirs as value for the `file` field of the entry matching
+ the citekey for the current session.
+ Does not overwrite or change the original file.
+ (might not work with citekeys containing special chars)",
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_VERSION"),
);