From 173919ec88dea13bbe1ede2dd5ffa9820c7b4cb5 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 12 Dec 2016 11:40:51 +1300 Subject: Add some missing "local" calls --- bash/bash_completion.d/_text_filenames.bash | 1 + bash/bash_completion.d/eds.bash | 1 + bash/bash_completion.d/find.bash | 2 ++ bash/bash_completion.d/keep.bash | 2 ++ bash/bash_completion.d/kill.bash | 1 + bash/bash_completion.d/make.bash | 1 + bash/bash_completion.d/man.bash | 1 + bash/bash_completion.d/sd.bash | 1 + bash/bash_completion.d/td.bash | 1 + 9 files changed, 11 insertions(+) (limited to 'bash') diff --git a/bash/bash_completion.d/_text_filenames.bash b/bash/bash_completion.d/_text_filenames.bash index 37684fdf..09d831a5 100644 --- a/bash/bash_completion.d/_text_filenames.bash +++ b/bash/bash_completion.d/_text_filenames.bash @@ -8,6 +8,7 @@ # the thing I want, and I want it to stay fast. # _text_filenames() { + local item while IFS= read -r item ; do # Exclude blanks diff --git a/bash/bash_completion.d/eds.bash b/bash/bash_completion.d/eds.bash index 3829e157..58ecf402 100644 --- a/bash/bash_completion.d/eds.bash +++ b/bash/bash_completion.d/eds.bash @@ -4,6 +4,7 @@ _eds() { local edspath edspath=${EDSPATH:-"$HOME"/.local/bin} [[ -d $edspath ]] || return + local executable while IFS= read -rd '' executable ; do [[ -n $executable ]] || continue COMPREPLY[${#COMPREPLY[@]}]=$executable diff --git a/bash/bash_completion.d/find.bash b/bash/bash_completion.d/find.bash index 74dc17ad..007a83bd 100644 --- a/bash/bash_completion.d/find.bash +++ b/bash/bash_completion.d/find.bash @@ -7,6 +7,7 @@ _find() { # Backtrack through words so far; if none of them look like options, we're # still completing directory names + local i local -i opts for ((i = COMP_CWORD; i >= 0; i--)) ; do case ${COMP_WORDS[i]} in @@ -26,6 +27,7 @@ _find() { compopt -o bashdefault -o default # Iterate through whatever the subshell gives us; don't add blank items, though + local item while read -r item ; do [[ -n $item ]] || continue COMPREPLY[${#COMPREPLY[@]}]=$item diff --git a/bash/bash_completion.d/keep.bash b/bash/bash_completion.d/keep.bash index 41423af0..7148ad2b 100644 --- a/bash/bash_completion.d/keep.bash +++ b/bash/bash_completion.d/keep.bash @@ -25,6 +25,7 @@ _keep() { # Complete with appropriate mode case $mode in names) + local word while IFS= read -r word ; do [[ -n $word ]] || continue COMPREPLY[${#COMPREPLY[@]}]=$word @@ -32,6 +33,7 @@ _keep() { -- "${COMP_WORDS[COMP_CWORD]}") ;; kept) + local word while IFS= read -r word ; do [[ -n $word ]] || continue COMPREPLY[${#COMPREPLY[@]}]=$word diff --git a/bash/bash_completion.d/kill.bash b/bash/bash_completion.d/kill.bash index 0aca041f..dccc926b 100644 --- a/bash/bash_completion.d/kill.bash +++ b/bash/bash_completion.d/kill.bash @@ -1,6 +1,7 @@ # Complete kill builtin with jobspecs (prefixed with % so it will accept them) # and this user's PIDs (requires pgrep(1)) _kill() { + local pid while read -r pid ; do case $pid in "${COMP_WORDS[COMP_CWORD]}"*) diff --git a/bash/bash_completion.d/make.bash b/bash/bash_completion.d/make.bash index 67c577f3..b3314e21 100644 --- a/bash/bash_completion.d/make.bash +++ b/bash/bash_completion.d/make.bash @@ -10,6 +10,7 @@ _make() { [[ -n $mf ]] || return 1 # Iterate through the Makefile, line by line + local line while IFS= read -r line ; do case $line in diff --git a/bash/bash_completion.d/man.bash b/bash/bash_completion.d/man.bash index 7d25fdd2..efc93153 100644 --- a/bash/bash_completion.d/man.bash +++ b/bash/bash_completion.d/man.bash @@ -24,6 +24,7 @@ _man() { # Read completion results from a subshell and add them to the COMPREPLY # array individually + local page while IFS= read -rd '' page ; do [[ -n $page ]] || continue COMPREPLY[${#COMPREPLY[@]}]=$page diff --git a/bash/bash_completion.d/sd.bash b/bash/bash_completion.d/sd.bash index 0c59f544..aeee1615 100644 --- a/bash/bash_completion.d/sd.bash +++ b/bash/bash_completion.d/sd.bash @@ -8,6 +8,7 @@ _sd() { [[ $PWD != / ]] || return 1 # Build list of matching sibiling directories + local dirname while IFS= read -rd '' dirname ; do [[ -n $dirname ]] || continue COMPREPLY[${#COMPREPLY[@]}]=$dirname diff --git a/bash/bash_completion.d/td.bash b/bash/bash_completion.d/td.bash index 6d995d0e..eb29992b 100644 --- a/bash/bash_completion.d/td.bash +++ b/bash/bash_completion.d/td.bash @@ -2,6 +2,7 @@ _td() { local dir dir=${TODO_DIR:-"$HOME"/Todo} + local fn while IFS= read -rd '' fn ; do COMPREPLY[${#COMPREPLY[@]}]=$fn done < <( -- cgit v1.2.3