2019-05-22 17:17:52 +02:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
|
|
|
|
"git.sr.ht/~sircmpwn/aerc/widgets"
|
|
|
|
)
|
|
|
|
|
2019-06-27 19:33:11 +02:00
|
|
|
type Help struct{}
|
|
|
|
|
2019-05-22 17:17:52 +02:00
|
|
|
func init() {
|
2019-06-27 19:33:11 +02:00
|
|
|
register(Help{})
|
|
|
|
}
|
|
|
|
|
2019-09-03 21:34:03 +02:00
|
|
|
func (Help) Aliases() []string {
|
2019-06-27 19:33:11 +02:00
|
|
|
return []string{"help"}
|
|
|
|
}
|
|
|
|
|
2019-09-03 21:34:03 +02:00
|
|
|
func (Help) Complete(aerc *widgets.Aerc, args []string) []string {
|
2019-06-27 19:33:11 +02:00
|
|
|
return nil
|
2019-05-22 17:17:52 +02:00
|
|
|
}
|
|
|
|
|
2019-09-03 21:34:03 +02:00
|
|
|
func (Help) Execute(aerc *widgets.Aerc, args []string) error {
|
2019-05-22 17:17:52 +02:00
|
|
|
page := "aerc"
|
|
|
|
if len(args) == 2 {
|
|
|
|
page = "aerc-" + args[1]
|
|
|
|
} else if len(args) > 2 {
|
|
|
|
return errors.New("Usage: help [topic]")
|
|
|
|
}
|
2019-06-27 19:33:11 +02:00
|
|
|
return TermCore(aerc, []string{"term", "man", page})
|
2019-05-22 17:17:52 +02:00
|
|
|
}
|