add close command at global level

This commit is contained in:
Aditya Srivastava 2019-08-11 20:42:49 -07:00 committed by Drew DeVault
parent 72204d1f24
commit f0a0c5aa73
6 changed files with 72 additions and 100 deletions
commands/terminal

View file

@ -1,30 +0,0 @@
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
}