aboutsummaryrefslogtreecommitdiff
path: root/src/cliargs.rs
diff options
context:
space:
mode:
authorlukeflo2024-11-22 14:04:42 +0100
committerlukeflo2024-11-22 14:04:42 +0100
commite5274a2e0c3c6ba62d12420d487e3725e154cee4 (patch)
tree59300d8c6586b878584bb61b8dbe2ceba2c14e6e /src/cliargs.rs
parent2621a347a0e6f2a2e1b625ca26aad3a0cf8e58f5 (diff)
downloadbibiman-e5274a2e0c3c6ba62d12420d487e3725e154cee4.tar.gz
bibiman-e5274a2e0c3c6ba62d12420d487e3725e154cee4.zip
open multiple files: per CLI possible
Diffstat (limited to 'src/cliargs.rs')
-rw-r--r--src/cliargs.rs16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/cliargs.rs b/src/cliargs.rs
index 7fd512e..a298f65 100644
--- a/src/cliargs.rs
+++ b/src/cliargs.rs
@@ -34,7 +34,7 @@ sarge! {
pub struct CLIArgs {
pub helparg: bool,
pub versionarg: bool,
- pub bibfilearg: PathBuf,
+ pub bibfilearg: Vec<PathBuf>,
}
impl Default for CLIArgs {
@@ -47,10 +47,9 @@ impl CLIArgs {
pub fn new() -> Self {
let (cli_args, pos_args) = ArgumentsCLI::parse().expect("Could not parse CLI arguments");
let bibfilearg = if pos_args.len() > 1 {
- PathBuf::from(&pos_args[1])
- // pos_args[1].to_string()
+ parse_files(pos_args)
} else {
- PathBuf::new()
+ panic!("No bibfile provided")
};
Self {
helparg: cli_args.help,
@@ -60,6 +59,15 @@ impl CLIArgs {
}
}
+pub fn parse_files(args: Vec<String>) -> Vec<PathBuf> {
+ let mut files: Vec<PathBuf> = Vec::new();
+ for f in args {
+ files.push(PathBuf::from(f))
+ }
+ files.remove(0);
+ files
+}
+
pub fn help_func() -> String {
let help = format!(
"\