From 4cfb40c605a6df4bf70bc14e2010ad78e4276324 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 2 Aug 2013 18:49:37 -0300 Subject: Fixing initial options on bash completion --- lib/keyringer/completions/bash | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 -- cgit v1.2.3