Skip to content

Commit

Permalink
Update notify-rust to 4.7 (#114)
Browse files Browse the repository at this point in the history
This included the `FromStr` for `Timeout` implementation
(hoodie/notify-rust#169) so we can get rid of
our custom implementation.
  • Loading branch information
rnestler committed Jan 14, 2023
1 parent 6105f29 commit 763a302
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
6 changes: 2 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -23,7 +23,7 @@ edition = "2018"
[dependencies]
alpm = "2.1.0"
clap = { version = "4.1.1", features = ["help", "usage", "error-context", "std", "derive"], default-features = false }
notify-rust = "4.5"
notify-rust = "4.7"
utmp-rs = "0.3.0"
time = "0.3.14"
log = "0.4.17"
Expand Down
12 changes: 1 addition & 11 deletions src/main.rs
@@ -1,5 +1,3 @@
use std::{num::ParseIntError, str::FromStr};

use clap::Parser;
use log::error;
use notify_rust::{Notification, Timeout};
Expand All @@ -15,14 +13,6 @@ mod critical_packages_check;
use critical_packages_check::CriticalPackagesCheck;
mod session;

fn timeout_from_str(s: &str) -> Result<Timeout, ParseIntError> {
match s {
"default" => Ok(Timeout::Default),
"never" => Ok(Timeout::Never),
milliseconds => Ok(Timeout::Milliseconds(u32::from_str(milliseconds)?)),
}
}

#[derive(Debug, Parser)]
#[clap(
version,
Expand All @@ -40,7 +30,7 @@ struct Args {
/// * "never" or "0" will cause the notification never to expire.
///
/// * Any other number will be interpreted as the timeout in milliseconds.
#[clap(long, value_parser(timeout_from_str), default_value = "default")]
#[clap(long, default_value = "default")]
notification_timeout: Timeout,

/// Comma separated list of packages were we should reboot after an upgrade.
Expand Down

0 comments on commit 763a302

Please sign in to comment.