From 742b4d3543ed4977e2e9c578bac36cc6bcad509e Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Tue, 20 Jan 2026 18:36:59 -0500 Subject: [PATCH] feat(ui): use the new UI behind a feature flag If the environment variable CRUSH_NEW_UI is set, use the new UI implementation. --- internal/cmd/root.go | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/internal/cmd/root.go b/internal/cmd/root.go index 7f31db31c17fe66783f367a60009657ee8c11e50..c46aaaaf11519d31cc92a63b0d9ccc9b8313f494 100644 --- a/internal/cmd/root.go +++ b/internal/cmd/root.go @@ -88,11 +88,20 @@ crush -y // Set up the TUI. var env uv.Environ = os.Environ() - com := common.DefaultCommon(app) - ui := ui.New(com) - ui.QueryVersion = shouldQueryTerminalVersion(env) + + var model tea.Model + if _, ok := env.LookupEnv("CRUSH_NEW_UI"); ok { + com := common.DefaultCommon(app) + ui := ui.New(com) + ui.QueryVersion = shouldQueryTerminalVersion(env) + model = ui + } else { + ui := tui.New(app) + ui.QueryVersion = shouldQueryTerminalVersion(env) + model = ui + } program := tea.NewProgram( - ui, + model, tea.WithEnvironment(env), tea.WithContext(cmd.Context()), tea.WithFilter(tui.MouseEventFilter)) // Filter mouse events based on focus state