on main help sign in
feat(ui): use the new UI behind a feature flag
742b4d3Ayman Bagabas
internal/cmd/root.go+13−4
@@ -88,11 +88,20 @@ crush -y
88
88
89 // Set up the TUI.
89 // Set up the TUI.
90 var env uv.Environ = os.Environ()
90 var env uv.Environ = os.Environ()
91+
92+ var model tea.Model
93+ if _, ok := env.LookupEnv("CRUSH_NEW_UI"); ok {
91− com := common.DefaultCommon(app)
94+ com := common.DefaultCommon(app)
92− ui := ui.New(com)
95+ ui := ui.New(com)
96+ ui.QueryVersion = shouldQueryTerminalVersion(env)
97+ model = ui
98+ } else {
99+ ui := tui.New(app)
93− ui.QueryVersion = shouldQueryTerminalVersion(env)
100+ ui.QueryVersion = shouldQueryTerminalVersion(env)
101+ model = ui
102+ }
94 program := tea.NewProgram(
103 program := tea.NewProgram(
95− ui,
104+ model,
96 tea.WithEnvironment(env),
105 tea.WithEnvironment(env),
97 tea.WithContext(cmd.Context()),
106 tea.WithContext(cmd.Context()),
98 tea.WithFilter(tui.MouseEventFilter)) // Filter mouse events based on focus state
107 tea.WithFilter(tui.MouseEventFilter)) // Filter mouse events based on focus state