summaryrefslogtreecommitdiff
path: root/internal/cli/tui.go
blob: 474ffc274b694b06e8ae268776343b2a73fbfef0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package cli

import (
	tuiapp "codeberg.org/snonux/timesamurai/internal/tui"
	tea "github.com/charmbracelet/bubbletea"
	"github.com/spf13/cobra"
)

func newTUICmd() *cobra.Command {
	var disco bool

	cmd := &cobra.Command{
		Use:   "tui",
		Short: "Launch full-screen TUI",
		RunE: func(cmd *cobra.Command, args []string) error {
			model, err := tuiapp.NewModelWithConfigAndDisco(currentConfig(cmd), disco)
			if err != nil {
				return err
			}
			program := tea.NewProgram(model)
			return program.Start()
		},
	}

	cmd.Flags().BoolVar(&disco, "disco", false, "Enable disco mode (random theme changes)")
	return cmd
}