password-store

Simple password manager using gpg and ordinary unix directories
git clone https://git.zx2c4.com/password-store
Log | Files | Refs | README | LICENSE

commit 206e28caa3737f87e8efb1be38294d3279cbed77
parent e1c0022255508dcb1ec3dd6dd25e1288d927d384
Author: Brian Mattern <rephorm@rephorm.com>
Date:   Sat, 22 Sep 2012 08:39:53 -0700

turn -o filenames back on

only auto-expand if there is a single completion match

Diffstat:
Mcontrib/pass.bash-completion | 16++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/contrib/pass.bash-completion b/contrib/pass.bash-completion @@ -10,15 +10,16 @@ _pass_complete_entries () { autoexpand=${1:-0} local IFS=$'\n' - for item in $(compgen -f $prefix$cur); do + local items=($(compgen -f $prefix$cur)) + for item in ${items[@]}; do if [[ $item == $prefix.* ]]; then continue fi - # append / to directories and recursively expand single-entry dirs + # append / to directories and recursively expand single-entry dir while [[ -d $item ]]; do item="$item/" - if [[ $autoexpand -eq 1 ]]; then - subitems=($(compgen -f $item)) + if [[ ${#items[@]} -eq 1 && $autoexpand -eq 1 ]]; then + local subitems=($(compgen -f $item)) if [[ ${#subitems[@]} -eq 1 ]]; then item="${subitems[0]}" else @@ -29,11 +30,6 @@ _pass_complete_entries () { fi done item="${item%$suffix}" - item="${item// /\ }" - item="${item//'/\'}" - item="${item//\(/\(}" - item="${item//)/\)}" - item="${item//&/\&}" COMPREPLY+=("${item#$prefix}") done } @@ -79,4 +75,4 @@ _pass() fi } -complete -o nospace -F _pass pass +complete -o filenames -o nospace -F _pass pass