From 55bcca4a31f29d58f2cc07dc0b17e2fd7da5f590 Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Mon, 25 Sep 2023 09:07:44 -0500 Subject: commands: add :toggle-thread-context command Add a command to toggle the display of an thread-context. Update CHANGELOG. Signed-off-by: Tim Culverhouse Tested-by: Inwit Acked-by: Robin Jarry --- commands/msg/toggle-thread-context.go | 36 +++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 commands/msg/toggle-thread-context.go (limited to 'commands/msg/toggle-thread-context.go') diff --git a/commands/msg/toggle-thread-context.go b/commands/msg/toggle-thread-context.go new file mode 100644 index 00000000..09c60b85 --- /dev/null +++ b/commands/msg/toggle-thread-context.go @@ -0,0 +1,36 @@ +package msg + +import ( + "errors" + + "git.sr.ht/~rjarry/aerc/lib/ui" + "git.sr.ht/~rjarry/aerc/widgets" +) + +type ToggleThreadContext struct{} + +func init() { + register(ToggleThreadContext{}) +} + +func (ToggleThreadContext) Aliases() []string { + return []string{"toggle-thread-context"} +} + +func (ToggleThreadContext) Complete(aerc *widgets.Aerc, args []string) []string { + return nil +} + +func (ToggleThreadContext) Execute(aerc *widgets.Aerc, args []string) error { + if len(args) != 1 { + return errors.New("Usage: toggle-entire-thread") + } + h := newHelper(aerc) + store, err := h.store() + if err != nil { + return err + } + store.ToggleThreadContext() + ui.Invalidate() + return nil +} -- cgit