Various mostly array element unsetting fixes under failglob

master
Ville Skyttä 2014-06-03 23:09:56 +03:00
parent 84135d756b
commit 1ed2377c89
9 changed files with 16 additions and 16 deletions

View File

@ -19,7 +19,7 @@ _badblocks()
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
# Filter out -w (dangerous) and -X (internal use)
for i in ${!COMPREPLY[@]}; do
[[ ${COMPREPLY[i]} == -[wX] ]] && unset COMPREPLY[i]
[[ ${COMPREPLY[i]} == -[wX] ]] && unset 'COMPREPLY[i]'
done
return 0
fi

View File

@ -18,19 +18,19 @@ _crontab()
local i
for (( i=0; i < ${#words[@]}-1; i++ )); do
[[ ${words[i]} ]] && unset opts[${words[i]}]
[[ ${words[i]} ]] && unset "opts[${words[i]}]"
case "${words[i]}" in
-l)
unset opts[-r] opts[-e] opts[-i] opts[-s]
unset 'opts[-r]' 'opts[-e]' 'opts[-i]' 'opts[-s]'
;;
-e)
unset opts[-l] opts[-r] opts[-i]
unset 'opts[-l]' 'opts[-r]' 'opts[-i]'
;;
-r)
unset opts[-l] opts[-e]
unset 'opts[-l]' 'opts[-e]'
;;
-u)
unset opts[-i]
unset 'opts[-i]'
;;
esac
done

View File

@ -156,11 +156,11 @@ _cvs()
local f
for i in ${!files[@]}; do
if [[ ${files[i]} == ?(*/)CVS ]]; then
unset files[i]
unset 'files[i]'
else
for f in "${entries[@]}"; do
if [[ ${files[i]} == $f && ! -d $f ]]; then
unset files[i]
unset 'files[i]'
break
fi
done
@ -337,7 +337,7 @@ _cvs()
if [[ "$prev" != -f ]]; then
# find out what files are missing
for i in ${!entries[@]}; do
[[ -r "${entries[i]}" ]] && unset entries[i]
[[ -r "${entries[i]}" ]] && unset 'entries[i]'
done
fi
COMPREPLY=( $( compgen -W '${entries[@]:-}' -- "$cur" ) )

View File

@ -101,7 +101,7 @@ _find()
for i in "${words[@]}"; do
[[ $i && ${onlyonce[$i]} ]] || continue
for j in ${!COMPREPLY[@]}; do
[[ ${COMPREPLY[j]} == $i ]] && unset COMPREPLY[j]
[[ ${COMPREPLY[j]} == $i ]] && unset 'COMPREPLY[j]'
done
done
fi

View File

@ -62,7 +62,7 @@ _info()
COMPREPLY=( ${COMPREPLY[@]##*/?(:)} )
# weed out info dir file
for (( i=0 ; i < ${#COMPREPLY[@]} ; ++i )); do
[[ ${COMPREPLY[$i]} == dir ]] && unset COMPREPLY[$i]
[[ ${COMPREPLY[$i]} == dir ]] && unset "COMPREPLY[$i]"
done
# strip suffix from info pages
COMPREPLY=( ${COMPREPLY[@]%.@(gz|bz2|xz|lzma)} )

View File

@ -20,7 +20,7 @@ _lvm_logicalvolumes()
_filedir
local i
for i in ${!COMPREPLY[@]}; do
[[ ${COMPREPLY[i]} == */control ]] && unset COMPREPLY[i]
[[ ${COMPREPLY[i]} == */control ]] && unset 'COMPREPLY[i]'
done
fi
}

View File

@ -84,7 +84,7 @@ _modprobe()
for i in ${!mods[@]}; do
for module in ${COMPREPLY[@]}; do
if [[ ${mods[i]} == $module ]]; then
unset mods[i]
unset 'mods[i]'
break
fi
done

View File

@ -49,7 +49,7 @@ _protoc()
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
local i
for i in ${!COMPREPLY[@]}; do
[[ ${COMPREPLY[i]} == -oFILE ]] && unset COMPREPLY[i]
[[ ${COMPREPLY[i]} == -oFILE ]] && unset 'COMPREPLY[i]'
done
[[ $COMPREPLY == *= ]] && compopt -o nospace
return

View File

@ -5,9 +5,9 @@ _qdbus()
local cur prev words cword
_init_completion || return
[[ -n $cur ]] && unset words[${#words[@]}-1]
[[ -n $cur ]] && unset "words[$((${#words[@]}-1))]"
COMPREPLY=( $( compgen -W '$( command ${words[@]} 2>/dev/null | \
sed s/\(.*\)// )' -- "$cur" ) )
sed "s/(.*)//" )' -- "$cur" ) )
} &&
complete -F _qdbus qdbus dcop