From: Silvio Rhatto Date: Fri, 2 Aug 2013 21:49:37 +0000 (-0300) Subject: Fixing initial options on bash completion X-Git-Tag: 0.2.1~2 X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=4cfb40c605a6df4bf70bc14e2010ad78e4276324;p=keyringer.git Fixing initial options on bash completion --- diff --git a/lib/keyringer/completions/bash b/lib/keyringer/completions/bash index 0edfb1b..3c08293 100644 --- a/lib/keyringer/completions/bash +++ b/lib/keyringer/completions/bash @@ -31,20 +31,22 @@ _keyringer() { # Initial options config="$HOME/.keyringer" - opts="`ls $config | sed -e 's/config//'`" + keyrings="`ls $config | sed -e 's/config//'`" # Process config source $config/config path="`eval echo '$'$instance`" # Available instances - instances="`echo $opts | sed -e 's/ /|/'`" + instances="`echo $keyrings | sed -e 's/ /|/'`" # The current instance instance="${COMP_WORDS[1]}" # Command completions - if [ "${#COMP_WORDS[@]}" == "3" ] && echo "${prev}" | grep -qe "[$instances]"; then + if [ "${#COMP_WORDS[@]}" == "2" ]; then + opts="$keyrings" + elif [ "${#COMP_WORDS[@]}" == "3" ] && echo "${prev}" | grep -qe "[$instances]"; then opts="`keyringer $instance commands`" elif [ "${#COMP_WORDS[@]}" == "4" ]; then case "${prev}" in