From 8ee721140f96a2427e57d44900a6054ffee6b1ca Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Sat, 7 Nov 2026 15:17:40 +0100 Subject: chore(yt/{cmd,app}): Use the new config macro and adapt to cli changes --- crates/yt/src/app.rs | 2 +- crates/yt/src/commands/mod.rs | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'crates') 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))); } } -- cgit v1.3.1