summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorfxqnlr <[email protected]>2024-09-25 15:22:14 +0200
committerfxqnlr <[email protected]>2024-09-25 15:22:14 +0200
commit5f23d5506698081722eef6e34f11c7fb24e0b212 (patch)
treee106511c745f47ee71fd8f0eed284cdddf57241b /src/main.rs
parent91730bcecda6f2e7ef5e10983d6b0ce0b38196ab (diff)
downloadarbs-5f23d5506698081722eef6e34f11c7fb24e0b212.tar
arbs-5f23d5506698081722eef6e34f11c7fb24e0b212.tar.gz
arbs-5f23d5506698081722eef6e34f11c7fb24e0b212.zip
fix no notifications
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index ab23ab7..dad98c6 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -3,7 +3,6 @@ use clap::Parser;
3use cli::Subcommands; 3use cli::Subcommands;
4use config::Config; 4use config::Config;
5use error::{Error, Result}; 5use error::{Error, Result};
6use notify_rust::Urgency;
7use tracing::{debug, error, level_filters::LevelFilter}; 6use tracing::{debug, error, level_filters::LevelFilter};
8use tracing_subscriber::{fmt, layer::SubscriberExt, util::SubscriberInitExt, EnvFilter}; 7use tracing_subscriber::{fmt, layer::SubscriberExt, util::SubscriberInitExt, EnvFilter};
9 8
@@ -72,6 +71,21 @@ fn run_cli() -> Result<()> {
72 Ok(()) 71 Ok(())
73} 72}
74 73
74enum Urgency {
75 Normal,
76 Critical
77}
78
79#[cfg(feature = "notifications")]
80impl From<Urgency> for notify_rust::Urgency {
81 fn from(value: Urgency) -> Self {
82 match value {
83 Urgency::Normal => Self::Normal,
84 Urgency::Critical => Self::Critical,
85 }
86 }
87}
88
75fn send_notification(summary: &str, body: &str, urgency: Urgency) -> Result<()> { 89fn send_notification(summary: &str, body: &str, urgency: Urgency) -> Result<()> {
76 #[cfg(feature = "notifications")] 90 #[cfg(feature = "notifications")]
77 { 91 {
@@ -86,7 +100,7 @@ fn send_notification(summary: &str, body: &str, urgency: Urgency) -> Result<()>
86 .body(body) 100 .body(body)
87 .icon(&icon.to_string_lossy()) 101 .icon(&icon.to_string_lossy())
88 .timeout(0) 102 .timeout(0)
89 .urgency(urgency) 103 .urgency(urgency.into())
90 .show()?; 104 .show()?;
91 } 105 }
92 Ok(()) 106 Ok(())