aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/keyringer/completions/bash25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/keyringer/completions/bash b/lib/keyringer/completions/bash
index 5c56d47..b255312 100644
--- a/lib/keyringer/completions/bash
+++ b/lib/keyringer/completions/bash
@@ -8,11 +8,16 @@ _keyringer() {
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/ /|/'`"
@@ -36,9 +41,29 @@ _keyringer() {
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