mirror of
https://git.sr.ht/~rjarry/aerc
synced 2025-07-16 17:13:50 +02:00

Update the Command interface to include a Description() method. Implement the method for all commands using short descriptions inspired from the aerc(1) man page. Return the description values along with command names so that they can be displayed in completion choices. Implements: https://todo.sr.ht/~rjarry/aerc/271 Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bojan Gabric <bojan@bojangabric.com> Tested-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
36 lines
632 B
Go
36 lines
632 B
Go
package account
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"git.sr.ht/~rjarry/aerc/app"
|
|
"git.sr.ht/~rjarry/aerc/commands"
|
|
)
|
|
|
|
type CheckMail struct{}
|
|
|
|
func init() {
|
|
commands.Register(CheckMail{})
|
|
}
|
|
|
|
func (CheckMail) Description() string {
|
|
return "Check for new mail on the selected account."
|
|
}
|
|
|
|
func (CheckMail) Context() commands.CommandContext {
|
|
return commands.MESSAGE_LIST
|
|
}
|
|
|
|
func (CheckMail) Aliases() []string {
|
|
return []string{"check-mail"}
|
|
}
|
|
|
|
func (CheckMail) Execute(args []string) error {
|
|
acct := app.SelectedAccount()
|
|
if acct == nil {
|
|
return errors.New("No account selected")
|
|
}
|
|
acct.CheckMailReset()
|
|
acct.CheckMail()
|
|
return nil
|
|
}
|