diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2013-08-16 21:45:26 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2013-08-16 21:45:26 -0300 |
commit | 08ffd87bc84928ef5ca0792175323d441145f5ce (patch) | |
tree | 2ff825c1cf13137777c3281bc6a61df9d2a83588 | |
parent | 3cf730cd3301b476ef256a88db83b8025b03ded5 (diff) | |
download | keyringer-08ffd87bc84928ef5ca0792175323d441145f5ce.tar.gz keyringer-08ffd87bc84928ef5ca0792175323d441145f5ce.tar.bz2 |
Initial code to make zsh-compatible completion
-rw-r--r-- | lib/keyringer/completions/bash | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/keyringer/completions/bash b/lib/keyringer/completions/bash index a8fce92..4459b34 100644 --- a/lib/keyringer/completions/bash +++ b/lib/keyringer/completions/bash @@ -1,7 +1,12 @@ +#!bash # # Keyringer bash completion # +if [[ -n ${ZSH_VERSION-} ]]; then + autoload -U +X bashcompinit && bashcompinit +fi + # Completion for git subcommand _keyringer_git_complete() { if [ -e "/etc/bash_completion.d/git" ]; then @@ -97,11 +102,17 @@ _keyringer() { fi # Avoid annoying bell and extra tab - bind 'set show-all-if-ambiguous on' + if [ -z "$ZSH_VERSION" ]; then + bind 'set show-all-if-ambiguous on' + fi # Return the available options COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - [[ $COMPREPLY == */ ]] && compopt -o nospace + + if [ -z "$ZSH_VERSION" ]; then + [[ $COMPREPLY == */ ]] && compopt -o nospace + fi + return 0 } |