diff options
Diffstat (limited to 'internal/commands/tui.go')
-rw-r--r-- | internal/commands/tui.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/internal/commands/tui.go b/internal/commands/tui.go new file mode 100644 index 0000000..529e937 --- /dev/null +++ b/internal/commands/tui.go @@ -0,0 +1,29 @@ +package commands + +import ( + "fmt" + + punchctx "punchcard/internal/context" + "punchcard/internal/tui" + + "github.com/spf13/cobra" +) + +func NewTUICmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "tui", + Short: "Start the terminal user interface", + Long: `Start an interactive terminal user interface for time tracking with real-time updates.`, + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + q := punchctx.GetDB(cmd.Context()) + if q == nil { + return fmt.Errorf("database not available in context") + } + + return tui.Run(cmd.Context(), q) + }, + } + + return cmd +} |