-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
shell completion should behave uniformly for bash and zsh when sourced #986
Comments
Big 👍 |
This issue is being marked as stale due to a long period of inactivity |
This article gives some reason why sourcing a completion script isn't great: https://medium.com/@jzelinskie/please-dont-ship-binaries-with-shell-completion-as-commands-a8b1bcb8a0d0 That being said, what you can do is add the missing compdef line to your .zshrc (or something of the sort) and then sourcing the completion file will work. |
I believe @jharshman has confirmed he prefers to follow zsh's best practices and not include the The program using Cobra can easily choose to add this line itself. @jharshman I believe we can close this issue. |
Yes, that is correct @marckhouzam. Closing this issue. |
I was under the assumption that because
. <(app genshcomp)
("app genshcomp" returns shell completion code) worked for bash that the generated zsh code should behave the same for zsh. I can't see any reason to block this behaviour for zsh if only a single line has to be added (#887).For my portable application I value the ability to directly inject the completion code into the running shell without having to save a temporary file or additional commands.
I suggest reopening #887, at least for me it works fine.
The text was updated successfully, but these errors were encountered: