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

Remove square brackets from persistent flag description to fix zsh autocomplete #1707

Merged
merged 1 commit into from Sep 16, 2020

Conversation

samcoe
Copy link
Contributor

@samcoe samcoe commented Sep 16, 2020

Summary

closes #1703

Details

The square brackets in repo PersistentFlags description is causing ZSH autocomplete to break. Cobra should be escaping them properly when generating the autocomplete file but that seems to be broken. Temporarily removing [HOST/] until we come up with a more permanent solution.

Looks like this issue will be fixed with the next release of Cobra spf13/cobra#1070

@samcoe samcoe self-assigned this Sep 16, 2020
@cristiand391
Copy link
Contributor

cristiand391 commented Sep 16, 2020

I was about to open an issue about this.

Cobra has already solved this bug but we will need to bump it up to this specific commit or wait until the next release.
I tried the new zsh completion on my machine and it escapes square brackets succesfully without any change.

This new implementation brings some behavioral changes, the most important I think is file completion by default which we could gradually disable after updating Cobra.

I think custom completion could bring some interesting functionality to commands like gh pr view [tab][tab], is there any interest in updating Cobra?

@mislav
Copy link
Contributor

mislav commented Sep 16, 2020

@cristiand391 Thanks for looking into all that! At the moment we will avoid upgrading Cobra, but you are welcome to do an exploration of what we could do with completions in a newer version! For example, if gh pr view [Tab][Tab] could show the list of PRs to view, that would be excellent. Please send us a PR if you end up with something 🙇

Copy link
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! :shipit:

@mislav mislav merged commit 5a2c7e7 into trunk Sep 16, 2020
@mislav mislav deleted the fix-zsh-autocomplete branch September 16, 2020 13:53
@toby-griffiths
Copy link

Please can anyone advise when can we expect this to be released?

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

Successfully merging this pull request may close these issues.

Error when using cli autocomplete on zsh
4 participants