summary refs log tree commit diff stats
path: root/commands
diff options
context:
space:
mode:
Diffstat (limited to 'commands')
-rw-r--r--commands/compose/abort.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/commands/compose/abort.go b/commands/compose/abort.go
new file mode 100644
index 0000000..1cd297e
--- /dev/null
+++ b/commands/compose/abort.go
@@ -0,0 +1,23 @@
+package compose
+
+import (
+	"errors"
+
+	"git.sr.ht/~sircmpwn/aerc2/widgets"
+)
+
+func init() {
+	register("abort", CommandAbort)
+}
+
+func CommandAbort(aerc *widgets.Aerc, args []string) error {
+	if len(args) != 1 {
+		return errors.New("Usage: abort")
+	}
+	composer, _ := aerc.SelectedTab().(*widgets.Composer)
+
+	aerc.RemoveTab(composer)
+	composer.Close()
+
+	return nil
+}