@@ -1,6 +1,8 @@
1package dialog
1package dialog
4 "github.com/charmbracelet/crush/internal/ui/styles"
6 "github.com/charmbracelet/crush/internal/ui/styles"
5 "github.com/sahilm/fuzzy"
7 "github.com/sahilm/fuzzy"
@@ -11,6 +13,7 @@ type CommandItem struct {
11 title string
13 title string
12 shortcut string
14 shortcut string
13 action Action
15 action Action
14 t *styles.Styles
17 t *styles.Styles
15 m fuzzy.Match
18 m fuzzy.Match
16 cache map[int]string
19 cache map[int]string
@@ -30,9 +33,18 @@ func NewCommandItem(t *styles.Styles, id, title, shortcut string, action Action)
36+// WithAliases returns the CommandItem with the given aliases for filtering.
37+func (c *CommandItem) WithAliases(aliases ...string) *CommandItem {
33// Filter implements ListItem.
42// Filter implements ListItem.
34func (c *CommandItem) Filter() string {
43func (c *CommandItem) Filter() string {
44+ if len(c.aliases) == 0 {
35− return c.title
47+ return c.title + " " + strings.Join(c.aliases, " ")
38// ID implements ListItem.
50// ID implements ListItem.