aboutsummaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2022-05-19 18:44:37 -0500
committerRobin Jarry <robin@jarry.cc>2022-05-23 20:59:10 +0200
commitf4d4e2b4e1733c1c5257a54e2fa9de2a2a2f5f28 (patch)
tree76b3f1991f492d95285acbba73ebd5658268abd4 /commands
parent321593d1385dce4ad35e8ad5b2fe88e5c77761cd (diff)
downloadaerc-f4d4e2b4e1733c1c5257a54e2fa9de2a2a2f5f28.tar.gz
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>
Diffstat (limited to 'commands')
-rw-r--r--commands/help.go17
1 files changed, 15 insertions, 2 deletions
diff --git a/commands/help.go b/commands/help.go
index 5bc8f0e2..6efaf4d6 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]")