2019-08-13 01:55:50 +00:00
|
|
|
package compose
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
|
|
|
|
"git.sr.ht/~sircmpwn/aerc/widgets"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Abort struct{}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
register(Abort{})
|
|
|
|
}
|
|
|
|
|
2019-09-03 19:34:03 +00:00
|
|
|
func (Abort) Aliases() []string {
|
2019-08-13 01:55:50 +00:00
|
|
|
return []string{"abort"}
|
|
|
|
}
|
|
|
|
|
2019-09-03 19:34:03 +00:00
|
|
|
func (Abort) Complete(aerc *widgets.Aerc, args []string) []string {
|
2019-08-13 01:55:50 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2019-09-03 19:34:03 +00:00
|
|
|
func (Abort) Execute(aerc *widgets.Aerc, args []string) error {
|
2019-08-13 01:55:50 +00:00
|
|
|
if len(args) != 1 {
|
|
|
|
return errors.New("Usage: abort")
|
|
|
|
}
|
|
|
|
composer, _ := aerc.SelectedTab().(*widgets.Composer)
|
|
|
|
|
|
|
|
aerc.RemoveTab(composer)
|
|
|
|
composer.Close()
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|