diff options
author | Elan Ruusamäe <glen@pld-linux.org> | 2018-09-12 23:12:56 +0300 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-10-19 02:45:56 +0200 |
commit | e43b019042574d33510ca70f1f2389e414fa6102 (patch) | |
tree | 5f8da83c036aa828279fa414eb0025c2ffb65b10 | |
parent | d68d9c50db4cdba32266c52e6546f1d5181948db (diff) | |
download | pass-e43b019042574d33510ca70f1f2389e414fa6102.tar.gz pass-e43b019042574d33510ca70f1f2389e414fa6102.tar.bz2 pass-e43b019042574d33510ca70f1f2389e414fa6102.zip |
bash_completion: do not leak variables to globals scope
Signed-off-by: Elan Ruusamäe <glen@pld-linux.org>
Diffstat (limited to '')
-rw-r--r-- | src/completion/pass.bash-completion | 12 |
1 files changed, 6 insertions, 6 deletions
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' |