summaryrefslogtreecommitdiff
path: root/commands/account/sort.go
diff options
context:
space:
mode:
authorkt programs <ktprograms@gmail.com>2022-03-15 09:55:51 +0800
committerRobin Jarry <robin@jarry.cc>2022-03-16 17:02:36 +0100
commita0fceb80b3ac036326a3af20eb2a05bbe215be64 (patch)
tree1b05d9d11ba276bdb7519f6fce71d4a9dd354704 /commands/account/sort.go
parenta16bd053211440f95e2badfd280c3e58ef107c70 (diff)
downloadaerc-a0fceb80b3ac036326a3af20eb2a05bbe215be64.zip
commands: use SelectedAccountUiConfig instead of explicit nil check
Remove code duplication and provide completion even when acct is nil Signed-off-by: kt programs <ktprograms@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'commands/account/sort.go')
-rw-r--r--commands/account/sort.go7
1 files changed, 1 insertions, 6 deletions
diff --git a/commands/account/sort.go b/commands/account/sort.go
index 15ecbc0..ad1a402 100644
--- a/commands/account/sort.go
+++ b/commands/account/sort.go
@@ -20,11 +20,6 @@ func (Sort) Aliases() []string {
}
func (Sort) Complete(aerc *widgets.Aerc, args []string) []string {
- acct := aerc.SelectedAccount()
- if acct == nil {
- return make([]string, 0)
- }
-
supportedCriteria := []string{
"arrival",
"cc",
@@ -61,7 +56,7 @@ func (Sort) Complete(aerc *widgets.Aerc, args []string) []string {
}
// the last item is not complete
completions = commands.FilterList(supportedCriteria, last, currentPrefix,
- acct.UiConfig().FuzzyComplete)
+ aerc.SelectedAccountUiConfig().FuzzyComplete)
return completions
}