about summary refs log tree commit diff stats
path: root/src/cli.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/cli.rs23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/cli.rs b/src/cli.rs
index c567828..05c78de 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -10,14 +10,17 @@
 
 use std::path::PathBuf;
 
-use anyhow::{bail, Error};
+use anyhow::Context;
 use chrono::NaiveDate;
 use clap::{ArgAction, Args, Parser, Subcommand};
 use url::Url;
 use bytes::Bytes;
 
 use crate::{
-    constants, select::selection_file::duration::Duration,
+    config::{
+        default::{download, select, update},
+    },
+    select::selection_file::duration::Duration,
     storage::video_database::extractor_hash::LazyExtractorHash,
 };
 
@@ -33,10 +36,15 @@ pub struct CliArgs {
     #[arg(long="verbose", short = 'v', action = ArgAction::Count)]
     pub verbosity: u8,
 
-    /// Set the path to the videos.db. Otherwise use the default location
+    /// Set the path to the videos.db. This overrides the default and the config file.
     #[arg(long, short)]
     pub db_path: Option<PathBuf>,
 
+    /// Set the path to the config.toml.
+    /// This overrides the default.
+    #[arg(long, short)]
+    pub config_path: Option<PathBuf>,
+
     /// Silence all output
     #[arg(long, short = 'q')]
     pub quiet: bool,
@@ -52,7 +60,7 @@ pub enum Command {
 
         /// The maximum size the download dir should have. Beware that the value must be given in
         /// bytes.
-        #[arg(short, long, default_value = "3 GiB", value_parser = byte_parser)]
+        #[arg(short, long, default_value = download::max_cache_size(), value_parser = byte_parser)]
         max_cache_size: u64,
     },
 
@@ -88,7 +96,7 @@ pub enum Command {
 
     /// Update the video database
     Update {
-        #[arg(short, long, default_value = "20")]
+        #[arg(short, long, default_value_t = update::max_backlog() as u32)]
         /// The number of videos to updating
         max_backlog: u32,
 
@@ -192,12 +200,11 @@ pub enum SelectCommand {
         shared: SharedSelectionCommandArgs,
 
         /// The subtitles to download (e.g. 'en,de,sv')
-        #[arg(short = 'l', long, default_value = constants::DEFAULT_SUBTITLE_LANGS)]
+        #[arg(short = 'l', long, default_value = select::subtitle_langs())]
         subtitle_langs: String,
 
         /// The speed to set mpv to
-        // NOTE: KEEP THIS IN SYNC WITH THE `DEFAULT_MPV_PLAYBACK_SPEED` in `constants.rs` <2024-08-20>
-        #[arg(short, long, default_value = "2.7")]
+        #[arg(short, long, default_value_t = select::playback_speed())]
         speed: f64,
     },