aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
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()?;