From c6d5b98e869f9cf43b57893fe1966b7cdcf9e433 Mon Sep 17 00:00:00 2001 From: Alex Clarke Date: Thu, 29 Jan 2026 10:23:05 -0700 Subject: [PATCH] feat: Implemented a 'config-path' command to print out the default Managarr configuration file path to help address #54 --- src/cli/mod.rs | 7 +++++++ src/main.rs | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/cli/mod.rs b/src/cli/mod.rs index 872a18e..bb5acd1 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -3,6 +3,7 @@ use std::sync::Arc; use anyhow::Result; use clap::{Subcommand, command}; use clap_complete::Shell; +use indoc::indoc; use lidarr::{LidarrCliHandler, LidarrCommand}; use radarr::{RadarrCliHandler, RadarrCommand}; use sonarr::{SonarrCliHandler, SonarrCommand}; @@ -43,6 +44,12 @@ pub enum Command { #[arg(long, help = "Disable colored log output")] no_color: bool, }, + + #[command(about = indoc!{" + Print the full path to the default configuration file. + This file can be changed to another location using the '--config-file' flag + "})] + ConfigPath, } pub trait CliCommandHandler<'a, 'b, T: Into> { diff --git a/src/main.rs b/src/main.rs index 4baa095..2442e06 100644 --- a/src/main.rs +++ b/src/main.rs @@ -86,7 +86,7 @@ struct GlobalOpts { global = true, value_parser, env = "MANAGARR_CONFIG_FILE", - help = "The Managarr configuration file to use" + help = "The Managarr configuration file to use; defaults to the path shown by 'managarr config-path'" )] config_file: Option, #[arg( @@ -170,6 +170,10 @@ async fn main() -> Result<()> { generate(shell, &mut cli, "managarr", &mut io::stdout()) } Command::TailLogs { no_color } => tail_logs(no_color).await?, + Command::ConfigPath => println!( + "{}", + confy::get_configuration_file_path("managarr", "config")?.display() + ), }, None => { let app_nw = Arc::clone(&app);