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

Bash completions shouldn't exclude help command #1000

Closed
voithos opened this issue Dec 9, 2019 · 6 comments · Fixed by #1136
Closed

Bash completions shouldn't exclude help command #1000

voithos opened this issue Dec 9, 2019 · 6 comments · Fixed by #1136
Labels
area/shell-completion All shell completions

Comments

@voithos
Copy link
Contributor

voithos commented Dec 9, 2019

There appears to be an explicit check in the bash completion code that excludes the help command:

if !c.IsAvailableCommand() || c == cmd.helpCommand {

This means that the resulting completion script doesn't show help as a valid cobra command, which seems unnecessary? This is also not present in the zsh completions generator.

@jharshman jharshman added the area/shell-completion All shell completions label Dec 26, 2019
@jharshman
Copy link
Collaborator

This is interesting. Thank you @voithos for bringing this to my attention. I will do some digging to see if there is a reason as to why this was done.

@jharshman
Copy link
Collaborator

This was done a while ago in #128.

@eparis, you didn't give a description in your PR. Can you shed some light on the reasoning behind excluding the autogenerated help command?

@eparis
Copy link
Collaborator

eparis commented Dec 27, 2019

that was a while ago!

I think I, at the time, didn't want to generate documentation for an autogenerated help command. Nor did I want to include a 'see also' section if the only command was the autogenerated help command.

I guess I'd be fine with it showing up in bash completions. But I don't think we should have a -help man/md page for any autogenerated help command...

@jharshman
Copy link
Collaborator

@eparis thanks for the insight.
I agree that it shouldn't show up in man pages but I see no harm in it showing up in the bash autocompletion.

@voithos go ahead and cut a PR for this and I'll review.

voithos added a commit to voithos/cobra that referenced this issue Mar 23, 2020
marckhouzam added a commit to VilledeMontreal/cobra that referenced this issue Apr 1, 2020
Based on the change in spf13#1065
for spf13#1000

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
@github-actions
Copy link

github-actions bot commented Apr 3, 2020

This issue is being marked as stale due to a long period of inactivity

@voithos
Copy link
Contributor Author

voithos commented Apr 3, 2020

This is still relevant. (For the bot)

marckhouzam pushed a commit to VilledeMontreal/cobra that referenced this issue Jun 12, 2020
jharshman pushed a commit that referenced this issue Jun 16, 2020
* Don't exclude 'help' from bash completions

Fixes #1000.

* Provide completion for the help command

1- Show 'help' as a possible completion
2- Provide completions for the help command itself

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>

Co-authored-by: Zaven Muradyan <voithos@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/shell-completion All shell completions
Projects
None yet
3 participants