@@ -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.