summary refs log tree commit diff stats
path: root/commands/msgview/toggle-headers.go
diff options
context:
space:
mode:
authorYash Srivastav <yash111998@gmail.com>2019-06-07 13:56:14 +0530
committerDrew DeVault <sir@cmpwn.com>2019-06-07 09:20:24 -0400
commitb83e7c9fa6a0d187a0f20d98d522cff792053cdd (patch)
tree4c3765b41d216e26406d21d3b045f340edabbadc /commands/msgview/toggle-headers.go
parent2279ac3ab3d19cd233600907bc8e3e8b4e57b350 (diff)
downloadaerc-b83e7c9fa6a0d187a0f20d98d522cff792053cdd.tar.gz
implements ability to view headers in message view
Diffstat (limited to 'commands/msgview/toggle-headers.go')
-rw-r--r--commands/msgview/toggle-headers.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/commands/msgview/toggle-headers.go b/commands/msgview/toggle-headers.go
new file mode 100644
index 0000000..fc29042
--- /dev/null
+++ b/commands/msgview/toggle-headers.go
@@ -0,0 +1,25 @@
+package msgview
+
+import (
+	"errors"
+	"fmt"
+
+	"git.sr.ht/~sircmpwn/aerc/widgets"
+)
+
+func init() {
+	register("toggle-headers", ToggleHeaders)
+}
+
+func toggleHeadersUsage(cmd string) error {
+	return errors.New(fmt.Sprintf("Usage: %s", cmd))
+}
+
+func ToggleHeaders(aerc *widgets.Aerc, args []string) error {
+	if len(args) > 1 {
+		return toggleHeadersUsage(args[0])
+	}
+	mv, _ := aerc.SelectedTab().(*widgets.MessageViewer)
+	mv.ToggleHeaders()
+	return nil
+}