aboutsummaryrefslogtreecommitdiff
path: root/lib/keyringer/completions/zsh
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-09-29 18:43:10 -0300
committerSilvio Rhatto <rhatto@riseup.net>2013-09-29 18:43:10 -0300
commitd9d0c1fdec1a1beebba75e00af7af6f9adc94535 (patch)
tree91f5a2b2cd2a2a3d804b1ef702b70be6cccb058d /lib/keyringer/completions/zsh
parentbdbf214658446e0821e67a5e58695df0881247b6 (diff)
downloadkeyringer-d9d0c1fdec1a1beebba75e00af7af6f9adc94535.tar.gz
keyringer-d9d0c1fdec1a1beebba75e00af7af6f9adc94535.tar.bz2
Shell completion: adding 'init' subcommand
Diffstat (limited to 'lib/keyringer/completions/zsh')
-rw-r--r--lib/keyringer/completions/zsh/_keyringer12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/keyringer/completions/zsh/_keyringer b/lib/keyringer/completions/zsh/_keyringer
index 47a83fc..119d26d 100644
--- a/lib/keyringer/completions/zsh/_keyringer
+++ b/lib/keyringer/completions/zsh/_keyringer
@@ -20,8 +20,9 @@ _keyringer() {
# Process config
source $config/config
- local keyrings="`ls --color=never $config | sed -e 's/config//'`"
+ local keyrings="`ls --color=never $config | sed -e 's/config//' | xargs`"
local keyring_path="`eval echo '$'$words[2]`"
+ local instances="`echo $keyrings | sed -e 's/ /\\\|/g'`"
_arguments \
'1: :->keyring' \
@@ -35,7 +36,11 @@ _keyringer() {
_arguments "1:Keyrings:($keyrings)"
;;
action)
- compadd "$@" `KEYRINGER_CHECK_VERSION=false keyringer $words[2] commands`
+ if echo $words[2] | grep -qe "$instances"; then
+ compadd "$@" `KEYRINGER_CHECK_VERSION=false keyringer $words[2] commands`
+ else
+ compadd "$@" "init"
+ fi
;;
options)
case $words[3] in
@@ -54,6 +59,9 @@ _keyringer() {
git)
compadd "$@" $(_keyringer_git_complete $words[4])
;;
+ init)
+ _files
+ ;;
*)
;;
esac