Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override help subcommand logic #2136

Open
firelizzard18 opened this issue Apr 24, 2024 · 2 comments
Open

Override help subcommand logic #2136

firelizzard18 opened this issue Apr 24, 2024 · 2 comments

Comments

@firelizzard18
Copy link

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.
@marckhouzam
Copy link
Collaborator

#1559 does this for the completion command.

How would the help command be used in such a case though? The help command is usually used as program help subcommand

@firelizzard18
Copy link
Author

I use program help all the time to print the usage message. Sure, I could use program --help, but it's muscle memory at this point.

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

No branches or pull requests

2 participants