Add call to create notification.
This commit is contained in:
11
src/main.rs
11
src/main.rs
@@ -5,6 +5,7 @@ mod githubctl;
|
||||
mod json_util;
|
||||
|
||||
use githubctl::PullRequestEvent;
|
||||
use notify_rust::{Hint, Notification};
|
||||
use serde_json;
|
||||
|
||||
const USERNAME: &'static str = include_str!("../.username");
|
||||
@@ -29,6 +30,16 @@ fn handle_event(event: serde_json::Value) -> Result<(), Box<dyn std::error::Erro
|
||||
let event = PullRequestEvent::new(&event)?;
|
||||
if event.action == "opened" {
|
||||
println!("PullRequestEvent action {}", event.action);
|
||||
let notification_body = format!("Pull Request opened: {}", event.title);
|
||||
Notification::new()
|
||||
.summary("Pull request opened.")
|
||||
.body(notification_body.as_str())
|
||||
// .icon("can be a full path to an image file")
|
||||
.appname("github_watcher")
|
||||
.hint(Hint::Category("im.received".to_owned()))
|
||||
.hint(Hint::Resident(true))
|
||||
.timeout(0)
|
||||
.show()?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user