diff options
author | Jeffrey Ratcliffe <Jeffrey.Ratcliffe@gmail.com> | 2012-09-22 09:57:08 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2012-09-22 13:14:21 +0200 |
commit | e1c0022255508dcb1ec3dd6dd25e1288d927d384 (patch) | |
tree | 451ef927541e91e6379435173db565110decf9bc /contrib/pass.bash-completion | |
parent | c2d28accf5c79c7929a90506061c70ffa70cca86 (diff) |
bash completion - Fix UTF8, escape spaces, inverted commas, brackets, and ampersands, and clean up
Diffstat (limited to 'contrib/pass.bash-completion')
-rw-r--r-- | contrib/pass.bash-completion | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/contrib/pass.bash-completion b/contrib/pass.bash-completion index 36c0cf2..71bb12a 100644 --- a/contrib/pass.bash-completion +++ b/contrib/pass.bash-completion @@ -10,7 +10,6 @@ _pass_complete_entries () { autoexpand=${1:-0} local IFS=$'\n' - local i=0 for item in $(compgen -f $prefix$cur); do if [[ $item == $prefix.* ]]; then continue @@ -30,28 +29,28 @@ _pass_complete_entries () { fi done item="${item%$suffix}" - COMPREPLY[$i]=$(printf "%q" "${item#$prefix}" ) - (( i++ )) + item="${item// /\ }" + item="${item//'/\'}" + item="${item//\(/\(}" + item="${item//)/\)}" + item="${item//&/\&}" + COMPREPLY+=("${item#$prefix}") done } _pass() { - local cur prev opts base - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - prev="${COMP_WORDS[COMP_CWORD-1]}" - - commands="init ls show insert generate edit rm git help --help version --version" + local cur="${COMP_WORDS[COMP_CWORD]}" + local commands="init ls show insert generate edit rm git help --help version --version" if [[ $COMP_CWORD -gt 1 ]]; then case "${COMP_WORDS[1]}" in init) COMPREPLY+=($(compgen -W "-e --reencrypt" -- ${cur})) - keys=$(gpg --list-keys |grep uid |sed 's/.*<\(.*\)>/\1/') + local keys=$(gpg --list-keys |grep uid |sed 's/.*<\(.*\)>/\1/') COMPREPLY+=($(compgen -W "${keys}" -- ${cur})) ;; - ls|list) + ls|list|edit) _pass_complete_entries ;; show|-*) @@ -66,9 +65,6 @@ _pass() COMPREPLY+=($(compgen -W "-n --no-symbols -c --clip -f --force" -- ${cur})) _pass_complete_entries ;; - edit) - _pass_complete_entries - ;; rm|remove|delete) COMPREPLY+=($(compgen -W "-r --recursive -f --force" -- ${cur})) _pass_complete_entries |