on main help sign in
refactor(tui): unify commandType definition
31e155cAyman Bagabas
internal/tui/components/dialogs/commands/commands.go+4−6
@@ -32,14 +32,12 @@ const (
32 defaultWidth int = 70
32 defaultWidth int = 70
33)
33)
34
34
35−type commandType uint
35+type commandType = uicmd.CommandType
36−
37−func (c commandType) String() string { return []string{"System", "User", "MCP"}[c] }
38
36
39const (
37const (
40− SystemCommands commandType = iota
38+ SystemCommands = uicmd.SystemCommands
41− UserCommands
39+ UserCommands = uicmd.UserCommands
42− MCPPrompts
40+ MCPPrompts = uicmd.MCPPrompts
43)
41)
44
42
45type listModel = list.FilterableList[list.CompletionItem[Command]]
43type listModel = list.FilterableList[list.CompletionItem[Command]]
internal/uicmd/uicmd.go+10
@@ -21,6 +21,16 @@ import (
21 "github.com/charmbracelet/crush/internal/tui/util"
21 "github.com/charmbracelet/crush/internal/tui/util"
22)
22)
23
23
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+
24// Command represents a command that can be executed
34// Command represents a command that can be executed
25type Command struct {
35type Command struct {
26 ID string
36 ID string