aboutsummaryrefslogtreecommitdiffstats
path: root/notifier/notifier.go
diff options
context:
space:
mode:
Diffstat (limited to 'notifier/notifier.go')
-rw-r--r--notifier/notifier.go27
1 files changed, 9 insertions, 18 deletions
diff --git a/notifier/notifier.go b/notifier/notifier.go
index 6779892..bc8f517 100644
--- a/notifier/notifier.go
+++ b/notifier/notifier.go
@@ -13,19 +13,18 @@ import (
pkg "github.com/keybase/go-notifier"
)
-var (
- title = kingpin.Flag("title", "Title").String()
- message = kingpin.Flag("message", "Message").String()
- imagePath = kingpin.Flag("image-path", "Image path").String()
- bundleID = kingpin.Flag("bundle-id", "Bundle identifier (for OS X)").String()
- toastPath = kingpin.Flag("toast-path", "Path to toast.exe (for Windows)").String()
-)
-
func main() {
- kingpin.Version("0.1.1")
+ notification := pkg.Notification{}
+ kingpin.Flag("title", "Title").StringVar(&notification.Title)
+ kingpin.Flag("message", "Message").StringVar(&notification.Message)
+ kingpin.Flag("image-path", "Image path").StringVar(&notification.ImagePath)
+ kingpin.Flag("action", "Actions (for OS X)").StringsVar(&notification.Actions)
+ kingpin.Flag("bundle-id", "Bundle identifier (for OS X)").StringVar(&notification.BundleID)
+ kingpin.Flag("toast-path", "Path to toast.exe (for Windows)").StringVar(&notification.ToastPath)
+ kingpin.Version("0.1.2")
kingpin.Parse()
- if runtime.GOOS == "windows" && *toastPath == "" {
+ if runtime.GOOS == "windows" && notification.ToastPath == "" {
log.Fatal(fmt.Errorf("Need to specify --toast-path for Windows"))
}
@@ -34,14 +33,6 @@ func main() {
log.Fatal(err)
}
- notification := pkg.Notification{
- Title: *title,
- Message: *message,
- ImagePath: *imagePath,
- BundleID: *bundleID,
- ToastPath: *toastPath,
- }
-
if err := notifier.DeliverNotification(notification); err != nil {
log.Fatal(err)
}