COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
+ command="${COMP_WORDS[2]}"
# Initial options
config="$HOME/.keyringer"
opts="`ls $config | sed -e 's/config//'`"
+ # Process config
+ source $config/config
+ path="`eval echo '$'$instance`"
+
# Available instances
instances="`echo $opts | sed -e 's/ /|/'`"
genpair)
opts="gpg ssh ssl ssl-self"
;;
+ git)
+ # TODO: This depends on git's bash completion
+ ;;
+ *)
+ ;;
+ esac
+ elif [ "${#COMP_WORDS[@]}" == "5" ]; then
+ case "${command}" in
+ recipients)
+ opts="$(cd $path/config/recipients && ls -p ${cur}* 2> /dev/null)"
+ ;;
+ genpair)
+ opts="$(bash -c "set -f && keyringer $instance ls -p -d ${cur}*" 2> /dev/null)"
+ ;;
+ git)
+ # TODO: This depends on git's bash completion
+ ;;
*)
;;
esac
+ elif [ "${command}" == "git" ]; then
+ # TODO: This depends on git's bash completion
+ true
fi
# Avoid annoying bell and extra tab