feat: add show_distribution_summary config option (#1259)
This commit is contained in:
@@ -91,6 +91,11 @@
|
|||||||
# See: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#directives
|
# See: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#directives
|
||||||
# log_filters = ["topgrade::command=debug", "warn"]
|
# 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
|
# Commands to run before anything
|
||||||
[pre_commands]
|
[pre_commands]
|
||||||
|
|||||||
@@ -347,6 +347,8 @@ pub struct Misc {
|
|||||||
no_self_update: Option<bool>,
|
no_self_update: Option<bool>,
|
||||||
|
|
||||||
log_filters: Option<Vec<String>>,
|
log_filters: Option<Vec<String>>,
|
||||||
|
|
||||||
|
show_distribution_summary: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, ValueEnum)]
|
#[derive(Clone, Copy, Debug, Deserialize, ValueEnum)]
|
||||||
@@ -1593,6 +1595,14 @@ impl Config {
|
|||||||
.unwrap_or(false)
|
.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")]
|
#[cfg(target_os = "linux")]
|
||||||
pub fn npm_use_sudo(&self) -> bool {
|
pub fn npm_use_sudo(&self) -> bool {
|
||||||
self.config_file
|
self.config_file
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ fn run() -> Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
{
|
if config.show_distribution_summary() {
|
||||||
if let Ok(distribution) = &distribution {
|
if let Ok(distribution) = &distribution {
|
||||||
distribution.show_summary();
|
distribution.show_summary();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user