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/compose

View file

@ -1,33 +0,0 @@
package compose
import (
"errors"
"git.sr.ht/~sircmpwn/aerc/widgets"
)
type Abort struct{}
func init() {
register(Abort{})
}
func (_ Abort) Aliases() []string {
return []string{"abort"}
}
func (_ Abort) Complete(aerc *widgets.Aerc, args []string) []string {
return nil
}
func (_ Abort) Execute(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
}