mirror of
https://git.sr.ht/~rjarry/aerc
synced 2025-07-09 07:00:21 +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>
35 lines
693 B
Go
35 lines
693 B
Go
package msg
|
|
|
|
import (
|
|
"git.sr.ht/~rjarry/aerc/commands"
|
|
"git.sr.ht/~rjarry/aerc/lib/ui"
|
|
)
|
|
|
|
type ToggleThreadContext struct{}
|
|
|
|
func init() {
|
|
commands.Register(ToggleThreadContext{})
|
|
}
|
|
|
|
func (ToggleThreadContext) Description() string {
|
|
return "Show/hide message thread context."
|
|
}
|
|
|
|
func (ToggleThreadContext) Context() commands.CommandContext {
|
|
return commands.MESSAGE_LIST | commands.MESSAGE_VIEWER
|
|
}
|
|
|
|
func (ToggleThreadContext) Aliases() []string {
|
|
return []string{"toggle-thread-context"}
|
|
}
|
|
|
|
func (ToggleThreadContext) Execute(args []string) error {
|
|
h := newHelper()
|
|
store, err := h.store()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
store.ToggleThreadContext()
|
|
ui.Invalidate()
|
|
return nil
|
|
}
|