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

Root command's Help() doesn't print Usage #20

Closed
ghodss opened this issue Sep 3, 2014 · 0 comments
Closed

Root command's Help() doesn't print Usage #20

ghodss opened this issue Sep 3, 2014 · 0 comments

Comments

@ghodss
Copy link
Contributor

ghodss commented Sep 3, 2014

As pointed out by @jcelliott in #3, running the root command without any arguments, or running the root command with <command> help does not print the Command.Long description.[1] Given that the help command is the only venue in which you can see the Long description, this is a bug. (The README indicates that the Long description should be printed as well.)

The issue is that Command.Usage() doesn't print the Long description, only Command.Help() does. This would be fine if Command.Help() always printed Usage. But instead, Command.Help() only prints Usage if the Command is Runnable, which the root command typically is not. Instead, Command.Help() should print Usage if the command is Runnable OR if the command HasSubCommands.

When Help() is fixed to print Usage in those cases, Help is often the preferred thing to print, not Usage.

I am submitting a PR which fixes the Help() behavior and changes a few Usage() references to use Help() instead.

[1] As an aside, if you go get the latest cobra release, this behavior is visible on Hugo right now.

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

1 participant