add custom message to timer

master
Bel LaPointe 2018-06-15 11:09:06 -06:00
parent 180013f709
commit 1a8fff92ae
1 changed files with 3 additions and 1 deletions

View File

@ -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)
}