diff options
| author | Ian Oberst <[email protected]> | 2025-02-11 09:26:24 -0800 |
|---|---|---|
| committer | Ian Oberst <[email protected]> | 2025-02-11 09:26:24 -0800 |
| commit | a1a65e29cfa91c716eceabdca0707d18a76b26ff (patch) | |
| tree | 2e9b2d551ab660a67cd7385e69eb3bfd53a3da58 | |
| parent | f21878956cd90217e8baf6e680f42b6868a820bc (diff) | |
Fix Missing Global Options
| -rw-r--r-- | parse.go | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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 } |
