aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorlukeflo2025-02-24 15:29:47 +0000
committerlukeflo2025-02-24 15:29:47 +0000
commit5da77a2f812a0bb6e0057f7b2e2c642142fca125 (patch)
tree6be886693445a54e4cbd7b98151555eec220e863 /src/main.rs
parentdd8dd9611771491e723a49b41cf27b1e9090664d (diff)
parentaff7c398da005029a293178e487cf5323e507fb4 (diff)
downloadbibiman-5da77a2f812a0bb6e0057f7b2e2c642142fca125.tar.gz
bibiman-5da77a2f812a0bb6e0057f7b2e2c642142fca125.zip
Merge pull request 'Implement config file' (#15) from implement-config into main
Reviewed-on: https://codeberg.org/lukeflo/bibiman/pulls/15
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(())
}