Skip to content

feat: add opt-in help-all command (ref #2362)#2370

Open
dpritchett wants to merge 2 commits intospf13:mainfrom
dpritchett:help-all-command
Open

feat: add opt-in help-all command (ref #2362)#2370
dpritchett wants to merge 2 commits intospf13:mainfrom
dpritchett:help-all-command

Conversation

@dpritchett
Copy link
Copy Markdown

Summary

Adds NewHelpAllCommand() — an opt-in command that prints every visible, runnable command with args and description in one pass. Same wiring pattern as completion:

rootCmd.AddCommand(cobra.NewHelpAllCommand())
  • One line per command, columns aligned
  • --verbose adds flag placeholders with type-aware formatting
  • ~160 lines, no new dependencies

Context in #2362 (see my comment). Gist with gh output (~200 commands).

Example (patched into a local clone of gh)

$ gh help-all
    gh api <endpoint>                                            # Make an authenticated GitHub API request
    gh issue create                                              # Create a new issue
    gh pr merge [<number> | <url> | <branch>]                    # Merge a pull request
    gh repo clone <repository> [<directory>] [-- <gitflags>...]  # Clone a repository locally
    gh run watch <run-id>                                        # Watch a run until it completes
    ...

Full gist with ~200 commands

What's here

  • helpall.go: factory, tree walker, formatter, renderer
  • helpall_test.go: 19 tests

Roadmap

  • Implementation + tests
  • Proof of concept against gh CLI
  • Maintainer feedback on design
  • Doc page in site/content/ if accepted
  • Final review
  • Land

Add NewHelpAllCommand() factory that prints every visible, runnable
command with args and description in one pass — the cobra equivalent
of `rake routes`. Supports --verbose to include flag placeholders.

Ref: spf13#2362
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 20, 2026

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants