summaryrefslogtreecommitdiff
path: root/internal/timer/operations.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/timer/operations.go')
-rw-r--r--internal/timer/operations.go25
1 files changed, 24 insertions, 1 deletions
diff --git a/internal/timer/operations.go b/internal/timer/operations.go
index 3035b58..71cf684 100644
--- a/internal/timer/operations.go
+++ b/internal/timer/operations.go
@@ -72,4 +72,27 @@ func ResetTimer() (string, error) {
return "", fmt.Errorf("error saving state: %w", err)
}
return "Timer reset.", nil
-} \ No newline at end of file
+}
+
+func GetPromptStatus() (string, error) {
+ state, err := LoadState()
+ if err != nil {
+ return "", fmt.Errorf("error loading state: %w", err)
+ }
+
+ elapsed := state.ElapsedTime
+ if state.Running {
+ elapsed += time.Since(state.StartTime)
+ }
+
+ if elapsed == 0 {
+ return "", nil
+ }
+
+ icon := "⏸"
+ if state.Running {
+ icon = "▶"
+ }
+
+ return fmt.Sprintf("%s %s", icon, elapsed.Round(time.Second)), nil
+}