diff options
author | sommerfeld <sommerfeld@sommerfeld.dev> | 2024-04-23 15:55:28 +0100 |
---|---|---|
committer | sommerfeld <sommerfeld@sommerfeld.dev> | 2024-04-23 16:08:56 +0100 |
commit | 6c8f59502f3bb0279eae1091f19a7c0bb458a2c7 (patch) | |
tree | 22478ffe3ae68efe1d329c8ea2491d328a8e5d01 /src/actions | |
parent | 3c749a1add53a7eedeed5a95dfe68092bce29c42 (diff) | |
download | sentrum-6c8f59502f3bb0279eae1091f19a7c0bb458a2c7.tar.gz sentrum-6c8f59502f3bb0279eae1091f19a7c0bb458a2c7.tar.bz2 sentrum-6c8f59502f3bb0279eae1091f19a7c0bb458a2c7.zip |
Add name() to Action trait
Diffstat (limited to 'src/actions')
-rw-r--r-- | src/actions/command.rs | 4 | ||||
-rw-r--r-- | src/actions/desktop_notification.rs | 4 | ||||
-rw-r--r-- | src/actions/email.rs | 4 | ||||
-rw-r--r-- | src/actions/nostr.rs | 4 | ||||
-rw-r--r-- | src/actions/ntfy.rs | 4 | ||||
-rw-r--r-- | src/actions/telegram.rs | 4 | ||||
-rw-r--r-- | src/actions/terminal_print.rs | 2 |
7 files changed, 26 insertions, 0 deletions
diff --git a/src/actions/command.rs b/src/actions/command.rs index 28d951a..a07e825 100644 --- a/src/actions/command.rs +++ b/src/actions/command.rs @@ -36,6 +36,10 @@ impl<'a> CommandAction<'a> { #[async_trait] impl Action<'_> for CommandAction<'_> { + fn name(&self) -> &'static str { + "command" + } + async fn run(&self, params: Option<&MessageParams<'_, '_>>) -> Result<()> { let mut cmd = Command::new(&self.cmd_config.cmd); for arg in self.cmd_config.args.iter() { diff --git a/src/actions/desktop_notification.rs b/src/actions/desktop_notification.rs index d831a59..6ea89f7 100644 --- a/src/actions/desktop_notification.rs +++ b/src/actions/desktop_notification.rs @@ -17,6 +17,10 @@ impl<'a> DesktopNotificationAction<'a> { #[async_trait] impl Action<'_> for DesktopNotificationAction<'_> { + fn name(&self) -> &'static str { + "desktop_notification" + } + async fn run(&self, params: Option<&MessageParams<'_, '_>>) -> Result<()> { use notify_rust::Notification; Notification::new() diff --git a/src/actions/email.rs b/src/actions/email.rs index 272f650..a8627c5 100644 --- a/src/actions/email.rs +++ b/src/actions/email.rs @@ -104,6 +104,10 @@ impl<'a> EmailAction<'a> { #[async_trait] impl Action<'_> for EmailAction<'_> { + fn name(&self) -> &'static str { + "email" + } + async fn run(&self, params: Option<&MessageParams<'_, '_>>) -> Result<()> { let body = self.message_config.body(params)?; let html_body = match self.message_config.format() { diff --git a/src/actions/nostr.rs b/src/actions/nostr.rs index aebccba..3507d2e 100644 --- a/src/actions/nostr.rs +++ b/src/actions/nostr.rs @@ -173,6 +173,10 @@ impl<'a> NostrAction<'a> { #[async_trait] impl Action<'_> for NostrAction<'_> { + fn name(&self) -> &'static str { + "nostr" + } + async fn run(&self, params: Option<&MessageParams<'_, '_>>) -> Result<()> { let subject = self.message_config.subject(params)?; let body = self.message_config.body(params)?; diff --git a/src/actions/ntfy.rs b/src/actions/ntfy.rs index 7d83b87..badee70 100644 --- a/src/actions/ntfy.rs +++ b/src/actions/ntfy.rs @@ -106,6 +106,10 @@ impl<'a> NtfyAction<'a> { #[async_trait] impl Action<'_> for NtfyAction<'_> { + fn name(&self) -> &'static str { + "ntfy" + } + async fn run(&self, params: Option<&MessageParams<'_, '_>>) -> Result<()> { let payload = self .payload_template diff --git a/src/actions/telegram.rs b/src/actions/telegram.rs index b489864..3e1809d 100644 --- a/src/actions/telegram.rs +++ b/src/actions/telegram.rs @@ -45,6 +45,10 @@ impl<'a> TelegramAction<'a> { #[async_trait] impl Action<'_> for TelegramAction<'_> { + fn name(&self) -> &'static str { + "telegram" + } + async fn run(&self, params: Option<&MessageParams<'_, '_>>) -> Result<()> { let subject = self.message_config.subject(params)?; let body = self.message_config.body(params)?; diff --git a/src/actions/terminal_print.rs b/src/actions/terminal_print.rs index 02536c7..e0c8599 100644 --- a/src/actions/terminal_print.rs +++ b/src/actions/terminal_print.rs @@ -17,6 +17,8 @@ impl<'a> TerminalPrintAction<'a> { #[async_trait] impl Action<'_> for TerminalPrintAction<'_> { + fn name(&self) -> &'static str { "terminal_print" } + async fn run(&self, params: Option<&MessageParams<'_, '_>>) -> Result<()> { println!( "{}\n{}\n", |