-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Misbehaviour of IsHelpCommand() #393
Comments
Continue of #394 (comment) |
I agree this is terribly confusing... People have used these 'help commands' as a place to put additional help information but on this which were not runningable. So you might have a cobra command tree like the following
Where rootCmd and subCmd have Now if the actual "help" command fits this pattern or not could be a question. Maybe it should be part of the |
Can you please show a concrete example, because unfortunately I don't fully understand you😰 |
Ignore the name 'IsHelpCommand()'. It is a terrible name. The correct name should have be Say my program is something that can write "stuff". It can write to a 'URL' or a 'Word Doc'. I might create the program with the
I might create a If I ran Does that make sense? Ignore the bad name 'IsHelpSubCommand()' and think of the name 'IsAdditionalHelpTopicCommand()` |
Yes, now I understand, what did you mean. And yes, name and docs of |
So how this situation should be handled? |
Actually I wouldn't mind renaming it. It is an API break, but I highly doubt we'll hit many people. If we want to play it safe make the comment say it is deprecated and have it just call the function with a better name. It was only ever made public so it could be used in the template. |
I also don't mind to rename it. And deprecating this function will be better. |
I notice, what IsHelpCommand always returns false even on built-in help command and I found out why:
Look at the docs of IsHelpCommand:
In the docs it says, what help is not runnable, but if you look in
initHelpCmd
definition, you can see, what built-in help command has Run function.
So the actual logic of IsHelpCommand is wrong. I think, the possible solution could be:
The text was updated successfully, but these errors were encountered: