diff options
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/timr/main.go | 12 |
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>>") } |
