summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-07-18 18:11:23 -0300
committerSilvio Rhatto <rhatto@riseup.net>2013-07-18 18:11:23 -0300
commit5e6cad5498cb03a4844ef4e65fba49f1ce3439e1 (patch)
tree70d73b9a935ee766fd7a55bfa4c4389b8a645102 /lib
parent441132430b4b45030b0a01603c6a1d3b16122b06 (diff)
downloadkeyringer-5e6cad5498cb03a4844ef4e65fba49f1ce3439e1.tar.gz
keyringer-5e6cad5498cb03a4844ef4e65fba49f1ce3439e1.tar.bz2
More on bash completion
Diffstat (limited to 'lib')
-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