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>
This commit is contained in:
parent
a16bd05321
commit
a0fceb80b3
3 changed files with 5 additions and 19 deletions
commands
|
@ -20,16 +20,11 @@ func (ChangeTab) Aliases() []string {
|
|||
}
|
||||
|
||||
func (ChangeTab) Complete(aerc *widgets.Aerc, args []string) []string {
|
||||
acct := aerc.SelectedAccount()
|
||||
if acct == nil {
|
||||
return make([]string, 0)
|
||||
}
|
||||
|
||||
if len(args) == 0 {
|
||||
return aerc.TabNames()
|
||||
}
|
||||
joinedArgs := strings.Join(args, " ")
|
||||
return FilterList(aerc.TabNames(), joinedArgs, "", acct.UiConfig().FuzzyComplete)
|
||||
return FilterList(aerc.TabNames(), joinedArgs, "", aerc.SelectedAccountUiConfig().FuzzyComplete)
|
||||
}
|
||||
|
||||
func (ChangeTab) Execute(aerc *widgets.Aerc, args []string) error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue