mirror of
https://git.sr.ht/~rjarry/aerc
synced 2025-12-12 20:36:12 +01: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>
31 lines
454 B
Go
31 lines
454 B
Go
package commands
|
|
|
|
import (
|
|
"git.sr.ht/~rjarry/aerc/app"
|
|
)
|
|
|
|
type Echo struct {
|
|
Template string `opt:"..." required:"false"`
|
|
}
|
|
|
|
func init() {
|
|
Register(Echo{})
|
|
}
|
|
|
|
func (Echo) Description() string {
|
|
return "Print text after template expansion."
|
|
}
|
|
|
|
func (Echo) Aliases() []string {
|
|
return []string{"echo"}
|
|
}
|
|
|
|
func (Echo) Context() CommandContext {
|
|
return GLOBAL
|
|
}
|
|
|
|
func (e Echo) Execute(args []string) error {
|
|
app.PushSuccess(e.Template)
|
|
return nil
|
|
}
|