Use custom usage template to avoid duplicate flag info in help output#4649
Use custom usage template to avoid duplicate flag info in help output#4649aravindtga wants to merge 1 commit into
Conversation
Signed-off-by: Aravindhan Ayyanathan <aravindhan.a@est.tech>
✅ Deploy Preview for kptdocs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR reduces duplication in kpt <cmd> --help output by introducing a custom Cobra usage template that conditionally suppresses Cobra’s auto-generated local Flags table when the command’s Long text already contains a curated Flags: section. It also updates generated CLI Long descriptions and the rendered documentation pages to ensure the curated sections fully cover each command’s flags/args (including restoring the missing pkg tree Args section).
Changes:
- Added a custom Cobra usage template (plus a template helper) to hide the auto local Flags table when
LongincludesFlags:, while always showing Global Flags. - Updated generated command Long docs to include missing flag documentation for several commands (and restored
kpt pkg treeArgs content). - Updated rendered CLI reference markdown pages to reflect the expanded/normalized Args/Flags sections.
Reviewed changes
Copilot reviewed 10 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| run/run.go | Adds custom Cobra usage template + template helper to suppress duplicate local flag tables when Long already contains Flags:. |
| internal/docs/generated/pkgdocs/docs.go | Updates generated pkg command docs to include complete Flags: / Args: content (e.g., cat, diff, tree). |
| internal/docs/generated/livedocs/docs.go | Updates generated live command docs to include missing flag entries (e.g., --status-policy, --quiet, --rg-file). |
| internal/docs/generated/fndocs/docs.go | Updates generated fn command docs to include missing flags and normalize formatting (e.g., --allow-alpha-wasm, selector flags). |
| documentation/content/en/reference/cli/pkg/tree/_index.md | Updates rendered docs for pkg tree Args section content and marker placement. |
| documentation/content/en/reference/cli/pkg/diff/_index.md | Adds rendered docs entry for --debug flag. |
| documentation/content/en/reference/cli/pkg/cat/_index.md | Normalizes rendered flag docs formatting and adds default-value notes. |
| documentation/content/en/reference/cli/live/migrate/_index.md | Adds rendered docs entry for --rg-file. |
| documentation/content/en/reference/cli/live/init/_index.md | Adds rendered docs entry for --quiet. |
| documentation/content/en/reference/cli/live/destroy/_index.md | Adds rendered docs entry for --status-policy. |
| documentation/content/en/reference/cli/live/apply/_index.md | Adds rendered docs entry for --status-policy. |
| documentation/content/en/reference/cli/fn/render/_index.md | Adds rendered docs entry for --allow-alpha-wasm. |
| documentation/content/en/reference/cli/fn/eval/_index.md | Adds rendered docs entries for --allow-alpha-wasm and match/exclude selector flags; fixes --match-kind formatting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Description
pkg treelost its Args section.Before/After
Before (
kpt fn render --help) - flags documented in Long description, then duplicated in Cobra's auto-generated table:After - duplicate Cobra Flags table removed, only the curated documentation remains:
Group commands (e.g.
kpt pkg --help) continue to show the Cobra flag table as before since they have no "Flags:" in their Long description.Related Issue(s)
Type of Change
Checklist
AI Disclosure
If so, please describe how:
- Kiro to analyse the issue, identify gaps, implement the template change, and update all documentation.