diff options
author | Brian Mattern <rephorm@rephorm.com> | 2012-09-22 08:39:53 -0700 |
---|---|---|
committer | Brian Mattern <rephorm@rephorm.com> | 2012-09-22 08:39:53 -0700 |
commit | 206e28caa3737f87e8efb1be38294d3279cbed77 (patch) | |
tree | 4e639ff0a69982e39629bec4027cc534431dea35 /contrib/pass.bash-completion | |
parent | e1c0022255508dcb1ec3dd6dd25e1288d927d384 (diff) | |
download | pass-206e28caa3737f87e8efb1be38294d3279cbed77.tar.gz pass-206e28caa3737f87e8efb1be38294d3279cbed77.tar.bz2 pass-206e28caa3737f87e8efb1be38294d3279cbed77.zip |
turn -o filenames back on
only auto-expand if there is a single completion match
Diffstat (limited to 'contrib/pass.bash-completion')
-rw-r--r-- | contrib/pass.bash-completion | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/contrib/pass.bash-completion b/contrib/pass.bash-completion index 71bb12a..a7d0f28 100644 --- 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 |