mirror of
https://git.sr.ht/~rjarry/aerc
synced 2025-02-22 23:23:57 +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>
30 lines
589 B
Go
30 lines
589 B
Go
package msgview
|
|
|
|
import (
|
|
"git.sr.ht/~rjarry/aerc/app"
|
|
"git.sr.ht/~rjarry/aerc/commands"
|
|
)
|
|
|
|
type ToggleHeaders struct{}
|
|
|
|
func init() {
|
|
commands.Register(ToggleHeaders{})
|
|
}
|
|
|
|
func (ToggleHeaders) Description() string {
|
|
return "Toggle the visibility of message headers."
|
|
}
|
|
|
|
func (ToggleHeaders) Context() commands.CommandContext {
|
|
return commands.MESSAGE_VIEWER
|
|
}
|
|
|
|
func (ToggleHeaders) Aliases() []string {
|
|
return []string{"toggle-headers"}
|
|
}
|
|
|
|
func (ToggleHeaders) Execute(args []string) error {
|
|
mv, _ := app.SelectedTabContent().(*app.MessageViewer)
|
|
mv.ToggleHeaders()
|
|
return nil
|
|
}
|