diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-08-23 13:11:09 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-08-23 13:14:13 +0200 |
commit | 94c656ad40a7aae570e5a5fb61ad32632acc6d46 (patch) | |
tree | 269614af20caf10d76643c302e0115bd36fd2378 /src/main.rs | |
parent | refactor(yt_dlp): Also move the `crates` subdirectory (diff) | |
download | yt-94c656ad40a7aae570e5a5fb61ad32632acc6d46.tar.gz yt-94c656ad40a7aae570e5a5fb61ad32632acc6d46.zip |
feat(treewide): Use a configuration file
This allows use to avoid duplication of default values in the codebase and obviously also facilitates changing these without having to re-compile.
Diffstat (limited to '')
-rw-r--r-- | src/main.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index 7852aa0..a6766f6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,6 +15,7 @@ use app::App; use cache::invalidate; use clap::Parser; use cli::{CacheCommand, CheckCommand, SelectCommand, SubscriptionCommand}; +use config::Config; use log::info; use select::cmds::handle_select_cmd; use tokio::{ @@ -31,6 +32,7 @@ pub mod cli; pub mod cache; pub mod comments; +pub mod config; pub mod constants; pub mod download; pub mod select; @@ -54,7 +56,8 @@ async fn main() -> Result<()> { .init() .expect("Let's just hope that this does not panic"); - let app = App::new(args.db_path.unwrap_or(constants::database()?)).await?; + let config = Config::from_config_file(args.db_path, args.config_path)?; + let app = App::new(config).await?; match args.command.unwrap_or(Command::default()) { Command::Download { |