on main help sign in
refactor(tui): unify commandType definition
commit31e155c2ce1a7a906c244d381daf15dd5481c5e7 authorAyman Bagabas <ayman.bagabas@gmail.com> dateMon 15 Dec 2025, 17:23 (1 year ago) parent7918c90
2 files changed+14−6
internal/tui/components/dialogs/commands/commands.go+4−6 internal/uicmd/uicmd.go+10
internal/tui/components/dialogs/commands/commands.go+4−6
@@ -32,14 +32,12 @@ const (
3232 defaultWidth int = 70
3333)
3434
35−type commandType uint
36−
37−func (c commandType) String() string { return []string{"System", "User", "MCP"}[c] }
35+type commandType = uicmd.CommandType
3836
3937const (
40− SystemCommands commandType = iota
41− UserCommands
42− MCPPrompts
38+ SystemCommands = uicmd.SystemCommands
39+ UserCommands = uicmd.UserCommands
40+ MCPPrompts = uicmd.MCPPrompts
4341)
4442
4543type listModel = list.FilterableList[list.CompletionItem[Command]]
internal/uicmd/uicmd.go+10
@@ -21,6 +21,16 @@ import (
2121 "github.com/charmbracelet/crush/internal/tui/util"
2222)
2323
24+type CommandType uint
25+
26+func (c CommandType) String() string { return []string{"System", "User", "MCP"}[c] }
27+
28+const (
29+ SystemCommands CommandType = iota
30+ UserCommands
31+ MCPPrompts
32+)
33+
2434// Command represents a command that can be executed
2535type Command struct {
2636 ID string