diff options
author | Tim Culverhouse <tim@timculverhouse.com> | 2023-09-25 09:07:44 -0500 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-09-27 23:14:14 +0200 |
commit | 55bcca4a31f29d58f2cc07dc0b17e2fd7da5f590 (patch) | |
tree | e111e87e260b219cd936b326ab3f9186356a373b /commands/msg/toggle-thread-context.go | |
parent | 4ec1e1a5e4c74236a6d1992c8778c39fd25d847b (diff) | |
download | aerc-55bcca4a31f29d58f2cc07dc0b17e2fd7da5f590.tar.gz |
commands: add :toggle-thread-context command
Add a command to toggle the display of an thread-context. Update
CHANGELOG.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Tested-by: Inwit <inwit@sindominio.net>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'commands/msg/toggle-thread-context.go')
-rw-r--r-- | commands/msg/toggle-thread-context.go | 36 |
1 files changed, 36 insertions, 0 deletions
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 +} |