Trivial cleanups.

master
Ville Skyttä 2010-07-01 20:21:35 +03:00
parent 66d3b63915
commit ff7c17e599
4 changed files with 5 additions and 5 deletions

View File

@ -310,7 +310,7 @@ __reassemble_comp_words_by_ref() {
ref="$2[$j]"
eval $2[$j]=\${!ref}\${COMP_WORDS[i]}
# Indicate new cword
[ $i = $COMP_CWORD ] && [[ ${COMP_WORDS[i]} ]] && eval $3=$j
[[ $i == $COMP_CWORD && ${COMP_WORDS[i]} ]] && eval $3=$j
done
else
# No, list of word completions separators hasn't changed;
@ -464,7 +464,7 @@ _get_cword()
# return previous word offset by $2
if [[ ${2//[^0-9]/} ]]; then
printf "%s" "${words[cword-$2]}"
elif [[ "${#words[cword]}" -eq 0 ]] || [[ "$COMP_POINT" == "${#COMP_LINE}" ]]; then
elif [[ "${#words[cword]}" -eq 0 || "$COMP_POINT" == "${#COMP_LINE}" ]]; then
printf "%s" "${words[cword]}"
else
local i

View File

@ -238,7 +238,7 @@ _cvs()
set_prefix
if [[ "$cur" != -* ]] && [ -r ${prefix:-}CVS/Entries ]; then
if [[ "$cur" != -* && -r ${prefix:-}CVS/Entries ]]; then
# if $COMP_CVS_REMOTE is not null, 'cvs commit' will
# complete on remotely checked-out files (requires
# passwordless access to the remote repository

View File

@ -58,7 +58,7 @@ _muttconffiles()
while [[ "$1" ]]; do
newconffiles=( $(sed -n 's|^source[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*$|\1|p' $(eval echo $1) ) )
for file in "${newconffiles[@]}"; do
[[ ! "$file" ]] || [[ "${sofar/ ${file} / }" != "$sofar" ]] &&
[[ ! "$file" || "${sofar/ ${file} / }" != "$sofar" ]] &&
continue
sofar="$sofar $file"
sofar=" $(eval _muttconffiles \"$sofar\" $file) "

View File

@ -21,7 +21,7 @@ _service()
[ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d
if [[ $COMP_CWORD -eq 1 ]] && [[ $prev == "service" ]]; then
if [[ $COMP_CWORD -eq 1 && $prev == "service" ]]; then
_services
else
COMPREPLY=( $( compgen -W '`sed -e "y/|/ /" \