Override help subcommand logic
Open
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 44.6k
- Forks
- 3.5k
- PR merge metrics
- No merged PRs in 30d
Description
I am using cobra. I don't need subcommands. I do want the default help and completion subcommands to be generated. There should be an option for "generate default subcommands even if no other subcommands are defined".
func (c *Command) InitDefaultHelpCmd() {
if !c.HasSubCommands() {
return
}
// ...
}
There should be some option that disables the subcommand check.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading Command.InitDefaultHelpCmd and the surrounding default-subcommand initialization, especially the HasSubCommands check. Trace how help and completion are generated, then determine the option's expected behavior when no user subcommands exist; done means both default subcommands can be generated in that case without changing normal behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100