diff options
-rw-r--r-- | src/actions.rs | 2 | ||||
-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 |
8 files changed, 28 insertions, 0 deletions
diff --git a/src/actions.rs b/src/actions.rs index d006207..b002df8 100644 --- a/src/actions.rs +++ b/src/actions.rs @@ -61,6 +61,8 @@ impl fmt::Display for AnyActionConfig { #[async_trait] pub trait Action<'a> { + fn name(&self) -> &'static str; + async fn run(&self, params: Option<&MessageParams<'_, '_>>) -> Result<()>; } 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", |