-
Notifications
You must be signed in to change notification settings - Fork 291
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/Fish completion failing #105
Comments
See spf13/cobra#1129 |
See spf13/cobra#1129 (comment) - we're going to update to cobra master for now. |
@bufdev the error is fixed, but completion is gone now btw :)
|
Neither ZSH nor Fish completions are working for me. No error is output, they simply don't work. |
Can you provide any more details than that, for example how you've installed it? |
I built the program normally with Go compiler, then used the binary with its |
@gbrlsnchs can you try installing from master and see if this is fixed? |
Also @amenzhinsky |
I believe this is fixed in v0.26.0, let us know if there are any other issues, sorry for the trouble. |
Hi, @bufdev, thanks for your effort. However, no luck, completion is still not working in |
Well, shoot. |
The issue with both zsh and fish completion here is going to be within the github.com/spf13/cobra library - they've been doing a lot of refactors to shell completion recently https://github.com/spf13/cobra/commits/master and there's clearly some bugs. Unfortunately, we don't have the time to dive into these right now, but this is where the bug would be. Will keep this open, and will re-test as improvements in spf13/cobra are available. |
@amenzhinsky do you think you could file an issue on github.com/spf13/cobra with what you see? We're trying to debug but we're not zsh completion experts heh |
I'll try to find some time this weekend to figure out what's the problem. |
Hey, any chance you could check in on this again? There's been a lot of random work in spf13/cobra on the issue, wondering if it got magically fixed! |
I've taken the liberty to investigate this. First, it is important to note that the new completion system provided by Cobra no longer hard-codes the completions within the completion shell script (except for bash). Instead, it delegates the completion logic to the Cobra program itself. For example you can request completions yourself like this:
The problem now is that the completion scripts read this output from stdout and purposefully ignore stderr. However, buf/internal/pkg/app/appcmd/appcmd.go Line 149 in 7f21551
Since Cobra's completion scripts for zsh and fish (and powershell) ignore stderr, no completions are shown. Is there a reason If it is necessary, a way to work around this would be to output to stdout when the command is Cobra's |
Hey @marckhouzam, thanks for investigating this and all of the information! We've actually already patched this internally and it will go out with our next release We should have updated this issue when we landed the change internally, sorry about that. |
This should be fixed - please let us know if this comes up again! We won't be surprised :-) |
Hi there,
zsh completion is not working, I'm getting
_arguments:comparguments:325: invalid option definition: --log-format[The log format [text,color,json].]:
Generated completion looks like:
It seems cobra doesn't escape flag description properly: https://github.com/spf13/cobra/blob/v1.0.0/zsh_completions.go#L334 and braces from flag descriptions with permitted values break it.
I'm not sure whether it's done on purpose for some flexibility or not.
The text was updated successfully, but these errors were encountered: