Repository navigation
test: pin that --help ahead of a subcommand prints help - #1342
Conversation
With TraverseChildren, each command parses its own flags while cobra walks down to the subcommand. --help works ahead of a subcommand only because cobra adds the flag at execute time, so a parent has not declared it yet and stops with "help requested". If a parent declared --help up front, it would consume the flag and hand the run to the subcommand: `kosli --help attest generic` would run the attestation instead of printing help. Nothing covered this, and the obvious way to restyle --help after the pflag 1.1.0 bump (declaring it before the flag wrapping) breaks it.
603a012 to
fa1606b
Compare
|
Claude finished @mbevc1's task in 1m 9s —— View job Follow-up review complete
Previous findings: none. This PR has a single commit ( New commits reviewed: Note: I was unable to run |
With TraverseChildren, each command parses its own flags while cobra walks down to the subcommand. --help works ahead of a subcommand only because cobra adds the flag at execute time, so a parent has not declared it yet and stops with "help requested". If a parent declared --help up front, it would consume the flag and hand the run to the subcommand:
kosli --help attest genericwould run the attestation instead of printing help.Checklist
charts/k8s-reporter/) updated, if needed. Note: these changes live in a separate PR