aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorlukeflo2025-10-09 14:28:55 +0200
committerlukeflo2025-10-09 14:28:55 +0200
commit7266a14753ed5d572aeed584b66b07d1b9921ca7 (patch)
tree2434200ae537da18855fe019731d695689e686d8 /src/main.rs
parent952dc94b412ffcff26a59c37f3112079c78058ff (diff)
downloadbibiman-7266a14753ed5d572aeed584b66b07d1b9921ca7.tar.gz
bibiman-7266a14753ed5d572aeed584b66b07d1b9921ca7.zip
rewrite cli parsing; need to implement format-citekeys cli parsing
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs30
1 files changed, 1 insertions, 29 deletions
diff --git a/src/main.rs b/src/main.rs
index c956d7c..58805d5 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -31,35 +31,7 @@ pub mod tui;
#[tokio::main]
async fn main() -> Result<()> {
// Parse CLI arguments
- let mut parsed_args = CLIArgs::parse_args()?;
-
- // Print help if -h/--help flag is passed and exit
- if parsed_args.helparg {
- println!("{}", cliargs::help_func());
- std::process::exit(0);
- }
-
- // Print version if -v/--version flag is passed and exit
- if parsed_args.versionarg {
- println!("{}", cliargs::version_func());
- std::process::exit(0);
- }
-
- if parsed_args
- .cfg_path
- .as_ref()
- .is_some_and(|f| !f.try_exists().unwrap() || !f.is_file())
- {
- BibiConfig::create_default_config(&parsed_args);
- }
-
- let mut cfg = if parsed_args.cfg_path.is_some() {
- BibiConfig::parse_config(&parsed_args)?
- } else {
- BibiConfig::new(&parsed_args)
- };
-
- cfg.cli_overwrite(&parsed_args);
+ let (mut parsed_args, mut cfg) = CLIArgs::parse_args()?;
init_error_hooks()?;