]> gitweb.fluxo.info Git - keyringer.git/commitdiff
Initial code to make zsh-compatible completion
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 17 Aug 2013 00:45:26 +0000 (21:45 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 17 Aug 2013 00:45:26 +0000 (21:45 -0300)
lib/keyringer/completions/bash

index a8fce92e934fc57e5b8f81263f3a84024924c143..4459b3407d2742bf8f0584237df8e66e35b95b68 100644 (file)
@@ -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
 }