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 script should not assume complete command exists #772

Closed
bobtiernay-okta opened this issue Jul 22, 2019 · 2 comments
Closed
Labels
theme: auto-completion An issue or change related to auto-completion theme: codegen An issue or change related to the picocli-codegen module
Milestone

Comments

@bobtiernay-okta
Copy link
Contributor

bobtiernay-okta commented Jul 22, 2019

After recently upgrading my macOs to Mojave, I found out that my Picocli autocomplete script stopped working with the following error:

.my-completion.sh:2899: command not found: complete`

To solve the problem I needed to add the following prior to running the script:

autoload bashcompinit
bashcompinit

On further inspection, I noticed https://picocli.info/autocomplete.html#_install_completion_script illustrates in passing that this is required. I'm wondering if it makes sense to add that to the generated script if complete isn't defined. That would allow the instructions for bash and zsh to be the same.

@remkop
Copy link
Owner

remkop commented Jul 22, 2019

I’m open to any improvements.
Do you think you can provide a pull request?

@remkop remkop added theme: auto-completion An issue or change related to auto-completion theme: codegen An issue or change related to the picocli-codegen module labels Sep 19, 2019
@remkop remkop added this to the 4.1 milestone Oct 13, 2019
@remkop
Copy link
Owner

remkop commented Nov 21, 2019

The generated completion script itself now enables bash completion in zsh.

That means it is no longer necessary to run the below commands in ZSH before sourcing the completion script:

autoload -U +X compinit && compinit
autoload -U +X bashcompinit && bashcompinit

Can you verify?

@remkop remkop closed this as completed Nov 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: auto-completion An issue or change related to auto-completion theme: codegen An issue or change related to the picocli-codegen module
Projects
None yet
Development

No branches or pull requests

2 participants