summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/keyringer/completions/bash/keyringer18
-rw-r--r--lib/keyringer/completions/zsh/_keyringer3
2 files changed, 17 insertions, 4 deletions
diff --git a/lib/keyringer/completions/bash/keyringer b/lib/keyringer/completions/bash/keyringer
index 875e6ab..7bfa62f 100644
--- a/lib/keyringer/completions/bash/keyringer
+++ b/lib/keyringer/completions/bash/keyringer
@@ -42,6 +42,15 @@ _keyringer_git_complete() {
fi
}
+# Path completion
+function _keyringer_path_complete() {
+ # Thanks http://unix.stackexchange.com/questions/55520/create-bash-completion-script-to-autocomplete-paths-after-is-equal-sign
+ cur=${1//\\ / }
+ [[ ${cur} == "~/"* ]] && cur=${cur/\~/$HOME}
+
+ echo ${cur}
+}
+
_keyringer() {
# Standard stuff
local cur prev command config path keyrings instances instance opts
@@ -94,10 +103,7 @@ _keyringer() {
opts="$(_keyringer_git_complete ${cur})"
;;
init)
- # Thanks http://unix.stackexchange.com/questions/55520/create-bash-completion-script-to-autocomplete-paths-after-is-equal-sign
- cur=${cur//\\ / }
- [[ ${cur} == "~/"* ]] && cur=${cur/\~/$HOME}
-
+ cur="$(_keyringer_path_complete ${cur})"
opts="$(compgen -o dirnames ${cur})"
;;
*)
@@ -115,6 +121,10 @@ _keyringer() {
# TODO
opts="$(_keyringer_git_complete ${prev} ${cur})"
;;
+ encrypt|encrypt-batch)
+ cur="$(_keyringer_path_complete ${cur})"
+ opts="$(compgen -o dirnames ${cur})"
+ ;;
*)
;;
esac
diff --git a/lib/keyringer/completions/zsh/_keyringer b/lib/keyringer/completions/zsh/_keyringer
index 119d26d..50ff433 100644
--- a/lib/keyringer/completions/zsh/_keyringer
+++ b/lib/keyringer/completions/zsh/_keyringer
@@ -77,6 +77,9 @@ _keyringer() {
git)
compadd "$@" $(_keyringer_git_complete $words[4] $words[5])
;;
+ encrypt|encrypt-batch)
+ _files
+ ;;
*)
;;
esac