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

zsh completion doesn't work #1165

Closed
kraymond37 opened this issue Jul 15, 2020 · 4 comments
Closed

zsh completion doesn't work #1165

kraymond37 opened this issue Jul 15, 2020 · 4 comments

Comments

@kraymond37
Copy link

I create a completion command as this said. Bash completion works well, in contrast, zsh doesn't work.
Did I miss something? I like cobra very much, and really wish it could work.

@Luap99
Copy link
Contributor

Luap99 commented Jul 15, 2020

How do you load your completion script?
I think you need to do yourprogram completion zsh > "${fpath[1]}/_yourprogram"

@marckhouzam
Copy link
Collaborator

@Luap99 is probably right and it points out that the documentation is mis-leading:
https://github.com/spf13/cobra/blame/master/shell_completions.md#L36
I'll post a PR.

@kraymond37
Copy link
Author

@Luap99 Thanks. I found source didn't work, and yourprogram completion zsh > "${fpath[1]}/_yourprogram" didn't work either. Both yourprogram completion zsh > "${fpath[1]}/_yourprogram" and compinit should be executed, and sometimes also need to relogin shell.

@marckhouzam
Copy link
Collaborator

Thanks. I found source didn't work, and yourprogram completion zsh > "${fpath[1]}/_yourprogram" didn't work either. Both yourprogram completion zsh > "${fpath[1]}/_yourprogram" and compinit should be executed, and sometimes also need to relogin shell.

Thanks @kraymond37, we have updated #1169 to include that information.
If that is satisfactory, would you mind closing this issue here?

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

3 participants