feat: flag and config to skip notifications by jlucktay (#5)

* feat: flag and config to skip notifications

At the end of a run, topgrade normally sends a system notification.
This change adds a command-line flag and a config-file option to
disable this behaviour.

* fix: clippy issues

Also derive Eq where PartialEq is being derived.
https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

Authored-by: James Lucktaylor <jlucktay+github@gmail.com>
Approved-by: Thomas Schönauer <t.schoenauer@hgs-wt.at>
This commit is contained in:
DottoDev
2022-10-10 20:21:20 +00:00
committed by GitHub
parent dc1c5d6490
commit 2d94eb974f
5 changed files with 30 additions and 9 deletions

View File

@@ -466,13 +466,17 @@ fn run() -> Result<()> {
}
let failed = post_command_failed || runner.report().data().iter().any(|(_, result)| result.failed());
terminal::notify_desktop(
format!(
"Topgrade finished {}",
if failed { "with errors" } else { "successfully" }
),
None,
);
if !config.skip_notify() {
terminal::notify_desktop(
format!(
"Topgrade finished {}",
if failed { "with errors" } else { "successfully" }
),
None,
);
}
if failed {
Err(StepFailed.into())
} else {