From 7266a14753ed5d572aeed584b66b07d1b9921ca7 Mon Sep 17 00:00:00 2001 From: lukeflo Date: Thu, 9 Oct 2025 14:28:55 +0200 Subject: rewrite cli parsing; need to implement format-citekeys cli parsing --- src/main.rs | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) (limited to 'src/main.rs') 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()?; -- cgit v1.2.3