Let's actually parse the flags

This commit is contained in:
IamTheFij 2018-05-10 18:08:10 -07:00
parent ee545423c8
commit 8035fbbf17
1 changed files with 8 additions and 3 deletions

11
main.go
View File

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