From 31e155c2ce1a7a906c244d381daf15dd5481c5e7 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Mon, 15 Dec 2025 17:23:30 -0500 Subject: [PATCH] refactor(tui): unify commandType definition --- internal/tui/components/dialogs/commands/commands.go | 10 ++++------ internal/uicmd/uicmd.go | 10 ++++++++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/internal/tui/components/dialogs/commands/commands.go b/internal/tui/components/dialogs/commands/commands.go index 4b23c1b4862dbc8484d9759443b56842886ca4d9..7769849bb9b4d6e16e6644ae658d9f0394ac2289 100644 --- a/internal/tui/components/dialogs/commands/commands.go +++ b/internal/tui/components/dialogs/commands/commands.go @@ -32,14 +32,12 @@ const ( defaultWidth int = 70 ) -type commandType uint - -func (c commandType) String() string { return []string{"System", "User", "MCP"}[c] } +type commandType = uicmd.CommandType const ( - SystemCommands commandType = iota - UserCommands - MCPPrompts + SystemCommands = uicmd.SystemCommands + UserCommands = uicmd.UserCommands + MCPPrompts = uicmd.MCPPrompts ) type listModel = list.FilterableList[list.CompletionItem[Command]] diff --git a/internal/uicmd/uicmd.go b/internal/uicmd/uicmd.go index 870116a7f47af8358e492feeec51ed6a2823061e..c571dacd1989c518347e3a773b36d6d5fd2b8878 100644 --- a/internal/uicmd/uicmd.go +++ b/internal/uicmd/uicmd.go @@ -21,6 +21,16 @@ import ( "github.com/charmbracelet/crush/internal/tui/util" ) +type CommandType uint + +func (c CommandType) String() string { return []string{"System", "User", "MCP"}[c] } + +const ( + SystemCommands CommandType = iota + UserCommands + MCPPrompts +) + // Command represents a command that can be executed type Command struct { ID string