Bash autocompletion works well, but I would really like zsh to work as well
Related https://github.com/mitsuhiko/click/issues/241.
Has zsh implementation: https://github.com/kislyuk/argcomplete
I have to release a tmuxp.bash, tmuxp.zsh and tmuxp.tcsh to get autocomplete working with argcomplete. The user has to source the correct one depending on their $SHELL, https://github.com/tony/tmuxp/tree/master/pkg
See also aws-cli's advanced completion: https://github.com/aws/aws-cli/tree/develop/bin
The user has to source the correct one depending on their
$SHELL
if their $SHELL is zsh and you install globally, you can just put _tmuxp into $fpath, which by default contains /usr/{,local/}share/zsh/site-functions.
As an alternative to implementing native zsh completion, you can also use zsh's bash completion compatibility mode. To use it, add
autoload bashcompinit
bashcompinit
eval "$(_FOO_BAR_COMPLETE=source foo-bar)"
to your .zshrc. The last line assumes your click script is called foo-bar; see the click docs for more info.
@bb4242 thanks for the tipp, that works well.
@bb4242's answer should be added to the docs at: http://click.pocoo.org/5/bashcomplete/
Closed since we have two related pull requests with active discussion and development
Most helpful comment
As an alternative to implementing native zsh completion, you can also use zsh's bash completion compatibility mode. To use it, add
to your
.zshrc. The last line assumes your click script is calledfoo-bar; see the click docs for more info.