help: add completions
Add :help completion arguments (config, imap, etc). The option "aerc" brings up the general manpage Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Koni Marti <koni.marti@gmail.com>
This commit is contained in:
parent
321593d138
commit
f4d4e2b4e1
|
@ -8,6 +8,19 @@ import (
|
|||
|
||||
type Help struct{}
|
||||
|
||||
var pages = []string{
|
||||
"aerc",
|
||||
"config",
|
||||
"imap",
|
||||
"notmuch",
|
||||
"search",
|
||||
"sendmail",
|
||||
"smtp",
|
||||
"stylesets",
|
||||
"templates",
|
||||
"tutorial",
|
||||
}
|
||||
|
||||
func init() {
|
||||
register(Help{})
|
||||
}
|
||||
|
@ -17,12 +30,12 @@ func (Help) Aliases() []string {
|
|||
}
|
||||
|
||||
func (Help) Complete(aerc *widgets.Aerc, args []string) []string {
|
||||
return nil
|
||||
return CompletionFromList(aerc, pages, args)
|
||||
}
|
||||
|
||||
func (Help) Execute(aerc *widgets.Aerc, args []string) error {
|
||||
page := "aerc"
|
||||
if len(args) == 2 {
|
||||
if len(args) == 2 && args[1] != "aerc" {
|
||||
page = "aerc-" + args[1]
|
||||
} else if len(args) > 2 {
|
||||
return errors.New("Usage: help [topic]")
|
||||
|
|
Loading…
Reference in New Issue