2019-08-13 01:55:50 +00:00
|
|
|
package msgview
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
|
2021-11-05 09:19:46 +00:00
|
|
|
"git.sr.ht/~rjarry/aerc/widgets"
|
2019-08-13 01:55:50 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Close struct{}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
register(Close{})
|
|
|
|
}
|
|
|
|
|
2019-09-03 19:34:03 +00:00
|
|
|
func (Close) Aliases() []string {
|
2019-08-13 01:55:50 +00:00
|
|
|
return []string{"close"}
|
|
|
|
}
|
|
|
|
|
2019-09-03 19:34:03 +00:00
|
|
|
func (Close) 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 (Close) Execute(aerc *widgets.Aerc, args []string) error {
|
2019-08-13 01:55:50 +00:00
|
|
|
if len(args) != 1 {
|
|
|
|
return errors.New("Usage: close")
|
|
|
|
}
|
2022-07-18 10:54:55 +00:00
|
|
|
mv, _ := aerc.SelectedTabContent().(*widgets.MessageViewer)
|
2019-10-15 09:01:47 +00:00
|
|
|
mv.Close()
|
2019-08-13 01:55:50 +00:00
|
|
|
aerc.RemoveTab(mv)
|
|
|
|
return nil
|
|
|
|
}
|