summary refs log tree commit diff stats
path: root/commands/msgview
diff options
context:
space:
mode:
Diffstat (limited to 'commands/msgview')
-rw-r--r--commands/msgview/close.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/commands/msgview/close.go b/commands/msgview/close.go
new file mode 100644
index 0000000..6a7eb0a
--- /dev/null
+++ b/commands/msgview/close.go
@@ -0,0 +1,30 @@
+package msgview
+
+import (
+	"errors"
+
+	"git.sr.ht/~sircmpwn/aerc/widgets"
+)
+
+type Close struct{}
+
+func init() {
+	register(Close{})
+}
+
+func (_ Close) Aliases() []string {
+	return []string{"close"}
+}
+
+func (_ Close) Complete(aerc *widgets.Aerc, args []string) []string {
+	return nil
+}
+
+func (_ Close) Execute(aerc *widgets.Aerc, args []string) error {
+	if len(args) != 1 {
+		return errors.New("Usage: close")
+	}
+	mv, _ := aerc.SelectedTab().(*widgets.MessageViewer)
+	aerc.RemoveTab(mv)
+	return nil
+}