Let's actually parse the flags
This commit is contained in:
parent
ee545423c8
commit
8035fbbf17
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…
Reference in New Issue
Block a user