aboutsummaryrefslogtreecommitdiffstats
path: root/commands/terminal/close.go
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-03-21 16:32:22 -0400
committerDrew DeVault <sir@cmpwn.com>2019-03-21 16:32:22 -0400
commit10dd23f05d271a27ad40a6fafffb5fe2c3e5fe57 (patch)
treea2fe85d9e0de5a972bfa7705558e7d50e95445c3 /commands/terminal/close.go
parent8126d82956636a2525263e2d0d985d721fdb8074 (diff)
downloadaerc-10dd23f05d271a27ad40a6fafffb5fe2c3e5fe57.tar.gz
Add terminal command context
Diffstat (limited to 'commands/terminal/close.go')
-rw-r--r--commands/terminal/close.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/commands/terminal/close.go b/commands/terminal/close.go
new file mode 100644
index 00000000..68be6ac5
--- /dev/null
+++ b/commands/terminal/close.go
@@ -0,0 +1,23 @@
+package terminal
+
+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")
+ }
+ thost, ok := aerc.SelectedTab().(*widgets.TermHost)
+ if !ok {
+ return errors.New("Error: not a terminal")
+ }
+ thost.Terminal().Close(nil)
+ return nil
+}