diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-11-07 15:17:40 +0100 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-11-07 15:17:40 +0100 |
| commit | 8ee721140f96a2427e57d44900a6054ffee6b1ca (patch) | |
| tree | 3784e547148396cbb3a5c354389f4a2e5e622d16 | |
| parent | refactor(yt/yt_dlp): Also take already constructed yt_dlps, preliminary suppo... (diff) | |
| download | yt-8ee721140f96a2427e57d44900a6054ffee6b1ca.zip | |
chore(yt/{cmd,app}): Use the new config macro and adapt to cli changes
Diffstat (limited to '')
| -rw-r--r-- | crates/yt/src/app.rs | 2 | ||||
| -rw-r--r-- | crates/yt/src/commands/mod.rs | 13 |
2 files changed, 9 insertions, 6 deletions
diff --git a/crates/yt/src/app.rs b/crates/yt/src/app.rs index 3ea12a4..40b99c5 100644 --- a/crates/yt/src/app.rs +++ b/crates/yt/src/app.rs @@ -13,7 +13,7 @@ use anyhow::{Context, Result}; use log::warn; use sqlx::{SqlitePool, sqlite::SqliteConnectOptions}; -use crate::{config::Config, storage::migrate::migrate_db}; +use crate::{config::def::Config, storage::migrate::migrate_db}; #[derive(Debug)] pub(crate) struct App { diff --git a/crates/yt/src/commands/mod.rs b/crates/yt/src/commands/mod.rs index 5eb1fad..fd6f1b1 100644 --- a/crates/yt/src/commands/mod.rs +++ b/crates/yt/src/commands/mod.rs @@ -23,7 +23,7 @@ use crate::{ subscriptions::SubscriptionCommand, update::UpdateCommand, videos::VideosCommand, watch::WatchCommand, }, - config::Config, + config::def::Config, storage::db::subscription::{Subscription, Subscriptions}, }; @@ -44,7 +44,7 @@ mod videos; mod watch; #[derive(Subcommand, Debug)] -#[allow(private_interfaces)] // Only the main `implm` method should be accessible. +#[expect(private_interfaces, reason = "Only the main `implm` method should be accessible.")] pub(super) enum Command { /// Manipulate the download cache Cache { @@ -54,7 +54,7 @@ pub(super) enum Command { /// Show, the configuration options in effect. Config { - #[command(flatten)] + #[command(subcommand)] cmd: ConfigCommand, }, @@ -151,7 +151,10 @@ fn complete_subscription_condition( return output; }; - let Ok(config) = Config::from_config_file(None, None, None, None) else { + let Ok(config_path) = crate::config::paths::config_path() else { + return output; + }; + let Ok(config) = Config::from_config_file(&config_path, vec![]) else { return output; }; @@ -170,7 +173,7 @@ fn complete_subscription_condition( let mut pre_output = vec![]; for (sub_name, sub) in all.0 { - if sub_name.starts_with(¤t_prog) && condition(&sub) { + if sub_name.contains(¤t_prog) && condition(&sub) { pre_output.push((sub_name.clone(), CompletionCandidate::new(sub_name))); } } |
