Browse Source

Let's actually parse the flags

master
IamTheFij 4 years ago
parent
commit
8035fbbf17
  1. 11
      main.go

11
main.go

@ -67,7 +67,9 @@ func logTextStatus(logFile *os.File, timerConfig TimerConfig, status string, don
Done: done,
})
if err == nil {
logFile.WriteString(jstring + "\n")
if logFile != nil {
logFile.WriteString(jstring + "\n")
}
fmt.Printf("%s / %s\n", status, timerConfig.Duration.String())
}
@ -90,8 +92,11 @@ func main() {
flag.DurationVar(&duration, "duration", 25*time.Minute, "Gomodoro duration")
var interval time.Duration
flag.DurationVar(&interval, "interval", 1*time.Second, "Gomodoro tick interval")
var status bool
flag.BoolVar(&status, "status", false, "Only display current Gomodoro status")
/* Haven't found a good way to tail a file in golang yet
* var status bool
* flag.BoolVar(&status, "status", false, "Only display current Gomodoro status")
*/
flag.Parse()
// Ensure obtain lock
lock, err := tryLock()

Loading…
Cancel
Save