diff options
-rw-r--r-- | lib/keyringer/completions/bash | 8 |
1 files 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 |