diff options
Diffstat (limited to 'internal/timer/operations.go')
| -rw-r--r-- | internal/timer/operations.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/internal/timer/operations.go b/internal/timer/operations.go index 97be22d..52e5d3e 100644 --- a/internal/timer/operations.go +++ b/internal/timer/operations.go @@ -7,7 +7,7 @@ import ( "time" ) -func StartTimer() (string, error) { +func StartTimer(continued bool) (string, error) { state, err := LoadState() if err != nil { return "", fmt.Errorf("error loading state: %w", err) @@ -22,6 +22,11 @@ func StartTimer() (string, error) { if err := state.Save(); err != nil { return "", fmt.Errorf("error saving state: %w", err) } + + if continued { + return "Timer continued.", nil + } + return "Timer started.", nil } @@ -141,7 +146,7 @@ func TrackTime(description string) (string, error) { // Convert to minutes minutes := int(elapsed.Minutes()) - + // If timer was running, stop it if state.Running { state.Running = false @@ -154,7 +159,7 @@ func TrackTime(description string) (string, error) { // Build and execute the task command taskDescription := fmt.Sprintf("%dmin %s", minutes, description) cmd := exec.Command("task", "add", "+track", taskDescription) - + // Execute the command and capture output output, err := cmd.CombinedOutput() if err != nil { |
