summary refs log tree commit diff stats
path: root/commands/terminal/close.go
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-08-13 10:55:50 +0900
committerDrew DeVault <sir@cmpwn.com>2019-08-13 10:55:50 +0900
commit4fc6fee734e1b88c9aab94e66f5a2f908a86452f (patch)
tree76a2d79320ec2da88762d28ef66a391243206543 /commands/terminal/close.go
parentf0a0c5aa733fa66958c113465bfc5fdd3d7cc9f0 (diff)
downloadaerc-4fc6fee734e1b88c9aab94e66f5a2f908a86452f.tar.gz
Revert "add close command at global level"
This reverts commit f0a0c5aa733fa66958c113465bfc5fdd3d7cc9f0.
Diffstat (limited to 'commands/terminal/close.go')
-rw-r--r--commands/terminal/close.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/commands/terminal/close.go b/commands/terminal/close.go
new file mode 100644
index 0000000..8256e67
--- /dev/null
+++ b/commands/terminal/close.go
@@ -0,0 +1,30 @@
+package terminal
+
+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")
+	}
+	term, _ := aerc.SelectedTab().(*widgets.Terminal)
+	term.Close(nil)
+	return nil
+}