summaryrefslogtreecommitdiff
path: root/parse.go
diff options
context:
space:
mode:
authorAlex Flint <[email protected]>2025-03-07 17:08:54 -0500
committerGitHub <[email protected]>2025-03-07 17:08:54 -0500
commit7155e7e98695d85dafd6453d129ff983fc9b560f (patch)
tree2e9b2d551ab660a67cd7385e69eb3bfd53a3da58 /parse.go
parentf21878956cd90217e8baf6e680f42b6868a820bc (diff)
parenta1a65e29cfa91c716eceabdca0707d18a76b26ff (diff)
Merge pull request #278 from Areson/ioberst-global-help-options
Fix Missing Global Options
Diffstat (limited to 'parse.go')
-rw-r--r--parse.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/parse.go b/parse.go
index 3a08b10..bf6784a 100644
--- a/parse.go
+++ b/parse.go
@@ -285,6 +285,13 @@ func NewParser(config Config, dests ...interface{}) (*Parser, error) {
}
}
+ // Set the parent of the subcommands to be the top-level command
+ // to make sure that global options work when there is more than one
+ // dest supplied.
+ for _, subcommand := range p.cmd.subcommands {
+ subcommand.parent = p.cmd
+ }
+
return &p, nil
}