aboutsummaryrefslogtreecommitdiff
path: root/lib/keyringer/completions/bash/keyringer
diff options
context:
space:
mode:
Diffstat (limited to 'lib/keyringer/completions/bash/keyringer')
-rw-r--r--lib/keyringer/completions/bash/keyringer18
1 files changed, 14 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