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.go21
-rw-r--r--commands/msgview/msgview.go16
2 files changed, 37 insertions, 0 deletions
diff --git a/commands/msgview/close.go b/commands/msgview/close.go
new file mode 100644
index 0000000..404bb1c
--- /dev/null
+++ b/commands/msgview/close.go
@@ -0,0 +1,21 @@
+package msgview
+
+import (
+	"errors"
+
+	"git.sr.ht/~sircmpwn/aerc2/widgets"
+)
+
+func init() {
+	register("close", CommandClose)
+}
+
+func CommandClose(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
+}
+
diff --git a/commands/msgview/msgview.go b/commands/msgview/msgview.go
new file mode 100644
index 0000000..e3db828
--- /dev/null
+++ b/commands/msgview/msgview.go
@@ -0,0 +1,16 @@
+package msgview
+
+import (
+	"git.sr.ht/~sircmpwn/aerc2/commands"
+)
+
+var (
+	MessageViewCommands *commands.Commands
+)
+
+func register(name string, cmd commands.AercCommand) {
+	if MessageViewCommands == nil {
+		MessageViewCommands = commands.NewCommands()
+	}
+	MessageViewCommands.Register(name, cmd)
+}