Improve cmd.Help sections as params

pull/53/head
rwxrob 2 years ago
parent 7508d7bf9b
commit e4dc12e719
No known key found for this signature in database
GPG Key ID: 2B9111F33082AE77

@ -7,13 +7,24 @@ import (
"log"
"github.com/rwxrob/bonzai"
"github.com/rwxrob/bonzai/comp"
)
// Help provides help documentation for the caller allowing the specific
// section of help wanted to be passed as a tab-completable parameter.
var Help = &bonzai.Cmd{
Name: `help`,
Aliases: []string{"h"},
Call: func(none ...string) error {
log.Println("would print help")
Name: `help`,
Params: []string{
"name", "title", "summary", "params", "commands", "description",
"examples", "legal", "copyright", "license", "version",
},
Completer: comp.Help,
Call: func(caller *bonzai.Cmd, args ...string) error {
section := "all"
if len(args) > 0 {
section = args[0]
}
log.Printf("would show help about %v %v", caller.Name, section)
return nil
},
}

Loading…
Cancel
Save