From f4d4e2b4e1733c1c5257a54e2fa9de2a2a2f5f28 Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Thu, 19 May 2022 18:44:37 -0500 Subject: [PATCH] help: add completions Add :help completion arguments (config, imap, etc). The option "aerc" brings up the general manpage Signed-off-by: Tim Culverhouse Acked-by: Koni Marti --- commands/help.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/commands/help.go b/commands/help.go index 5bc8f0e..6efaf4d 100644 --- a/commands/help.go +++ b/commands/help.go @@ -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]")