diff options
author | Robin Jarry <robin@jarry.cc> | 2023-10-30 21:05:56 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-11-02 11:59:39 +0100 |
commit | 2dfeb7130a8fb97d927a55efa738f110f46cb688 (patch) | |
tree | cca6a06999d2be32f01e4ac6ae2998c5f24c2895 /commands/compose | |
parent | faa879f9a84d44f9b251410fc923a827a44df1a7 (diff) | |
download | aerc-2dfeb7130a8fb97d927a55efa738f110f46cb688.tar.gz |
completion: refactor filter list api
Remove CompletionFromList which is a trivial wrapper around FilterList.
Remove the prefix, suffix and isFuzzy arguments from FilterList.
Replace prefix, suffix by an optional callback to allow post processing
of completion results before presenting them to the user.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Inwit <inwit@sindominio.net>
Diffstat (limited to 'commands/compose')
-rw-r--r-- | commands/compose/detach.go | 2 | ||||
-rw-r--r-- | commands/compose/header.go | 2 | ||||
-rw-r--r-- | commands/compose/multipart.go | 2 | ||||
-rw-r--r-- | commands/compose/send.go | 2 | ||||
-rw-r--r-- | commands/compose/switch.go | 2 |
5 files changed, 5 insertions, 5 deletions
diff --git a/commands/compose/detach.go b/commands/compose/detach.go index 91cf2a58..0ac3334e 100644 --- a/commands/compose/detach.go +++ b/commands/compose/detach.go @@ -21,7 +21,7 @@ func (Detach) Aliases() []string { func (*Detach) CompletePath(arg string) []string { composer, _ := app.SelectedTabContent().(*app.Composer) - return commands.CompletionFromList(composer.GetAttachments(), arg) + return commands.FilterList(composer.GetAttachments(), arg, nil) } func (d Detach) Execute(args []string) error { diff --git a/commands/compose/header.go b/commands/compose/header.go index afc27e92..3283d4e3 100644 --- a/commands/compose/header.go +++ b/commands/compose/header.go @@ -38,7 +38,7 @@ func (Header) Options() string { } func (*Header) CompleteHeaders(arg string) []string { - return commands.CompletionFromList(headers, arg) + return commands.FilterList(headers, arg, commands.QuoteSpace) } func (h Header) Execute(args []string) error { diff --git a/commands/compose/multipart.go b/commands/compose/multipart.go index 5b701342..a004ea2b 100644 --- a/commands/compose/multipart.go +++ b/commands/compose/multipart.go @@ -27,7 +27,7 @@ func (*Multipart) CompleteMime(arg string) []string { for mime := range config.Converters { completions = append(completions, mime) } - return commands.CompletionFromList(completions, arg) + return commands.FilterList(completions, arg, nil) } func (m Multipart) Execute(args []string) error { diff --git a/commands/compose/send.go b/commands/compose/send.go index 91fd42bd..315b6915 100644 --- a/commands/compose/send.go +++ b/commands/compose/send.go @@ -41,7 +41,7 @@ func (Send) Aliases() []string { } func (*Send) CompleteArchive(arg string) []string { - return commands.CompletionFromList(msg.ARCHIVE_TYPES, arg) + return commands.FilterList(msg.ARCHIVE_TYPES, arg, nil) } func (*Send) CompleteFolders(arg string) []string { diff --git a/commands/compose/switch.go b/commands/compose/switch.go index 637099b5..c71716e0 100644 --- a/commands/compose/switch.go +++ b/commands/compose/switch.go @@ -26,7 +26,7 @@ func (SwitchAccount) Aliases() []string { } func (*SwitchAccount) CompleteAccount(arg string) []string { - return commands.CompletionFromList(app.AccountNames(), arg) + return commands.FilterList(app.AccountNames(), arg, nil) } func (s SwitchAccount) Execute(args []string) error { |