diff options
author | kt programs <ktprograms@gmail.com> | 2022-03-15 09:55:51 +0800 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-03-16 17:02:36 +0100 |
commit | a0fceb80b3ac036326a3af20eb2a05bbe215be64 (patch) | |
tree | 1b05d9d11ba276bdb7519f6fce71d4a9dd354704 /commands/account/recover.go | |
parent | a16bd053211440f95e2badfd280c3e58ef107c70 (diff) | |
download | aerc-a0fceb80b3ac036326a3af20eb2a05bbe215be64.tar.gz |
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/recover.go')
-rw-r--r-- | commands/account/recover.go | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/commands/account/recover.go b/commands/account/recover.go index 855d9846..8158af61 100644 --- a/commands/account/recover.go +++ b/commands/account/recover.go @@ -24,11 +24,6 @@ func (Recover) Aliases() []string { } func (Recover) Complete(aerc *widgets.Aerc, args []string) []string { - acct := aerc.SelectedAccount() - if acct == nil { - return make([]string, 0) - } - // file name of temp file is hard-coded in the NewComposer() function files, err := filepath.Glob( filepath.Join(os.TempDir(), "aerc-compose-*.eml"), @@ -50,11 +45,12 @@ func (Recover) Complete(aerc *widgets.Aerc, args []string) []string { return files } else { // only accepts one file to recover - return commands.FilterList(files, args[1], args[0]+" ", acct.UiConfig().FuzzyComplete) + return commands.FilterList(files, args[1], args[0]+" ", + aerc.SelectedAccountUiConfig().FuzzyComplete) } } else { // only accepts one file to recover - return commands.FilterList(files, args[0], "", acct.UiConfig().FuzzyComplete) + return commands.FilterList(files, args[0], "", aerc.SelectedAccountUiConfig().FuzzyComplete) } } |