diff options
| author | Paul Buetow <paul@buetow.org> | 2025-06-25 23:35:34 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-06-25 23:35:34 +0300 |
| commit | c53a8c94d012db78ceab7d70698e3ae98f4d2968 (patch) | |
| tree | f456c173d3f4b9277988c4a88c8dbd7e43528478 /internal/timer | |
| parent | c80437bf0edab6a11291f054bc7bad8873ce8885 (diff) | |
feat: Add fish shell integration
Diffstat (limited to 'internal/timer')
| -rw-r--r-- | internal/timer/operations.go | 25 |
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 +} |
