From e43b019042574d33510ca70f1f2389e414fa6102 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 12 Sep 2018 23:12:56 +0300 Subject: bash_completion: do not leak variables to globals scope MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Elan Ruusamäe --- src/completion/pass.bash-completion | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/completion/pass.bash-completion') diff --git a/src/completion/pass.bash-completion b/src/completion/pass.bash-completion index bbe9d0c..08f3401 100644 --- a/src/completion/pass.bash-completion +++ b/src/completion/pass.bash-completion @@ -5,10 +5,10 @@ # This file is licensed under the GPLv2+. Please see COPYING for more information. _pass_complete_entries () { - prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store/}" + local prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store/}" prefix="${prefix%/}/" - suffix=".gpg" - autoexpand=${1:-0} + local suffix=".gpg" + local autoexpand=${1:-0} local IFS=$'\n' local items=($(compgen -f $prefix$cur)) @@ -17,7 +17,7 @@ _pass_complete_entries () { # it is a directory, then don't add a space to the completion local firstitem="" # Use counter, can't use ${#items[@]} as we skip hidden directories - local i=0 + local i=0 item for item in ${items[@]}; do [[ $item =~ /\.[^/]*$ ]] && continue @@ -27,7 +27,7 @@ _pass_complete_entries () { if [[ ${#items[@]} -eq 1 && $autoexpand -eq 1 ]]; then while [[ -d $item ]]; do local subitems=($(compgen -f "$item/")) - local filtereditems=( ) + local filtereditems=( ) item2 for item2 in "${subitems[@]}"; do [[ $item2 =~ /\.[^/]*$ ]] && continue filtereditems+=( "$item2" ) @@ -59,7 +59,7 @@ _pass_complete_entries () { } _pass_complete_folders () { - prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store/}" + local prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store/}" prefix="${prefix%/}/" local IFS=$'\n' -- cgit v1.2.3