Skip to content

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

Merged
mislav merged 1 commit into
trunkfrom
fix-zsh-autocomplete
Sep 16, 2020
Merged

mislav merged 1 commit into
trunkfrom
fix-zsh-autocomplete

Conversation

@samcoe

@samcoe samcoe commented Sep 16, 2020 •

Copy link
Copy Markdown
Contributor

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
@samcoe
samcoe requested review from mislav and vilmibm September 16, 2020 09:59
@cristiand391

cristiand391 commented Sep 16, 2020 •

Copy link
Copy Markdown
Contributor

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

mislav commented Sep 16, 2020

Copy link
Copy Markdown
Contributor

@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 🙇

@mislav mislav left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown

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