Skip to content

Commit 812db51

Browse files
committed
fix: Allow the root node to define Help()
so you can use this pattern with a simple command line application
1 parent db42183 commit 812db51

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

build.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ func build(k *Kong, ast any) (app *Application, err error) {
3232
if len(node.Positional) > 0 && len(node.Children) > 0 {
3333
return nil, fmt.Errorf("can't mix positional arguments and branching arguments on %T", ast)
3434
}
35+
if provider, ok := v.Interface().(HelpProvider); ok {
36+
node.Detail = provider.Help()
37+
}
3538
app.Node = node
3639
app.Node.Flags = append(extraFlags, app.Node.Flags...)
3740
app.Tag = newEmptyTag()

0 commit comments

Comments
 (0)