From a48203fef202b00509fb5499d8296ed20b2c618e Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 29 Jun 2025 14:18:11 +0300 Subject: feat: Add track command to log time to task manager MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- cmd/timr/main.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'cmd') 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 ") + fmt.Println("Usage: timr >") } -- cgit v1.2.3