Skip to content

Commit

Permalink
update help example to use vars
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-broad committed May 26, 2024
1 parent 2ab5733 commit a62f497
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions _examples/shell/help/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ import (
)

var cli struct {
Flag flagWithHelp `help:"Regular flag help"`
Flag flagWithHelp `help:"${flag_help}"`
Echo commandWithHelp `cmd:"" help:"Regular command help"`
}

type flagWithHelp bool

func (f *flagWithHelp) Help() string {
return "🏁 additional flag help"
var vars = kong.Vars{
"flag_help": "Extended flag help that might be too long for directly " +
"including in the struct tag field",
}

type commandWithHelp struct {
Expand All @@ -41,7 +42,8 @@ func main() {
kong.ConfigureHelp(kong.HelpOptions{
Compact: true,
Summary: false,
}))
}),
vars)
switch ctx.Command() {
case "echo <msg>":
fmt.Println(cli.Echo.Msg)
Expand Down

0 comments on commit a62f497

Please sign in to comment.