From 1a8fff92ae46f4e557d389782ac33673aadcf238 Mon Sep 17 00:00:00 2001 From: Bel LaPointe Date: Fri, 15 Jun 2018 11:09:06 -0600 Subject: [PATCH] add custom message to timer --- main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index f2ceca1..b899a9f 100644 --- a/main.go +++ b/main.go @@ -12,6 +12,7 @@ import ( ) var notified = false +var alertMessage string var originalStart = time.Now() @@ -28,6 +29,7 @@ func main() { flag.BoolVar(&invert, "stopwatch", false, "Use as a stopwatch") flag.StringVar(&duration, "duration", "30m", "How long the timer should be") flag.StringVar(&offset, "offset", "0m", "How much time the initial time should skip") + flag.StringVar(&alertMessage, "msg", "Timer up", "Message to display on timer expiration") flag.StringVar(&interval, "interval", "500ms", "Interval duration") flag.BoolVar(&eta, "eta", false, "Whether to display the ending time") flag.Parse() @@ -179,7 +181,7 @@ func printTime(pRemains *time.Duration, target time.Duration, delim *rune, rever func alertTime(pRemains *time.Duration, target time.Duration, reverse, repeat bool) { if !notified { notified = true - _, err := mack.Alert(fmt.Sprintf("Timer for %s done", target.String())) + _, err := mack.Alert(fmt.Sprintf("%s\nTimer for %s done", alertMessage, target.String())) if err != nil { panic(err) }