on main help sign in
fix(ui): add exit alias to the quit command
commit95e93e96ebdc86adc05ad30207ff6302c9d7ce5f authorKieran Klukas <kieran@dunkirk.sh> dateThu 7 May 2026, 19:27 (5 months ago) parent11eabdf
2 files changed+14−2
internal/ui/dialog/commands.go+1−1 internal/ui/dialog/commands_item.go+13−1
internal/ui/dialog/commands.go+1−1
@@ -524,7 +524,7 @@ func (c *Commands) defaultCommands() []*CommandItem {
524524 commands = append(commands, NewCommandItem(c.com.Styles, "toggle_transparent", transparentLabel, "", ActionToggleTransparentBackground{}))
525525
526526 commands = append(commands,
527− NewCommandItem(c.com.Styles, "quit", "Quit", "ctrl+c", tea.QuitMsg{}),
527+ NewCommandItem(c.com.Styles, "quit", "Quit", "ctrl+c", tea.QuitMsg{}).WithAliases("exit"),
528528 )
529529
530530 return commands
internal/ui/dialog/commands_item.go+13−1
@@ -1,6 +1,8 @@
11package dialog
22
33import (
4+ "strings"
5+
46 "github.com/charmbracelet/crush/internal/ui/styles"
57 "github.com/sahilm/fuzzy"
68)
@@ -11,6 +13,7 @@ type CommandItem struct {
1113 title string
1214 shortcut string
1315 action Action
16+ aliases []string
1417 t *styles.Styles
1518 m fuzzy.Match
1619 cache map[int]string
@@ -30,9 +33,18 @@ func NewCommandItem(t *styles.Styles, id, title, shortcut string, action Action)
3033 }
3134}
3235
36+// WithAliases returns the CommandItem with the given aliases for filtering.
37+func (c *CommandItem) WithAliases(aliases ...string) *CommandItem {
38+ c.aliases = aliases
39+ return c
40+}
41+
3342// Filter implements ListItem.
3443func (c *CommandItem) Filter() string {
35− return c.title
44+ if len(c.aliases) == 0 {
45+ return c.title
46+ }
47+ return c.title + " " + strings.Join(c.aliases, " ")
3648}
3749
3850// ID implements ListItem.