summary refs log tree commit diff stats
path: root/cmd/cetus/apod.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/cetus/apod.go')
-rw-r--r--cmd/cetus/apod.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/cmd/cetus/apod.go b/cmd/cetus/apod.go
index b99d899..cb5abae 100644
--- a/cmd/cetus/apod.go
+++ b/cmd/cetus/apod.go
@@ -7,6 +7,7 @@ import (
 
 	"framagit.org/andinus/cetus/pkg/apod"
 	"framagit.org/andinus/cetus/pkg/background"
+	"framagit.org/andinus/indus/notification"
 )
 
 func execAPOD() {
@@ -77,6 +78,18 @@ func execAPOD() {
 		apod.Print(res)
 	}
 
+	// Send a desktop notification if notify flag was passed
+	if *apodNotify {
+		n := notification.Notif{}
+		n.Title = res.Title
+		n.Message = fmt.Sprintf("%s\n\n%s",
+			res.Date,
+			res.Explanation)
+
+		err = n.Notify()
+		chkErr(err)
+	}
+
 	// Proceed only if the command was set because if it was fetch
 	// then it's already finished & should exit now.
 	if os.Args[1] == "fetch" {