diff options
| author | Paul Buetow <paul@buetow.org> | 2025-09-28 23:56:05 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-09-28 23:56:05 +0300 |
| commit | ad21f1b972063d2543f402c04a20f32b263e60e1 (patch) | |
| tree | 6b983ad85c84c5dcc5eb6d70d46c7f8363f9b78e /cmd | |
| parent | 6c10d06cb7a0bbdb7e94243e27df676e8998f9a0 (diff) | |
fix output
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/timr/main.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/cmd/timr/main.go b/cmd/timr/main.go index 4bd6025..d5b3004 100644 --- a/cmd/timr/main.go +++ b/cmd/timr/main.go @@ -6,9 +6,9 @@ import ( "strconv" "strings" - "github.com/charmbracelet/bubbletea" "codeberg.org/snonux/timr/internal/live" "codeberg.org/snonux/timr/internal/timer" + tea "github.com/charmbracelet/bubbletea" ) func main() { @@ -31,7 +31,15 @@ func runCommand(args []string) (string, error) { switch args[1] { case "start": - output, err = timer.StartTimer() + rawStatus, err := timer.GetRawStatus() + if err != nil { + return "", err + } + status, err := strconv.ParseFloat(rawStatus, 64) + if err != nil { + return "", err + } + output, err = timer.StartTimer(status > 0) case "continue": rawStatus, err := timer.GetRawStatus() if err != nil { @@ -42,7 +50,7 @@ func runCommand(args []string) (string, error) { return "", err } if status > 0 { - output, err = timer.StartTimer() + output, err = timer.StartTimer(true) } else { output = "Timer is at 0, cannot continue." } |
