summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElan Ruusamäe <glen@pld-linux.org>2018-09-12 23:12:56 +0300
committerJason A. Donenfeld <Jason@zx2c4.com>2018-10-19 02:45:56 +0200
commite43b019042574d33510ca70f1f2389e414fa6102 (patch)
tree5f8da83c036aa828279fa414eb0025c2ffb65b10
parentd68d9c50db4cdba32266c52e6546f1d5181948db (diff)
downloadpass-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-completion12
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'
s/keepassx2pass.py?h=1.7.4&id=4d53be77860a35db40bf616ef4c4b5d54dabb395&follow=1'>keepassx2pass: Substitute empty string for NoneAndrew Spiers1-1/+4 2014-06-16emacs: Use PASSWORD_STORE_CLIP_TIME env variableSvend Sorensen1-4/+7 2014-06-16emacs: Use when instead of if/prognSvend Sorensen1-5/+4 2014-06-16emacs: Update pass website URLSvend Sorensen1-1/+1 2014-05-27Update for new URL.Jason A. Donenfeld3-3/+3 2014-05-14Bump version1.6.2Jason A. Donenfeld1-1/+1 2014-05-14Don't define tmpdir on git init.Jason A. Donenfeld1-4/+3 2014-05-14Disable secmem warning when discovering keysmilki2-2/+2 2014-05-10edit: Quote editor so tests work in spaced directories.Jason A. Donenfeld1-1/+1 2014-05-10reencryption: Properly escape input to sedJason A. Donenfeld1-1/+1 2014-05-10git: use secure tmp directoryJason A. Donenfeld1-4/+11 2014-05-10configure git to decrypt gpg files automaticallySamuel Le Thiec1-0/+5 2014-05-08completion: add new generate flagsJason A. Donenfeld3-2/+7 2014-05-08inplace: mutually exclusive with forceJason A. Donenfeld2-3/+3 2014-05-08usage: tab to spacesJason A. Donenfeld1-1/+1 2014-05-08generate: use nice ansi colors instead.Jason A. Donenfeld1-3/+2 2014-05-08zsh: posix compatible sed fix for zsh-completionJason A. Donenfeld1-1/+1 2014-05-07Implement interactive init functionSvend Sorensen1-0/+8 2014-05-07Implement interactive rename functionSvend Sorensen1-0/+7 2014-05-07Reorder interactive function to match order of helper functionsSvend Sorensen1-13/+13 2014-05-07Make edit helper function name consistent with other helpersSvend Sorensen1-1/+1 2014-05-07Factor out password completing-read functionSvend Sorensen1-4/+8 2014-05-07Add dash to Package-RequiresSvend Sorensen1-1/+1 2014-05-06Force sane sort order.Jason A. Donenfeld1-2/+2 2014-05-06generate: add --in-place optionJason A. Donenfeld4-9/+33