From 22ab77de6d2f48c5fc497282c909386f8d6ce0a8 Mon Sep 17 00:00:00 2001 From: Gideon <87426140+GideonBear@users.noreply.github.com> Date: Sat, 8 Nov 2025 10:58:36 +0100 Subject: [PATCH] feat: add show_distribution_summary config option (#1259) --- config.example.toml | 5 +++++ src/config.rs | 10 ++++++++++ src/main.rs | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/config.example.toml b/config.example.toml index c4ac70be..a952276c 100644 --- a/config.example.toml +++ b/config.example.toml @@ -91,6 +91,11 @@ # See: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#directives # log_filters = ["topgrade::command=debug", "warn"] +# Whether to show a distribution-specific summary if applicable, e.g. listing +# Pacman backup configuration files (*.pacsave and *.pacnew) +# (default: true) +# show_distribution_summary = false + # Commands to run before anything [pre_commands] diff --git a/src/config.rs b/src/config.rs index 18de4369..8c79d11c 100644 --- a/src/config.rs +++ b/src/config.rs @@ -347,6 +347,8 @@ pub struct Misc { no_self_update: Option, log_filters: Option>, + + show_distribution_summary: Option, } #[derive(Clone, Copy, Debug, Deserialize, ValueEnum)] @@ -1593,6 +1595,14 @@ impl Config { .unwrap_or(false) } + pub fn show_distribution_summary(&self) -> bool { + self.config_file + .misc + .as_ref() + .and_then(|misc| misc.show_distribution_summary) + .unwrap_or(true) + } + #[cfg(target_os = "linux")] pub fn npm_use_sudo(&self) -> bool { self.config_file diff --git a/src/main.rs b/src/main.rs index 81d4ceed..1c78f16d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -276,7 +276,7 @@ fn run() -> Result<()> { } #[cfg(target_os = "linux")] - { + if config.show_distribution_summary() { if let Ok(distribution) = &distribution { distribution.show_summary(); }