aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs
index 78c5075..302ba7a 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -18,18 +18,20 @@
use app::App;
use cliargs::CLIArgs;
use color_eyre::eyre::Result;
+use config::BibiConfig;
use errorsetup::init_error_hooks;
pub mod app;
pub mod bibiman;
pub mod cliargs;
+pub mod config;
pub mod errorsetup;
pub mod tui;
#[tokio::main]
async fn main() -> Result<()> {
// Parse CLI arguments
- let mut parsed_args = CLIArgs::parse_args().unwrap();
+ let mut parsed_args = CLIArgs::parse_args()?;
// Print help if -h/--help flag is passed and exit
if parsed_args.helparg {
@@ -43,11 +45,21 @@ async fn main() -> Result<()> {
std::process::exit(0);
}
+ // Build default config
+ // let mut cfg = BibiConfig::default();
+
+ // if parsed_args.light_theme {
+ // cfg.light_colors();
+ // }
+ // // Merge values from config file if present
+ // cfg.parse_config(&parsed_args)?;
+
+ let mut cfg = BibiConfig::parse_config(&parsed_args)?;
init_error_hooks()?;
// Create an application.
- let mut app = App::new(&parsed_args)?;
+ let mut app = App::new(&mut parsed_args, &mut cfg)?;
- app.run(&mut parsed_args).await?;
+ app.run(&cfg).await?;
Ok(())
}