summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVille Skyttä <ville.skytta@iki.fi>2011-04-06 20:39:21 +0300
committerVille Skyttä <ville.skytta@iki.fi>2011-04-06 20:39:21 +0300
commitee43b22f9b8834cd952377f46ca07790c1a504ef (patch)
tree2970e55ccbcbcc254b64c0eae69c27b6c9f78743
parente31f021470f15e57fdf52889d040a28bda81f4e2 (diff)
downloadbash-completion-ee43b22f9b8834cd952377f46ca07790c1a504ef.tar.gz
Use += to append to arrays and strings.
It's easier on the eye and faster than foo=( "${foo[@]}" ... ).
-rw-r--r--CHANGES2
-rw-r--r--bash_completion64
-rw-r--r--completions/_subversion6
-rw-r--r--completions/aspell2
-rw-r--r--completions/bash-builtins2
-rw-r--r--completions/bluez4
-rw-r--r--completions/crontab4
-rw-r--r--completions/cvs8
-rw-r--r--completions/findutils3
-rw-r--r--completions/gpg2
-rw-r--r--completions/gpg22
-rw-r--r--completions/iproute24
-rw-r--r--completions/java13
-rw-r--r--completions/lintian21
-rw-r--r--completions/mplayer3
-rw-r--r--completions/mutt9
-rw-r--r--completions/mysqladmin2
-rw-r--r--completions/openldap2
-rw-r--r--completions/openssl4
-rw-r--r--completions/perl6
-rw-r--r--completions/portupgrade2
-rw-r--r--completions/puppet15
-rw-r--r--completions/rcs2
-rw-r--r--completions/rdesktop6
-rw-r--r--completions/ri4
-rw-r--r--completions/rpm2
-rw-r--r--completions/smartctl6
-rw-r--r--completions/ssh14
-rw-r--r--completions/svk2
-rw-r--r--completions/sysbench4
-rw-r--r--completions/wireless-tools6
-rw-r--r--completions/wodim6
-rw-r--r--completions/xm2
33 files changed, 108 insertions, 126 deletions
diff --git a/CHANGES b/CHANGES
index 8b542138..ccd1204b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -7,7 +7,7 @@ bash-completion (2.x)
* Drop rpm query support for rpm < 4.1.
* Split rpm and rpmbuild completions and improve them both.
* Add $_backup_glob for matching various backup files.
- * Load speedups.
+ * Load and general speedups.
[ Guillaume Rousse ]
* added puppet completion, using work from Mathieu Parent (sathieudebian.org)
diff --git a/bash_completion b/bash_completion
index 8e31d61f..2b89abf5 100644
--- a/bash_completion
+++ b/bash_completion
@@ -653,7 +653,7 @@ _filedir()
local quoted tmp
_quote_readline_by_ref "$cur" quoted
- toks=( ${toks[@]-} $(
+ toks=( $(
compgen -d -- "$quoted" | {
while read -r tmp; do
# TODO: I have removed a "[ -n $tmp ] &&" before 'printf ..',
@@ -671,16 +671,16 @@ _filedir()
[[ ${BASH_VERSINFO[0]} -ge 4 ]] && \
xspec=${1:+"!*.@($1|${1^^})"} || \
xspec=${1:+"!*.@($1|$(printf %s $1 | tr '[:lower:]' '[:upper:]'))"}
- toks=( ${toks[@]-} $( compgen -f -X "$xspec" -- $quoted) )
+ toks+=( $( compgen -f -X "$xspec" -- $quoted ) )
fi
# If the filter failed to produce anything, try without it
[[ -n "$1" && "$1" != -d && ${#toks[@]} -lt 1 ]] && \
- toks=( ${toks[@]-} $( compgen -f -- $quoted ) )
+ toks+=( $( compgen -f -- $quoted ) )
[ ${#toks[@]} -ne 0 ] && _compopt_o_filenames
- COMPREPLY=( "${COMPREPLY[@]}" "${toks[@]}" )
+ COMPREPLY+=( "${toks[@]}" )
} # _filedir()
@@ -734,16 +734,16 @@ _mac_addresses()
local PATH="$PATH:/sbin:/usr/sbin"
# Local interfaces (Linux only?)
- COMPREPLY=( "${COMPREPLY[@]}" $( ifconfig -a 2>/dev/null | sed -ne \
+ COMPREPLY+=( $( ifconfig -a 2>/dev/null | sed -ne \
"s/.*[[:space:]]HWaddr[[:space:]]\{1,\}\($re\)[[:space:]]*$/\1/p" ) )
# ARP cache
- COMPREPLY=( "${COMPREPLY[@]}" $( arp -an 2>/dev/null | sed -ne \
+ COMPREPLY+=( $( arp -an 2>/dev/null | sed -ne \
"s/.*[[:space:]]\($re\)[[:space:]].*/\1/p" -ne \
"s/.*[[:space:]]\($re\)[[:space:]]*$/\1/p" ) )
# /etc/ethers
- COMPREPLY=( "${COMPREPLY[@]}" $( sed -ne \
+ COMPREPLY+=( $( sed -ne \
"s/^[[:space:]]*\($re\)[[:space:]].*/\1/p" /etc/ethers 2>/dev/null ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
@@ -869,7 +869,7 @@ __expand_tilde_by_ref() {
_expand()
{
# FIXME: Why was this here?
- #[ "$cur" != "${cur%\\}" ] && cur="$cur\\"
+ #[ "$cur" != "${cur%\\}" ] && cur+="\\"
# Expand ~username type directory specifications. We want to expand
# ~foo/... to /home/foo/... to avoid problems when $cur starting with
@@ -975,8 +975,7 @@ _services()
COMPREPLY=( $( printf '%s\n' $sysvdir/!($_backup_glob|functions) ) )
if [ -d $famdir ]; then
- COMPREPLY=( "${COMPREPLY[@]}" $( printf '%s\n' \
- $famdir/!($_backup_glob) ) )
+ COMPREPLY+=( $( printf '%s\n' $famdir/!($_backup_glob) ) )
fi
COMPREPLY=( $( compgen -W '${COMPREPLY[@]#@($sysvdir|$famdir)/}' -- "$cur" ) )
@@ -1081,7 +1080,7 @@ _allowed_groups()
#
_shells()
{
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
+ COMPREPLY+=( $( compgen -W \
'$( command grep "^[[:space:]]*/" /etc/shells 2>/dev/null )' \
-- "$cur" ) )
}
@@ -1106,7 +1105,7 @@ _fstypes()
fi
[ -n "$fss" ] && \
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$fss" -- "$cur" ) )
+ COMPREPLY+=( $( compgen -W "$fss" -- "$cur" ) )
}
# Get real command.
@@ -1162,7 +1161,7 @@ _count_args()
#
_pci_ids()
{
- COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W \
+ COMPREPLY+=( $( compgen -W \
"$( PATH="$PATH:/sbin" lspci -n | awk '{print $3}')" -- "$cur" ) )
}
@@ -1170,22 +1169,20 @@ _pci_ids()
#
_usb_ids()
{
- COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W \
+ COMPREPLY+=( $( compgen -W \
"$( PATH="$PATH:/sbin" lsusb | awk '{print $6}' )" -- "$cur" ) )
}
# CD device names
_cd_devices()
{
- COMPREPLY=( "${COMPREPLY[@]}"
- $( compgen -f -d -X "!*/?([amrs])cd*" -- "${cur:-/dev/}" ) )
+ COMPREPLY+=( $( compgen -f -d -X "!*/?([amrs])cd*" -- "${cur:-/dev/}" ) )
}
# DVD device names
_dvd_devices()
{
- COMPREPLY=( "${COMPREPLY[@]}"
- $( compgen -f -d -X "!*/?(r)dvd*" -- "${cur:-/dev/}" ) )
+ COMPREPLY+=( $( compgen -f -d -X "!*/?(r)dvd*" -- "${cur:-/dev/}" ) )
}
# start of section containing completion functions for external programs
@@ -1223,7 +1220,7 @@ _known_hosts()
# NOTE: Using `_known_hosts' as a helper function and passing options
# to `_known_hosts' is deprecated: Use `_known_hosts_real' instead.
[[ "$1" == -a || "$2" == -a ]] && options=-a
- [[ "$1" == -c || "$2" == -c ]] && options="$options -c"
+ [[ "$1" == -c || "$2" == -c ]] && options+=" -c"
_known_hosts_real $options "$(_get_cword :)"
} # _known_hosts()
@@ -1265,11 +1262,11 @@ _known_hosts_real()
# ssh config files
if [ -n "$configfile" ]; then
[ -r "$configfile" ] &&
- config=( "${config[@]}" "$configfile" )
+ config+=( "$configfile" )
else
for i in /etc/ssh/ssh_config "${HOME}/.ssh/config" \
"${HOME}/.ssh2/config"; do
- [ -r $i ] && config=( "${config[@]}" "$i" )
+ [ -r $i ] && config+=( "$i" )
done
fi
@@ -1287,7 +1284,7 @@ _known_hosts_real()
i=${i//\"}
# Eval/expand possible `~' or `~user'
__expand_tilde_by_ref i
- [ -r "$i" ] && kh=( "${kh[@]}" "$i" )
+ [ -r "$i" ] && kh+=( "$i" )
done
IFS=$OIFS
fi
@@ -1297,10 +1294,10 @@ _known_hosts_real()
for i in /etc/ssh/ssh_known_hosts /etc/ssh/ssh_known_hosts2 \
/etc/known_hosts /etc/known_hosts2 ~/.ssh/known_hosts \
~/.ssh/known_hosts2; do
- [ -r $i ] && kh=( "${kh[@]}" $i )
+ [ -r $i ] && kh+=( $i )
done
for i in /etc/ssh2/knownhosts ~/.ssh2/hostkeys; do
- [ -d $i ] && khd=( "${khd[@]}" $i/*pub )
+ [ -d $i ] && khd+=( $i/*pub )
done
fi
@@ -1327,7 +1324,7 @@ _known_hosts_real()
if [ ${#kh[@]} -gt 0 ]; then
# FS needs to look for a comma separated list
- COMPREPLY=( "${COMPREPLY[@]}" $( awk 'BEGIN {FS=","}
+ COMPREPLY+=( $( awk 'BEGIN {FS=","}
/^\s*[^|\#]/ {for (i=1; i<=2; ++i) { \
sub(" .*$", "", $i); \
sub("^\\[", "", $i); sub("\\](:[0-9]+)?$", "", $i); \
@@ -1343,7 +1340,7 @@ _known_hosts_real()
if [[ "$i" == *key_22_$curd*.pub && -r "$i" ]]; then
host=${i/#*key_22_/}
host=${host/%.pub/}
- COMPREPLY=( "${COMPREPLY[@]}" $host )
+ COMPREPLY+=( $host )
fi
done
fi
@@ -1357,7 +1354,7 @@ _known_hosts_real()
# append any available aliases from config files
if [[ ${#config[@]} -gt 0 && -n "$aliases" ]]; then
local hosts=$( sed -ne 's/^[ \t]*[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\{0,1\}['"$'\t '"']\{1,\}\([^#*?]*\)\(#.*\)\{0,1\}$/\2/p' "${config[@]}" )
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -P "$prefix$user" \
+ COMPREPLY+=( $( compgen -P "$prefix$user" \
-S "$suffix" -W "$hosts" -- "$cur" ) )
fi
@@ -1369,8 +1366,7 @@ _known_hosts_real()
# if it contains ";", it may mistify the result. But on Gentoo (at
# least), -k wasn't available (even if mentioned in the manpage) some
# time ago, so...
- COMPREPLY=( "${COMPREPLY[@]}" $( \
- compgen -P "$prefix$user" -S "$suffix" -W \
+ COMPREPLY+=( $( compgen -P "$prefix$user" -S "$suffix" -W \
"$( avahi-browse -cpr _workstation._tcp 2>/dev/null | \
awk -F';' '/^=/ { print $7 }' | sort -u )" -- "$cur" ) )
fi
@@ -1378,7 +1374,7 @@ _known_hosts_real()
# Add results of normal hostname completion, unless
# `COMP_KNOWN_HOSTS_WITH_HOSTFILE' is set to an empty value.
if [ -n "${COMP_KNOWN_HOSTS_WITH_HOSTFILE-1}" ]; then
- COMPREPLY=( "${COMPREPLY[@]}"
+ COMPREPLY+=(
$( compgen -A hostname -P "$prefix$user" -S "$suffix" -- "$cur" ) )
fi
@@ -1422,7 +1418,7 @@ _cd()
k="${#COMPREPLY[@]}"
for j in $( compgen -d $i/$cur ); do
if [[ ( $mark_symdirs && -h $j || $mark_dirs && ! -h $j ) && ! -d ${j#$i/} ]]; then
- j="${j}/"
+ j+="/"
fi
COMPREPLY[k++]=${j#$i/}
done
@@ -1620,7 +1616,7 @@ _filedir_xspec()
local -a toks
local tmp
- toks=( ${toks[@]-} $(
+ toks=( $(
compgen -d -- "$(quote_readline "$cur")" | {
while read -r tmp; do
# see long TODO comment in _filedir() --David
@@ -1640,7 +1636,7 @@ _filedir_xspec()
xspec="$matchop($xspec|${xspec^^})" || \
xspec="$matchop($xspec|$(printf %s $xspec | tr '[:lower:]' '[:upper:]'))"
- toks=( ${toks[@]-} $(
+ toks+=( $(
eval compgen -f -X "!$xspec" -- "\$(quote_readline "\$cur")" | {
while read -r tmp; do
[ -n $tmp ] && printf '%s\n' $tmp
@@ -1661,7 +1657,7 @@ list=( $( sed -ne '/^# START exclude/,/^# FINISH exclude/p' "$BASH_COMPLETION" |
line=${line%# START exclude*}
line=${line%# FINISH exclude*}
line=${line##*\'}
- list=( "${list[@]}" $line )
+ list+=( $line )
done
printf '%s ' "${list[@]}"
)
diff --git a/completions/_subversion b/completions/_subversion
index 753831a2..96e2aa0c 100644
--- a/completions/_subversion
+++ b/completions/_subversion
@@ -202,7 +202,7 @@ _svn()
--non-interactive --diff3-cmd --ignore-externals'
;;
esac
- options="$options --help -h --config-dir"
+ options+=" --help -h --config-dir"
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
else
@@ -276,7 +276,7 @@ _svnadmin()
;;
esac
- options="$options --help -h"
+ options+=" --help -h"
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
else
if [[ "$command" == @(help|h|\?) ]]; then
@@ -335,7 +335,7 @@ _svnlook()
;;
esac
- options="$options --help -h"
+ options+=" --help -h"
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
else
if [[ "$command" == @(help|h|\?) ]]; then
diff --git a/completions/aspell b/completions/aspell
index 491967e1..62c16d0c 100644
--- a/completions/aspell
+++ b/completions/aspell
@@ -11,7 +11,7 @@ _aspell_dictionary()
COMPREPLY=( ${COMPREPLY[@]%.alias} )
COMPREPLY=( ${COMPREPLY[@]#$datadir/} )
# Then, add the canonical dicts
- COMPREPLY=( "${COMPREPLY[@]}" $( aspell dicts 2>/dev/null ) )
+ COMPREPLY+=( $( aspell dicts 2>/dev/null ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
}
diff --git a/completions/bash-builtins b/completions/bash-builtins
index 6ceb7f8a..22229c37 100644
--- a/completions/bash-builtins
+++ b/completions/bash-builtins
@@ -111,7 +111,7 @@ _complete()
if [[ "$cur" == -* ]]; then
# relevant options completion
local opts="-a -b -c -d -e -f -g -j -k -o -s -u -v -A -G -W -P -S -X"
- [[ $1 != compgen ]] && opts="$opts -F -C"
+ [[ $1 != compgen ]] && opts+=" -F -C"
COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) )
else
COMPREPLY=( $( compgen -A command -- "$cur" ) )
diff --git a/completions/bluez b/completions/bluez
index 029d67b0..4b494d34 100644
--- a/completions/bluez
+++ b/completions/bluez
@@ -5,14 +5,14 @@ have hcitool || return
_bluetooth_adresses()
{
if [ -n "${COMP_BLUETOOTH_SCAN:-}" ]; then
- COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "$( hcitool scan | \
+ COMPREPLY+=( $( compgen -W "$( hcitool scan | \
awk '/^\t/{print $1}' )" -- "$cur" ) )
fi
}
_bluetooth_devices()
{
- COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "$( hcitool dev | \
+ COMPREPLY+=( $( compgen -W "$( hcitool dev | \
awk '/^\t/{print $1}' )" -- "$cur" ) )
}
diff --git a/completions/crontab b/completions/crontab
index e1adc7b9..a10d2b43 100644
--- a/completions/crontab
+++ b/completions/crontab
@@ -16,8 +16,8 @@ _crontab()
esac
local i opts=" -u -l -r -e" # leading space at start is significant...
- [[ $OSTYPE == *linux* ]] && opts="$opts -i"
- [ -e /etc/selinux ] && opts="$opts -s"
+ [[ $OSTYPE == *linux* ]] && opts+=" -i"
+ [ -e /etc/selinux ] && opts+=" -s"
for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
case "${COMP_WORDS[i]}" in
-l)
diff --git a/completions/cvs b/completions/cvs
index 09c38841..ec6c344a 100644
--- a/completions/cvs
+++ b/completions/cvs
@@ -49,8 +49,8 @@ _cvs_roots()
local -a cvsroots
cvsroots=( $CVSROOT )
[ -r ~/.cvspass ] && \
- cvsroots=( "${cvsroots[@]}" $( awk '{ print $2 }' ~/.cvspass ) )
- [ -r CVS/Root ] && cvsroots=( "${cvsroots[@]}" $(cat CVS/Root) )
+ cvsroots+=( $( awk '{ print $2 }' ~/.cvspass ) )
+ [ -r CVS/Root ] && cvsroots+=( $( cat CVS/Root ) )
COMPREPLY=( $( compgen -W '${cvsroots[@]}' -- "$cur" ) )
__ltrim_colon_completions "$cur"
}
@@ -136,7 +136,7 @@ _cvs()
;;
esac
elif [[ "$i" = -* ]]; then
- flags=( "${flags[@]}" $i )
+ flags+=( $i )
fi
count=$((++count))
done
@@ -306,7 +306,7 @@ _cvs()
get_entries
# find out what files are missing
for i in "${entries[@]}"; do
- [ ! -r "$i" ] && miss=( "${miss[@]}" $i )
+ [ ! -r "$i" ] && miss+=( $i )
done
COMPREPLY=( $(compgen -W '${miss[@]:-}' -- "$cur") )
fi
diff --git a/completions/findutils b/completions/findutils
index 0eb53721..d6e06b11 100644
--- a/completions/findutils
+++ b/completions/findutils
@@ -24,8 +24,7 @@ _find()
-fstype)
_fstypes
[[ $OSTYPE == *bsd* ]] && \
- COMPREPLY=( "${COMPREPLY[@]}" \
- $( compgen -W 'local rdonly' -- "$cur" ) )
+ COMPREPLY+=( $( compgen -W 'local rdonly' -- "$cur" ) )
return 0
;;
-gid)
diff --git a/completions/gpg b/completions/gpg
index 478bfce6..86ff14b5 100644
--- a/completions/gpg
+++ b/completions/gpg
@@ -25,7 +25,7 @@ _gpg()
COMPREPLY=( $( compgen -W "$( gpg --list-keys 2>/dev/null | \
sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ))
if [ -e ~/.gnupg/gpg.conf ]; then
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$( sed -ne \
+ COMPREPLY+=( $( compgen -W "$( sed -ne \
's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' \
~/.gnupg/gpg.conf )" -- "$cur") )
fi
diff --git a/completions/gpg2 b/completions/gpg2
index c1d4877d..df808257 100644
--- a/completions/gpg2
+++ b/completions/gpg2
@@ -29,7 +29,7 @@ _gpg2()
COMPREPLY=( $( compgen -W "$( gpg2 --list-keys 2>/dev/null | \
sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ))
if [ -e ~/.gnupg/gpg.conf ]; then
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$( sed -ne \
+ COMPREPLY+=( $( compgen -W "$( sed -ne \
's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' \
~/.gnupg/gpg.conf)" -- "$cur"))
fi
diff --git a/completions/iproute2 b/completions/iproute2
index 2ca6adbc..2a705433 100644
--- a/completions/iproute2
+++ b/completions/iproute2
@@ -40,7 +40,7 @@ _ip()
-*)
local c="-Version -statistics -details -resolve -family
-oneline -timestamp -batch -rcvbuf"
- [[ $cword -eq 1 ]] && c="$c -force"
+ [[ $cword -eq 1 ]] && c+=" -force"
COMPREPLY=( $( compgen -W "$c" -- "$cur" ) )
return 0
;;
@@ -92,7 +92,7 @@ _ip()
local c="arp dynamic multicast allmulticast
promisc trailers txqueuelen name address
broadcast mtu netns alias"
- [[ $prev != @(up|down) ]] && c="$c up down"
+ [[ $prev != @(up|down) ]] && c+=" up down"
COMPREPLY=( $( compgen -W "$c" -- "$cur" ) )
;;
esac
diff --git a/completions/java b/completions/java
index a98d8dba..87bfb29f 100644
--- a/completions/java
+++ b/completions/java
@@ -63,17 +63,16 @@ _java_classes()
for i in ${classpath//:/ }; do
if [[ "$i" == *.@(jar|zip) && -r $i ]]; then
if type zipinfo &>/dev/null; then
- COMPREPLY=( "${COMPREPLY[@]}" $( zipinfo -1 \
- "$i" "$cur*" 2>/dev/null | \
+ COMPREPLY+=( $( zipinfo -1 "$i" "$cur*" 2>/dev/null | \
command grep '^[^$]*\.class$' ) )
else
- COMPREPLY=( "${COMPREPLY[@]}" $( jar tf "$i" \
- "$cur" | command grep '^[^$]*\.class$' ) )
+ COMPREPLY+=( $( jar tf "$i" "$cur" | \
+ command grep '^[^$]*\.class$' ) )
fi
elif [ -d $i ]; then
compopt -o nospace &>/dev/null
- COMPREPLY=( "${COMPREPLY[@]}"
+ COMPREPLY+=(
$( compgen -d -- "$i/$cur" | sed -e "s|^$i/\(.*\)|\1.|" )
$( compgen -f -X '!*.class' -- "$i/$cur" | \
sed -e '/\$/d' -e "s|^$i/||" )
@@ -106,8 +105,8 @@ _java_packages()
# parse each sourcepath element for packages
for i in ${sourcepath//:/ }; do
if [ -d $i ]; then
- COMPREPLY=( "${COMPREPLY[@]}" $( command ls -F -d \
- $i/$cur* 2>/dev/null | sed -e 's|^'$i'/||' ) )
+ COMPREPLY+=( $( command ls -F -d $i/$cur* 2>/dev/null | \
+ sed -e 's|^'$i'/||' ) )
fi
done
# keep only packages
diff --git a/completions/lintian b/completions/lintian
index ad6b8c60..003d0bd2 100644
--- a/completions/lintian
+++ b/completions/lintian
@@ -17,12 +17,11 @@ _lintian_tags()
| cut -d: -f1 )
tags=$( echo $tags | sed -e "s/\<$item\>//g" )
done
- COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$tags") )
+ COMPREPLY+=( $(compgen -W "$tags") )
elif [[ "$cur" == *,* ]]; then
- COMPREPLY=( ${COMPREPLY[@]} $(compgen -P "${cur%,*}," -W "$tags" -- \
- "${cur##*,}") )
+ COMPREPLY+=( $(compgen -P "${cur%,*}," -W "$tags" -- "${cur##*,}") )
else
- COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$tags" -- "$cur") )
+ COMPREPLY+=( $(compgen -W "$tags" -- "$cur") )
fi
return 0
}
@@ -44,12 +43,11 @@ _lintian_checks()
checks=$( echo $checks | sed -e "s/\<$name\>//g" )
done
done
- COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$checks") )
+ COMPREPLY+=( $(compgen -W "$checks") )
elif [[ "$cur" == *,* ]]; then
- COMPREPLY=( ${COMPREPLY[@]} $(compgen -P "${cur%,*}," -W "$checks" \
- -- "${cur##*,}") )
+ COMPREPLY+=( $(compgen -P "${cur%,*}," -W "$checks" -- "${cur##*,}") )
else
- COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$checks" -- "$cur") )
+ COMPREPLY+=( $(compgen -W "$checks" -- "$cur") )
fi
return 0
}
@@ -67,12 +65,11 @@ _lintian_infos()
/usr/share/lintian/collection/*.desc | cut -d: -f1 )
infos=$( echo $infos | sed -e "s/\<$item\>//g" )
done
- COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$infos") )
+ COMPREPLY+=( $(compgen -W "$infos") )
elif [[ "$cur" == *,* ]]; then
- COMPREPLY=( ${COMPREPLY[@]} $(compgen -P "${cur%,*}," -W "$infos" \
- -- "${cur##*,}") )
+ COMPREPLY+=( $(compgen -P "${cur%,*}," -W "$infos" -- "${cur##*,}") )
else
- COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$infos" -- "$cur") )
+ COMPREPLY+=( $(compgen -W "$infos" -- "$cur") )
fi
return 0
}
diff --git a/completions/mplayer b/completions/mplayer
index 52c05903..eafb16de 100644
--- a/completions/mplayer
+++ b/completions/mplayer
@@ -39,8 +39,7 @@ _mplayer()
_filedir ttf
fi
local IFS=$'\n'
- COMPREPLY=( "${COMPREPLY[@]}"
- $( compgen -W '$( fc-list 2>/dev/null )' -- "$cur" ) )
+ COMPREPLY+=( $( compgen -W '$( fc-list 2>/dev/null )' -- "$cur" ) )
return 0
;;
-sub)
diff --git a/completions/mutt b/completions/mutt
index 7e830b3a..46863dbd 100644
--- a/completions/mutt
+++ b/completions/mutt
@@ -11,7 +11,7 @@ _muttaddr()
_muttaliases "$1"
_muttquery "$1"
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -u -- "$1" ) )
+ COMPREPLY+=( $( compgen -u -- "$1" ) )
return 0
}
@@ -63,7 +63,7 @@ _muttconffiles()
for file in "${newconffiles[@]}"; do
[[ ! -f "$file" || "${sofar/ ${file} / }" != "$sofar" ]] &&
continue
- sofar="$sofar $file"
+ sofar+=" $file"
sofar=" $(eval _muttconffiles \"$sofar\" $file) "
done
shift
@@ -84,7 +84,7 @@ _muttaliases()
conffiles=( $(eval _muttconffiles $muttrc $muttrc) )
aliases=( $( sed -n 's|^alias[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*$|\1|p' \
$(eval echo "${conffiles[@]}") ) )
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "${aliases[*]}" -- "$cur" ) )
+ COMPREPLY+=( $( compgen -W "${aliases[*]}" -- "$cur" ) )
return 0
}
@@ -104,8 +104,7 @@ _muttquery()
sed -n '2,$s|^\([^[:space:]]\{1,\}\).*|\1|p' ) )
fi
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "${queryresults[*]}" \
- -- "$cur" ) )
+ COMPREPLY+=( $( compgen -W "${queryresults[*]}" -- "$cur" ) )
return 0
}
diff --git a/completions/mysqladmin b/completions/mysqladmin
index ccb8e37f..1b6ce4d0 100644
--- a/completions/mysqladmin
+++ b/completions/mysqladmin
@@ -55,7 +55,7 @@ _mysqladmin()
--print-defaults --no-defaults --defaults-file --defaults-extra-file' \
-- "$cur" ) )
- COMPREPLY=( "${COMPREPLY[@]}" \
+ COMPREPLY+=( \
$( compgen -W 'create debug drop extended-status flush-hosts \
flush-logs flush-status flush-tables flush-threads flush-privileges \
kill password old-password ping processlist reload refresh shutdown \
diff --git a/completions/openldap b/completions/openldap
index 4e30588f..2f976e10 100644
--- a/completions/openldap
+++ b/completions/openldap
@@ -89,7 +89,7 @@ _ldapaddmodify()
options='-c -S -n -v -M -MM -d -D -W -w -y -h -H -p -P -O -I \
-Q -U -R -x -X -Y -Z -ZZ -f'
if [[ ${COMP_WORDS[0]} == ldapmodify ]]; then
- options="$options -a"
+ options+=" -a"
fi
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
fi
diff --git a/completions/openssl b/completions/openssl
index 0b09e97c..b5d191ea 100644
--- a/completions/openssl
+++ b/completions/openssl
@@ -75,10 +75,10 @@ _openssl()
formats='DER PEM'
case $command in
x509)
- formats="$formats NET"
+ formats+=" NET"
;;
smime)
- formats="$formats SMIME"
+ formats+=" SMIME"
;;
esac
COMPREPLY=( $( compgen -W "$formats" -- "$cur" ) )
diff --git a/completions/perl b/completions/perl
index aae189e3..5996b3bb 100644
--- a/completions/perl
+++ b/completions/perl
@@ -48,7 +48,7 @@ _perl()
;;
-m|-M)
temp="${cur#-}"
- prefix="$prefix${cur%$temp}"
+ prefix+="${cur%$temp}"
cur="$temp"
_perlmodules $1
return 0
@@ -56,7 +56,7 @@ _perl()
-V)
if [[ $cur == :* ]]; then
temp="${cur##+(:)}"
- prefix="$prefix${cur%$temp}"
+ prefix+="${cur%$temp}"
local IFS=$'\n'
COMPREPLY=( $( compgen -P "$prefix" -W \
'$( $1 -MConfig -e "print join \"\\n\",
@@ -118,7 +118,7 @@ _perldoc()
# return available modules (unless it is clearly a file)
if [[ "$cur" != */* ]]; then
_perlmodules $perl
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
+ COMPREPLY+=( $( compgen -W \
'$( PAGER=/bin/cat man perl | \
sed -ne "/perl.*Perl overview/,/perlwin32/p" | \
awk "\$NF=2 && \$1 ~ /^perl/ { print \$1 }" )' -- "$cur" ) )
diff --git a/completions/portupgrade b/completions/portupgrade
index 5389a5ca..d4b2687a 100644
--- a/completions/portupgrade
+++ b/completions/portupgrade
@@ -38,7 +38,7 @@ _portinstall()
COMPREPLY2=( $( command grep -E "^[^\|]+\|$portsdir$cur" < $indexfile | \
cut -d'|' -f2 ) )
COMPREPLY2=( ${COMPREPLY2[@]#$portsdir} )
- COMPREPLY=( "${COMPREPLY[@]}" "${COMPREPLY2[@]}" )
+ COMPREPLY+=( "${COMPREPLY2[@]}" )
return 0
} &&
diff --git a/completions/puppet b/completions/puppet
index b130ecef..bebf4fb8 100644
--- a/completions/puppet
+++ b/completions/puppet
@@ -29,13 +29,13 @@ _puppet_certs()
else
cert_list=$( $puppetca --list )
fi
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$cert_list" -- "$cur" ) )
+ COMPREPLY+=( $( compgen -W "$cert_list" -- "$cur" ) )
}
_puppet_types()
{
puppet_types=$( puppet describe --list | sed -e 's/^\(\S\+\).*$/\1/' )
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$puppet_types" -- "$cur" ) )
+ COMPREPLY+=( $( compgen -W "$puppet_types" -- "$cur" ) )
}
_puppet_references()
@@ -45,7 +45,7 @@ _puppet_references()
&& puppetdoc=puppetdoc
puppet_doc_list=$( $puppetdoc --list | sed -e 's/^\(\S\+\).*$/\1/' )
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$puppet_doc_list" -- "$cur" ) )
+ COMPREPLY+=( $( compgen -W "$puppet_doc_list" -- "$cur" ) )
}
_puppet()
@@ -171,20 +171,17 @@ _puppet()
return 0
;;
--clean|--fingerprint|--revoke|--verify)
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen \
- -W '--all' -- "$cur" ) )
+ COMPREPLY+=( $( compgen -W '--all' -- "$cur" ) )
_puppet_certs --all
return 0
;;
--sign)
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen \
- -W '--all' -- "$cur" ) )
+ COMPREPLY+=( $( compgen -W '--all' -- "$cur" ) )
_puppet_certs
return 0
;;
--list|--print)
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen \
- -W '--all' -- "$cur" ) )
+ COMPREPLY+=( $( compgen -W '--all' -- "$cur" ) )
return 0
;;
*)
diff --git a/completions/rcs b/completions/rcs
index f8a14154..30b08f9d 100644
--- a/completions/rcs
+++ b/completions/rcs
@@ -23,7 +23,7 @@ _rcs()
COMPREPLY[$i]=$dir$file
done
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -G "$dir/$file*,v" ) )
+ COMPREPLY+=( $( compgen -G "$dir/$file*,v" ) )
for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
COMPREPLY[$i]=${COMPREPLY[$i]%,v}
diff --git a/completions/rdesktop b/completions/rdesktop
index aa95d20d..267f75f8 100644
--- a/completions/rdesktop
+++ b/completions/rdesktop
@@ -14,10 +14,8 @@ _rdesktop()
COMPREPLY=( $( command ls \
/usr/share/rdesktop/keymaps 2>/dev/null | \
command grep -E -v '(common|modifiers)' ) )
- COMPREPLY=( ${COMPREPLY[@]:-} $( command ls \
- $HOME/.rdesktop/keymaps 2>/dev/null ) )
- COMPREPLY=( ${COMPREPLY[@]:-} $( command ls \
- ./keymaps 2>/dev/null ) )
+ COMPREPLY+=( $( command ls $HOME/.rdesktop/keymaps 2>/dev/null ) )
+ COMPREPLY+=( $( command ls ./keymaps 2>/dev/null ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
return 0
;;
diff --git a/completions/ri b/completions/ri
index 4a9d4dab..f2c152a7 100644
--- a/completions/ri
+++ b/completions/ri
@@ -15,7 +15,7 @@ ri_get_methods()
regex=Class
fi
- COMPREPLY=( ${COMPREPLY[@]} \
+ COMPREPLY+=( \
"$( ri ${classes[@]} 2>/dev/null | ruby -ane \
'if /^'"$regex"' methods:/.../^------------------|^$/ and \
/^ / then print $_.split(/, |,$/).grep(/^[^\[]*$/).join("\n"); \
@@ -23,7 +23,7 @@ ri_get_methods()
else
# older versions of ri didn't distinguish between class/module and
# instance methods
- COMPREPLY=( ${COMPREPLY[@]} \
+ COMPREPLY+=( \
"$( ruby -W0 $ri_path ${classes[@]} | ruby -ane \
'if /^-/.../^-/ and ! /^-/ and ! /^ +(class|module): / then \
print $_.split(/, |,$| +/).grep(/^[^\[]*$/).join("\n"); \
diff --git a/completions/rpm b/completions/rpm
index 0f68d1f2..94ce6569 100644
--- a/completions/rpm
+++ b/completions/rpm
@@ -146,7 +146,7 @@ _rpm()
;;
-q*|--query)
# options common to all query types
- opts="$opts --changelog --configfiles --conflicts --docfiles
+ opts+=" --changelog --configfiles --conflicts --docfiles
--dump --enhances --filesbypkg --filecaps --fileclass
--filecolor --fileprovide --filerequire --filesbypkg --info
--list --obsoletes --pipe --provides --queryformat --rcfile
diff --git a/completions/smartctl b/completions/smartctl
index 8ac0ae3e..1930848c 100644
--- a/completions/smartctl
+++ b/completions/smartctl
@@ -12,7 +12,7 @@ _smartctl_device()
areca*|3ware*|megaraid*|cciss*)
local i mycur="${cur%%,*}"
for (( i=0; i <= 31; i++ )) ; do
- COMPREPLY=( "${COMPREPLY[@]}" "$mycur,$i" )
+ COMPREPLY+=( "$mycur,$i" )
done
COMPREPLY=( $( compgen -W '"${COMPREPLY[@]}"' -- "$cur" ) )
;;
@@ -20,9 +20,9 @@ _smartctl_device()
local l m n
for (( l=1; l <= 4; l++ )) ; do
for (( m=1; m <= 8; m++ )) ; do
- COMPREPLY=( "${COMPREPLY[@]}" hpt,$l/$m )
+ COMPREPLY+=( hpt,$l/$m )
for (( n=1; n <= 5; n++ )) ; do
- COMPREPLY=( "${COMPREPLY[@]}" hpt,$l/$m/$n )
+ COMPREPLY+=( hpt,$l/$m/$n )
done
done
done
diff --git a/completions/ssh b/completions/ssh
index 77694fce..3276cd01 100644
--- a/completions/ssh
+++ b/completions/ssh
@@ -4,7 +4,7 @@ have ssh || return
_ssh_bindaddress()
{
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
+ COMPREPLY+=( $( compgen -W \
"$( PATH="$PATH:/sbin" ifconfig -a | \
sed -ne 's/.*addr:\([^[:space:]]*\).*/\1/p' \
-ne 's/.*inet[[:space:]]\{1,\}\([^[:space:]]*\).*/\1/p' )" \
@@ -13,14 +13,14 @@ _ssh_bindaddress()
_ssh_ciphers()
{
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W '3des-cbc aes128-cbc \
+ COMPREPLY+=( $( compgen -W '3des-cbc aes128-cbc \
aes192-cbc aes256-cbc aes128-ctr aes192-ctr aes256-ctr arcfour128 \
arcfour256 arcfour blowfish-cbc cast128-cbc' -- "$cur" ) )
}
_ssh_macs()
{
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W 'hmac-md5 hmac-sha1 \
+ COMPREPLY+=( $( compgen -W 'hmac-md5 hmac-sha1 \
umac-64@openssh.com hmac-ripemd160 hmac-sha1-96 hmac-md5-96' \
-- "$cur" ) )
}
@@ -184,7 +184,7 @@ _ssh()
_known_hosts_real -a -F "$configfile" "$cur"
if [ $COMP_CWORD -ne 1 ]; then
_compopt_o_filenames
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -c -- "$cur" ) )
+ COMPREPLY+=( $( compgen -c -- "$cur" ) )
fi
fi
@@ -282,7 +282,7 @@ _scp_remote_files()
sed -e 's/'$_scp_path_esc'/\\\\\\&/g' -e 's/[*@|=]$//g' \
-e 's/[^\/]$/& /g' )
fi
- COMPREPLY=( "${COMPREPLY[@]}" $files )
+ COMPREPLY+=( $files )
}
# This approach is used instead of _filedir to get a space appended
@@ -300,10 +300,10 @@ _scp_local_files()
fi
if $dirsonly ; then
- COMPREPLY=( "${COMPREPLY[@]}" $( command ls -aF1d $cur* 2>/dev/null | \
+ COMPREPLY+=( $( command ls -aF1d $cur* 2>/dev/null | \
sed -e "s/$_scp_path_esc/\\\\&/g" -e '/[^\/]$/d' -e "s/^/$1/") )
else
- COMPREPLY=( "${COMPREPLY[@]}" $( command ls -aF1d $cur* 2>/dev/null | \
+ COMPREPLY+=( $( command ls -aF1d $cur* 2>/dev/null | \
sed -e "s/$_scp_path_esc/\\\\&/g" -e 's/[*@|=]$//g' \
-e 's/[^\/]$/& /g' -e "s/^/$1/") )
fi
diff --git a/completions/svk b/completions/svk
index bd2d0975..6d416be4 100644
--- a/completions/svk
+++ b/completions/svk
@@ -174,7 +174,7 @@ _svk()
-s --sync -m --merge -q --quiet'
;;
esac
- options="$options --help -h"
+ options+=" --help -h"
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
else
diff --git a/completions/sysbench b/completions/sysbench
index c487f28f..d55e6898 100644
--- a/completions/sysbench
+++ b/completions/sysbench
@@ -150,9 +150,9 @@ _sysbench()
if [[ $test ]]; then
local help=( $( _parse_help $1 "--test=$test help" ) )
- opts="$opts ${help[@]/%/=} prepare run cleanup help version"
+ opts+=" ${help[@]/%/=} prepare run cleanup help version"
else
- opts="$opts --test="
+ opts+=" --test="
fi
if [[ "$cur" == -* || ! $test ]]; then
diff --git a/completions/wireless-tools b/completions/wireless-tools
index 52d44bcb..13a82d6e 100644
--- a/completions/wireless-tools
+++ b/completions/wireless-tools
@@ -19,7 +19,7 @@ _iwconfig()
essid)
COMPREPLY=( $( compgen -W 'on off any' -- "$cur" ) )
if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
+ COMPREPLY+=( $( compgen -W \
"$( iwlist ${COMP_WORDS[1]} scan | \
awk -F'\"' '/ESSID/ {print $2}' )" -- "$cur" ) )
fi
@@ -43,7 +43,7 @@ _iwconfig()
ap)
COMPREPLY=( $( compgen -W 'on off any' -- "$cur" ) )
if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
+ COMPREPLY+=( $( compgen -W \
"$( iwlist ${COMP_WORDS[1]} scan | \
awk -F ': ' '/Address/ {print $2}' )" -- "$cur" ) )
fi
@@ -51,7 +51,7 @@ _iwconfig()
;;
rate)
COMPREPLY=( $( compgen -W 'auto fixed' -- "$cur" ) )
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
+ COMPREPLY+=( $( compgen -W \
"$( iwlist ${COMP_WORDS[1]} rate | \
awk '/^[ \t]*[0-9]/ {print $1"M"}' )" -- "$cur" ) )
return 0
diff --git a/completions/wodim b/completions/wodim
index 9682df29..8ccfcd8f 100644
--- a/completions/wodim
+++ b/completions/wodim
@@ -98,12 +98,10 @@ _cdrecord()
# files are always eligible completion
_filedir
# track options are always available
- COMPREPLY=( "${COMPREPLY[@]}" \
- $( compgen -W '${track_options[@]}' -- "$cur" ) )
+ COMPREPLY+=( $( compgen -W '${track_options[@]}' -- "$cur" ) )
# general options are no more available after file or track option
if [ $track_mode -eq 0 ]; then
- COMPREPLY=( "${COMPREPLY[@]}" \
- $( compgen -W '${generic_options[@]}' -- "$cur" ) )
+ COMPREPLY+=( $( compgen -W '${generic_options[@]}' -- "$cur" ) )
fi
[[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} != *= ]] && \
compopt +o nospace &>/dev/null
diff --git a/completions/xm b/completions/xm
index 1e761394..1ec2cbfd 100644
--- a/completions/xm
+++ b/completions/xm
@@ -193,7 +193,7 @@ _xm()
;;
create)
_filedir
- COMPREPLY=( ${COMPREPLY[@]:-} \
+ COMPREPLY+=( \
$( compgen -W '$( command ls /etc/xen 2>/dev/null )' \
-- "$cur" ) )
;;