From 74e4ea941bb61d9e830ae9d2a7cfe690c2df34f0 Mon Sep 17 00:00:00 2001 From: Jeffrey Ratcliffe Date: Wed, 19 Sep 2012 07:29:24 +0200 Subject: Fixed bash completion for files with spaces --- contrib/pass.bash-completion | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'contrib/pass.bash-completion') diff --git a/contrib/pass.bash-completion b/contrib/pass.bash-completion index 8ddc377..85a2da8 100644 --- a/contrib/pass.bash-completion +++ b/contrib/pass.bash-completion @@ -5,7 +5,7 @@ _pass() { - local cur prev prefix suffix gen + local cur prev prefix suffix COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" @@ -16,6 +16,8 @@ _pass() return 0 fi + local IFS=$'\n' + local i=0 for item in $(compgen -f $prefix$cur); do if [[ $item == $prefix.* ]]; then continue @@ -24,9 +26,8 @@ _pass() item="$item/" fi item="${item%$suffix}" - gen="$gen ${item#$prefix}" + COMPREPLY[$i]="${item#$prefix}" + (( i++ )) done - - COMPREPLY=( $gen ) } complete -o filenames -o nospace -F _pass pass -- cgit v1.2.3