2019-08-13 03:55:50 +02:00
|
|
|
package msgview
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
|
|
|
|
"git.sr.ht/~sircmpwn/aerc/widgets"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Close struct{}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
register(Close{})
|
|
|
|
}
|
|
|
|
|
2019-09-03 21:34:03 +02:00
|
|
|
func (Close) Aliases() []string {
|
2019-08-13 03:55:50 +02:00
|
|
|
return []string{"close"}
|
|
|
|
}
|
|
|
|
|
2019-09-03 21:34:03 +02:00
|
|
|
func (Close) Complete(aerc *widgets.Aerc, args []string) []string {
|
2019-08-13 03:55:50 +02:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2019-09-03 21:34:03 +02:00
|
|
|
func (Close) Execute(aerc *widgets.Aerc, args []string) error {
|
2019-08-13 03:55:50 +02:00
|
|
|
if len(args) != 1 {
|
|
|
|
return errors.New("Usage: close")
|
|
|
|
}
|
|
|
|
mv, _ := aerc.SelectedTab().(*widgets.MessageViewer)
|
2019-10-15 11:01:47 +02:00
|
|
|
mv.Close()
|
2019-08-13 03:55:50 +02:00
|
|
|
aerc.RemoveTab(mv)
|
|
|
|
return nil
|
|
|
|
}
|