summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-06-29 14:18:11 +0300
committerPaul Buetow <paul@buetow.org>2025-06-29 14:18:11 +0300
commita48203fef202b00509fb5499d8296ed20b2c618e (patch)
treede52727b6e0753daaf5c63501bf459753255ca64 /cmd
parentd69bb333489b15449e2e501d184d0b935afd7143 (diff)
feat: Add track command to log time to task manager
Add new 'track' command that: - Stops the current timer - Executes 'task add +track "Xmin DESCRIPTION"' - Resets the timer on successful task creation - Preserves timer state if task creation fails This allows seamless integration with taskwarrior for time tracking. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/timr/main.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/cmd/timr/main.go b/cmd/timr/main.go
index 442e48c..c52dae9 100644
--- a/cmd/timr/main.go
+++ b/cmd/timr/main.go
@@ -3,6 +3,7 @@ package main
import (
"fmt"
"os"
+ "strings"
"github.com/charmbracelet/bubbletea"
"timr/internal/live"
@@ -41,6 +42,15 @@ func main() {
output, err = timer.ResetTimer()
case "prompt":
output, err = timer.GetPromptStatus()
+ case "track":
+ if len(os.Args) < 3 {
+ fmt.Println("Error: track command requires a description")
+ printUsage()
+ os.Exit(1)
+ }
+ // Join all arguments after "track" as the description
+ description := strings.Join(os.Args[2:], " ")
+ output, err = timer.TrackTime(description)
case "live":
p := tea.NewProgram(live.NewModel())
if err := p.Start(); err != nil {
@@ -61,5 +71,5 @@ func main() {
}
func printUsage() {
- fmt.Println("Usage: timr <start|stop|pause|status|reset|live|prompt>")
+ fmt.Println("Usage: timr <start|stop|pause|status|reset|live|prompt|track <description>>")
}