Let's actually parse the flags

This commit is contained in:
IamTheFij 2018-05-10 18:08:10 -07:00
parent ee545423c8
commit 8035fbbf17

View File

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