Use += to append to arrays and strings.
It's easier on the eye and faster than foo=( "${foo[@]}" ... ).
This commit is contained in:
parent
e31f021470
commit
ee43b22f9b
2
CHANGES
2
CHANGES
@ -7,7 +7,7 @@ bash-completion (2.x)
|
|||||||
* Drop rpm query support for rpm < 4.1.
|
* Drop rpm query support for rpm < 4.1.
|
||||||
* Split rpm and rpmbuild completions and improve them both.
|
* Split rpm and rpmbuild completions and improve them both.
|
||||||
* Add $_backup_glob for matching various backup files.
|
* Add $_backup_glob for matching various backup files.
|
||||||
* Load speedups.
|
* Load and general speedups.
|
||||||
|
|
||||||
[ Guillaume Rousse ]
|
[ Guillaume Rousse ]
|
||||||
* added puppet completion, using work from Mathieu Parent (sathieudebian.org)
|
* added puppet completion, using work from Mathieu Parent (sathieudebian.org)
|
||||||
|
@ -653,7 +653,7 @@ _filedir()
|
|||||||
local quoted tmp
|
local quoted tmp
|
||||||
|
|
||||||
_quote_readline_by_ref "$cur" quoted
|
_quote_readline_by_ref "$cur" quoted
|
||||||
toks=( ${toks[@]-} $(
|
toks=( $(
|
||||||
compgen -d -- "$quoted" | {
|
compgen -d -- "$quoted" | {
|
||||||
while read -r tmp; do
|
while read -r tmp; do
|
||||||
# TODO: I have removed a "[ -n $tmp ] &&" before 'printf ..',
|
# TODO: I have removed a "[ -n $tmp ] &&" before 'printf ..',
|
||||||
@ -671,16 +671,16 @@ _filedir()
|
|||||||
[[ ${BASH_VERSINFO[0]} -ge 4 ]] && \
|
[[ ${BASH_VERSINFO[0]} -ge 4 ]] && \
|
||||||
xspec=${1:+"!*.@($1|${1^^})"} || \
|
xspec=${1:+"!*.@($1|${1^^})"} || \
|
||||||
xspec=${1:+"!*.@($1|$(printf %s $1 | tr '[:lower:]' '[:upper:]'))"}
|
xspec=${1:+"!*.@($1|$(printf %s $1 | tr '[:lower:]' '[:upper:]'))"}
|
||||||
toks=( ${toks[@]-} $( compgen -f -X "$xspec" -- $quoted) )
|
toks+=( $( compgen -f -X "$xspec" -- $quoted ) )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If the filter failed to produce anything, try without it
|
# If the filter failed to produce anything, try without it
|
||||||
[[ -n "$1" && "$1" != -d && ${#toks[@]} -lt 1 ]] && \
|
[[ -n "$1" && "$1" != -d && ${#toks[@]} -lt 1 ]] && \
|
||||||
toks=( ${toks[@]-} $( compgen -f -- $quoted ) )
|
toks+=( $( compgen -f -- $quoted ) )
|
||||||
|
|
||||||
[ ${#toks[@]} -ne 0 ] && _compopt_o_filenames
|
[ ${#toks[@]} -ne 0 ] && _compopt_o_filenames
|
||||||
|
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" "${toks[@]}" )
|
COMPREPLY+=( "${toks[@]}" )
|
||||||
} # _filedir()
|
} # _filedir()
|
||||||
|
|
||||||
|
|
||||||
@ -734,16 +734,16 @@ _mac_addresses()
|
|||||||
local PATH="$PATH:/sbin:/usr/sbin"
|
local PATH="$PATH:/sbin:/usr/sbin"
|
||||||
|
|
||||||
# Local interfaces (Linux only?)
|
# 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" ) )
|
"s/.*[[:space:]]HWaddr[[:space:]]\{1,\}\($re\)[[:space:]]*$/\1/p" ) )
|
||||||
|
|
||||||
# ARP cache
|
# 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" -ne \
|
||||||
"s/.*[[:space:]]\($re\)[[:space:]]*$/\1/p" ) )
|
"s/.*[[:space:]]\($re\)[[:space:]]*$/\1/p" ) )
|
||||||
|
|
||||||
# /etc/ethers
|
# /etc/ethers
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" $( sed -ne \
|
COMPREPLY+=( $( sed -ne \
|
||||||
"s/^[[:space:]]*\($re\)[[:space:]].*/\1/p" /etc/ethers 2>/dev/null ) )
|
"s/^[[:space:]]*\($re\)[[:space:]].*/\1/p" /etc/ethers 2>/dev/null ) )
|
||||||
|
|
||||||
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
|
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
|
||||||
@ -869,7 +869,7 @@ __expand_tilde_by_ref() {
|
|||||||
_expand()
|
_expand()
|
||||||
{
|
{
|
||||||
# FIXME: Why was this here?
|
# FIXME: Why was this here?
|
||||||
#[ "$cur" != "${cur%\\}" ] && cur="$cur\\"
|
#[ "$cur" != "${cur%\\}" ] && cur+="\\"
|
||||||
|
|
||||||
# Expand ~username type directory specifications. We want to expand
|
# Expand ~username type directory specifications. We want to expand
|
||||||
# ~foo/... to /home/foo/... to avoid problems when $cur starting with
|
# ~foo/... to /home/foo/... to avoid problems when $cur starting with
|
||||||
@ -975,8 +975,7 @@ _services()
|
|||||||
COMPREPLY=( $( printf '%s\n' $sysvdir/!($_backup_glob|functions) ) )
|
COMPREPLY=( $( printf '%s\n' $sysvdir/!($_backup_glob|functions) ) )
|
||||||
|
|
||||||
if [ -d $famdir ]; then
|
if [ -d $famdir ]; then
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" $( printf '%s\n' \
|
COMPREPLY+=( $( printf '%s\n' $famdir/!($_backup_glob) ) )
|
||||||
$famdir/!($_backup_glob) ) )
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
COMPREPLY=( $( compgen -W '${COMPREPLY[@]#@($sysvdir|$famdir)/}' -- "$cur" ) )
|
COMPREPLY=( $( compgen -W '${COMPREPLY[@]#@($sysvdir|$famdir)/}' -- "$cur" ) )
|
||||||
@ -1081,7 +1080,7 @@ _allowed_groups()
|
|||||||
#
|
#
|
||||||
_shells()
|
_shells()
|
||||||
{
|
{
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
|
COMPREPLY+=( $( compgen -W \
|
||||||
'$( command grep "^[[:space:]]*/" /etc/shells 2>/dev/null )' \
|
'$( command grep "^[[:space:]]*/" /etc/shells 2>/dev/null )' \
|
||||||
-- "$cur" ) )
|
-- "$cur" ) )
|
||||||
}
|
}
|
||||||
@ -1106,7 +1105,7 @@ _fstypes()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
[ -n "$fss" ] && \
|
[ -n "$fss" ] && \
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$fss" -- "$cur" ) )
|
COMPREPLY+=( $( compgen -W "$fss" -- "$cur" ) )
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get real command.
|
# Get real command.
|
||||||
@ -1162,7 +1161,7 @@ _count_args()
|
|||||||
#
|
#
|
||||||
_pci_ids()
|
_pci_ids()
|
||||||
{
|
{
|
||||||
COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W \
|
COMPREPLY+=( $( compgen -W \
|
||||||
"$( PATH="$PATH:/sbin" lspci -n | awk '{print $3}')" -- "$cur" ) )
|
"$( PATH="$PATH:/sbin" lspci -n | awk '{print $3}')" -- "$cur" ) )
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1170,22 +1169,20 @@ _pci_ids()
|
|||||||
#
|
#
|
||||||
_usb_ids()
|
_usb_ids()
|
||||||
{
|
{
|
||||||
COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W \
|
COMPREPLY+=( $( compgen -W \
|
||||||
"$( PATH="$PATH:/sbin" lsusb | awk '{print $6}' )" -- "$cur" ) )
|
"$( PATH="$PATH:/sbin" lsusb | awk '{print $6}' )" -- "$cur" ) )
|
||||||
}
|
}
|
||||||
|
|
||||||
# CD device names
|
# CD device names
|
||||||
_cd_devices()
|
_cd_devices()
|
||||||
{
|
{
|
||||||
COMPREPLY=( "${COMPREPLY[@]}"
|
COMPREPLY+=( $( compgen -f -d -X "!*/?([amrs])cd*" -- "${cur:-/dev/}" ) )
|
||||||
$( compgen -f -d -X "!*/?([amrs])cd*" -- "${cur:-/dev/}" ) )
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# DVD device names
|
# DVD device names
|
||||||
_dvd_devices()
|
_dvd_devices()
|
||||||
{
|
{
|
||||||
COMPREPLY=( "${COMPREPLY[@]}"
|
COMPREPLY+=( $( compgen -f -d -X "!*/?(r)dvd*" -- "${cur:-/dev/}" ) )
|
||||||
$( compgen -f -d -X "!*/?(r)dvd*" -- "${cur:-/dev/}" ) )
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# start of section containing completion functions for external programs
|
# 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
|
# NOTE: Using `_known_hosts' as a helper function and passing options
|
||||||
# to `_known_hosts' is deprecated: Use `_known_hosts_real' instead.
|
# to `_known_hosts' is deprecated: Use `_known_hosts_real' instead.
|
||||||
[[ "$1" == -a || "$2" == -a ]] && options=-a
|
[[ "$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_real $options "$(_get_cword :)"
|
||||||
} # _known_hosts()
|
} # _known_hosts()
|
||||||
|
|
||||||
@ -1265,11 +1262,11 @@ _known_hosts_real()
|
|||||||
# ssh config files
|
# ssh config files
|
||||||
if [ -n "$configfile" ]; then
|
if [ -n "$configfile" ]; then
|
||||||
[ -r "$configfile" ] &&
|
[ -r "$configfile" ] &&
|
||||||
config=( "${config[@]}" "$configfile" )
|
config+=( "$configfile" )
|
||||||
else
|
else
|
||||||
for i in /etc/ssh/ssh_config "${HOME}/.ssh/config" \
|
for i in /etc/ssh/ssh_config "${HOME}/.ssh/config" \
|
||||||
"${HOME}/.ssh2/config"; do
|
"${HOME}/.ssh2/config"; do
|
||||||
[ -r $i ] && config=( "${config[@]}" "$i" )
|
[ -r $i ] && config+=( "$i" )
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -1287,7 +1284,7 @@ _known_hosts_real()
|
|||||||
i=${i//\"}
|
i=${i//\"}
|
||||||
# Eval/expand possible `~' or `~user'
|
# Eval/expand possible `~' or `~user'
|
||||||
__expand_tilde_by_ref i
|
__expand_tilde_by_ref i
|
||||||
[ -r "$i" ] && kh=( "${kh[@]}" "$i" )
|
[ -r "$i" ] && kh+=( "$i" )
|
||||||
done
|
done
|
||||||
IFS=$OIFS
|
IFS=$OIFS
|
||||||
fi
|
fi
|
||||||
@ -1297,10 +1294,10 @@ _known_hosts_real()
|
|||||||
for i in /etc/ssh/ssh_known_hosts /etc/ssh/ssh_known_hosts2 \
|
for i in /etc/ssh/ssh_known_hosts /etc/ssh/ssh_known_hosts2 \
|
||||||
/etc/known_hosts /etc/known_hosts2 ~/.ssh/known_hosts \
|
/etc/known_hosts /etc/known_hosts2 ~/.ssh/known_hosts \
|
||||||
~/.ssh/known_hosts2; do
|
~/.ssh/known_hosts2; do
|
||||||
[ -r $i ] && kh=( "${kh[@]}" $i )
|
[ -r $i ] && kh+=( $i )
|
||||||
done
|
done
|
||||||
for i in /etc/ssh2/knownhosts ~/.ssh2/hostkeys; do
|
for i in /etc/ssh2/knownhosts ~/.ssh2/hostkeys; do
|
||||||
[ -d $i ] && khd=( "${khd[@]}" $i/*pub )
|
[ -d $i ] && khd+=( $i/*pub )
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -1327,7 +1324,7 @@ _known_hosts_real()
|
|||||||
|
|
||||||
if [ ${#kh[@]} -gt 0 ]; then
|
if [ ${#kh[@]} -gt 0 ]; then
|
||||||
# FS needs to look for a comma separated list
|
# 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) { \
|
/^\s*[^|\#]/ {for (i=1; i<=2; ++i) { \
|
||||||
sub(" .*$", "", $i); \
|
sub(" .*$", "", $i); \
|
||||||
sub("^\\[", "", $i); sub("\\](:[0-9]+)?$", "", $i); \
|
sub("^\\[", "", $i); sub("\\](:[0-9]+)?$", "", $i); \
|
||||||
@ -1343,7 +1340,7 @@ _known_hosts_real()
|
|||||||
if [[ "$i" == *key_22_$curd*.pub && -r "$i" ]]; then
|
if [[ "$i" == *key_22_$curd*.pub && -r "$i" ]]; then
|
||||||
host=${i/#*key_22_/}
|
host=${i/#*key_22_/}
|
||||||
host=${host/%.pub/}
|
host=${host/%.pub/}
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" $host )
|
COMPREPLY+=( $host )
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
@ -1357,7 +1354,7 @@ _known_hosts_real()
|
|||||||
# append any available aliases from config files
|
# append any available aliases from config files
|
||||||
if [[ ${#config[@]} -gt 0 && -n "$aliases" ]]; then
|
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[@]}" )
|
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" ) )
|
-S "$suffix" -W "$hosts" -- "$cur" ) )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -1369,8 +1366,7 @@ _known_hosts_real()
|
|||||||
# if it contains ";", it may mistify the result. But on Gentoo (at
|
# if it contains ";", it may mistify the result. But on Gentoo (at
|
||||||
# least), -k wasn't available (even if mentioned in the manpage) some
|
# least), -k wasn't available (even if mentioned in the manpage) some
|
||||||
# time ago, so...
|
# time ago, so...
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" $( \
|
COMPREPLY+=( $( compgen -P "$prefix$user" -S "$suffix" -W \
|
||||||
compgen -P "$prefix$user" -S "$suffix" -W \
|
|
||||||
"$( avahi-browse -cpr _workstation._tcp 2>/dev/null | \
|
"$( avahi-browse -cpr _workstation._tcp 2>/dev/null | \
|
||||||
awk -F';' '/^=/ { print $7 }' | sort -u )" -- "$cur" ) )
|
awk -F';' '/^=/ { print $7 }' | sort -u )" -- "$cur" ) )
|
||||||
fi
|
fi
|
||||||
@ -1378,7 +1374,7 @@ _known_hosts_real()
|
|||||||
# Add results of normal hostname completion, unless
|
# Add results of normal hostname completion, unless
|
||||||
# `COMP_KNOWN_HOSTS_WITH_HOSTFILE' is set to an empty value.
|
# `COMP_KNOWN_HOSTS_WITH_HOSTFILE' is set to an empty value.
|
||||||
if [ -n "${COMP_KNOWN_HOSTS_WITH_HOSTFILE-1}" ]; then
|
if [ -n "${COMP_KNOWN_HOSTS_WITH_HOSTFILE-1}" ]; then
|
||||||
COMPREPLY=( "${COMPREPLY[@]}"
|
COMPREPLY+=(
|
||||||
$( compgen -A hostname -P "$prefix$user" -S "$suffix" -- "$cur" ) )
|
$( compgen -A hostname -P "$prefix$user" -S "$suffix" -- "$cur" ) )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -1422,7 +1418,7 @@ _cd()
|
|||||||
k="${#COMPREPLY[@]}"
|
k="${#COMPREPLY[@]}"
|
||||||
for j in $( compgen -d $i/$cur ); do
|
for j in $( compgen -d $i/$cur ); do
|
||||||
if [[ ( $mark_symdirs && -h $j || $mark_dirs && ! -h $j ) && ! -d ${j#$i/} ]]; then
|
if [[ ( $mark_symdirs && -h $j || $mark_dirs && ! -h $j ) && ! -d ${j#$i/} ]]; then
|
||||||
j="${j}/"
|
j+="/"
|
||||||
fi
|
fi
|
||||||
COMPREPLY[k++]=${j#$i/}
|
COMPREPLY[k++]=${j#$i/}
|
||||||
done
|
done
|
||||||
@ -1620,7 +1616,7 @@ _filedir_xspec()
|
|||||||
local -a toks
|
local -a toks
|
||||||
local tmp
|
local tmp
|
||||||
|
|
||||||
toks=( ${toks[@]-} $(
|
toks=( $(
|
||||||
compgen -d -- "$(quote_readline "$cur")" | {
|
compgen -d -- "$(quote_readline "$cur")" | {
|
||||||
while read -r tmp; do
|
while read -r tmp; do
|
||||||
# see long TODO comment in _filedir() --David
|
# see long TODO comment in _filedir() --David
|
||||||
@ -1640,7 +1636,7 @@ _filedir_xspec()
|
|||||||
xspec="$matchop($xspec|${xspec^^})" || \
|
xspec="$matchop($xspec|${xspec^^})" || \
|
||||||
xspec="$matchop($xspec|$(printf %s $xspec | tr '[:lower:]' '[:upper:]'))"
|
xspec="$matchop($xspec|$(printf %s $xspec | tr '[:lower:]' '[:upper:]'))"
|
||||||
|
|
||||||
toks=( ${toks[@]-} $(
|
toks+=( $(
|
||||||
eval compgen -f -X "!$xspec" -- "\$(quote_readline "\$cur")" | {
|
eval compgen -f -X "!$xspec" -- "\$(quote_readline "\$cur")" | {
|
||||||
while read -r tmp; do
|
while read -r tmp; do
|
||||||
[ -n $tmp ] && printf '%s\n' $tmp
|
[ -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%# START exclude*}
|
||||||
line=${line%# FINISH exclude*}
|
line=${line%# FINISH exclude*}
|
||||||
line=${line##*\'}
|
line=${line##*\'}
|
||||||
list=( "${list[@]}" $line )
|
list+=( $line )
|
||||||
done
|
done
|
||||||
printf '%s ' "${list[@]}"
|
printf '%s ' "${list[@]}"
|
||||||
)
|
)
|
||||||
|
@ -202,7 +202,7 @@ _svn()
|
|||||||
--non-interactive --diff3-cmd --ignore-externals'
|
--non-interactive --diff3-cmd --ignore-externals'
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
options="$options --help -h --config-dir"
|
options+=" --help -h --config-dir"
|
||||||
|
|
||||||
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
|
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
|
||||||
else
|
else
|
||||||
@ -276,7 +276,7 @@ _svnadmin()
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
options="$options --help -h"
|
options+=" --help -h"
|
||||||
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
|
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
|
||||||
else
|
else
|
||||||
if [[ "$command" == @(help|h|\?) ]]; then
|
if [[ "$command" == @(help|h|\?) ]]; then
|
||||||
@ -335,7 +335,7 @@ _svnlook()
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
options="$options --help -h"
|
options+=" --help -h"
|
||||||
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
|
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
|
||||||
else
|
else
|
||||||
if [[ "$command" == @(help|h|\?) ]]; then
|
if [[ "$command" == @(help|h|\?) ]]; then
|
||||||
|
@ -11,7 +11,7 @@ _aspell_dictionary()
|
|||||||
COMPREPLY=( ${COMPREPLY[@]%.alias} )
|
COMPREPLY=( ${COMPREPLY[@]%.alias} )
|
||||||
COMPREPLY=( ${COMPREPLY[@]#$datadir/} )
|
COMPREPLY=( ${COMPREPLY[@]#$datadir/} )
|
||||||
# Then, add the canonical dicts
|
# Then, add the canonical dicts
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" $( aspell dicts 2>/dev/null ) )
|
COMPREPLY+=( $( aspell dicts 2>/dev/null ) )
|
||||||
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
|
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ _complete()
|
|||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
# relevant options completion
|
# relevant options completion
|
||||||
local opts="-a -b -c -d -e -f -g -j -k -o -s -u -v -A -G -W -P -S -X"
|
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" ) )
|
COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) )
|
||||||
else
|
else
|
||||||
COMPREPLY=( $( compgen -A command -- "$cur" ) )
|
COMPREPLY=( $( compgen -A command -- "$cur" ) )
|
||||||
|
@ -5,14 +5,14 @@ have hcitool || return
|
|||||||
_bluetooth_adresses()
|
_bluetooth_adresses()
|
||||||
{
|
{
|
||||||
if [ -n "${COMP_BLUETOOTH_SCAN:-}" ]; then
|
if [ -n "${COMP_BLUETOOTH_SCAN:-}" ]; then
|
||||||
COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "$( hcitool scan | \
|
COMPREPLY+=( $( compgen -W "$( hcitool scan | \
|
||||||
awk '/^\t/{print $1}' )" -- "$cur" ) )
|
awk '/^\t/{print $1}' )" -- "$cur" ) )
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_bluetooth_devices()
|
_bluetooth_devices()
|
||||||
{
|
{
|
||||||
COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "$( hcitool dev | \
|
COMPREPLY+=( $( compgen -W "$( hcitool dev | \
|
||||||
awk '/^\t/{print $1}' )" -- "$cur" ) )
|
awk '/^\t/{print $1}' )" -- "$cur" ) )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,8 +16,8 @@ _crontab()
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
local i opts=" -u -l -r -e" # leading space at start is significant...
|
local i opts=" -u -l -r -e" # leading space at start is significant...
|
||||||
[[ $OSTYPE == *linux* ]] && opts="$opts -i"
|
[[ $OSTYPE == *linux* ]] && opts+=" -i"
|
||||||
[ -e /etc/selinux ] && opts="$opts -s"
|
[ -e /etc/selinux ] && opts+=" -s"
|
||||||
for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
|
for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
|
||||||
case "${COMP_WORDS[i]}" in
|
case "${COMP_WORDS[i]}" in
|
||||||
-l)
|
-l)
|
||||||
|
@ -49,8 +49,8 @@ _cvs_roots()
|
|||||||
local -a cvsroots
|
local -a cvsroots
|
||||||
cvsroots=( $CVSROOT )
|
cvsroots=( $CVSROOT )
|
||||||
[ -r ~/.cvspass ] && \
|
[ -r ~/.cvspass ] && \
|
||||||
cvsroots=( "${cvsroots[@]}" $( awk '{ print $2 }' ~/.cvspass ) )
|
cvsroots+=( $( awk '{ print $2 }' ~/.cvspass ) )
|
||||||
[ -r CVS/Root ] && cvsroots=( "${cvsroots[@]}" $(cat CVS/Root) )
|
[ -r CVS/Root ] && cvsroots+=( $( cat CVS/Root ) )
|
||||||
COMPREPLY=( $( compgen -W '${cvsroots[@]}' -- "$cur" ) )
|
COMPREPLY=( $( compgen -W '${cvsroots[@]}' -- "$cur" ) )
|
||||||
__ltrim_colon_completions "$cur"
|
__ltrim_colon_completions "$cur"
|
||||||
}
|
}
|
||||||
@ -136,7 +136,7 @@ _cvs()
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
elif [[ "$i" = -* ]]; then
|
elif [[ "$i" = -* ]]; then
|
||||||
flags=( "${flags[@]}" $i )
|
flags+=( $i )
|
||||||
fi
|
fi
|
||||||
count=$((++count))
|
count=$((++count))
|
||||||
done
|
done
|
||||||
@ -306,7 +306,7 @@ _cvs()
|
|||||||
get_entries
|
get_entries
|
||||||
# find out what files are missing
|
# find out what files are missing
|
||||||
for i in "${entries[@]}"; do
|
for i in "${entries[@]}"; do
|
||||||
[ ! -r "$i" ] && miss=( "${miss[@]}" $i )
|
[ ! -r "$i" ] && miss+=( $i )
|
||||||
done
|
done
|
||||||
COMPREPLY=( $(compgen -W '${miss[@]:-}' -- "$cur") )
|
COMPREPLY=( $(compgen -W '${miss[@]:-}' -- "$cur") )
|
||||||
fi
|
fi
|
||||||
|
@ -24,8 +24,7 @@ _find()
|
|||||||
-fstype)
|
-fstype)
|
||||||
_fstypes
|
_fstypes
|
||||||
[[ $OSTYPE == *bsd* ]] && \
|
[[ $OSTYPE == *bsd* ]] && \
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" \
|
COMPREPLY+=( $( compgen -W 'local rdonly' -- "$cur" ) )
|
||||||
$( compgen -W 'local rdonly' -- "$cur" ) )
|
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
-gid)
|
-gid)
|
||||||
|
@ -25,7 +25,7 @@ _gpg()
|
|||||||
COMPREPLY=( $( compgen -W "$( gpg --list-keys 2>/dev/null | \
|
COMPREPLY=( $( compgen -W "$( gpg --list-keys 2>/dev/null | \
|
||||||
sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ))
|
sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ))
|
||||||
if [ -e ~/.gnupg/gpg.conf ]; then
|
if [ -e ~/.gnupg/gpg.conf ]; then
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$( sed -ne \
|
COMPREPLY+=( $( compgen -W "$( sed -ne \
|
||||||
's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' \
|
's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' \
|
||||||
~/.gnupg/gpg.conf )" -- "$cur") )
|
~/.gnupg/gpg.conf )" -- "$cur") )
|
||||||
fi
|
fi
|
||||||
|
@ -29,7 +29,7 @@ _gpg2()
|
|||||||
COMPREPLY=( $( compgen -W "$( gpg2 --list-keys 2>/dev/null | \
|
COMPREPLY=( $( compgen -W "$( gpg2 --list-keys 2>/dev/null | \
|
||||||
sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ))
|
sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ))
|
||||||
if [ -e ~/.gnupg/gpg.conf ]; then
|
if [ -e ~/.gnupg/gpg.conf ]; then
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$( sed -ne \
|
COMPREPLY+=( $( compgen -W "$( sed -ne \
|
||||||
's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' \
|
's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' \
|
||||||
~/.gnupg/gpg.conf)" -- "$cur"))
|
~/.gnupg/gpg.conf)" -- "$cur"))
|
||||||
fi
|
fi
|
||||||
|
@ -40,7 +40,7 @@ _ip()
|
|||||||
-*)
|
-*)
|
||||||
local c="-Version -statistics -details -resolve -family
|
local c="-Version -statistics -details -resolve -family
|
||||||
-oneline -timestamp -batch -rcvbuf"
|
-oneline -timestamp -batch -rcvbuf"
|
||||||
[[ $cword -eq 1 ]] && c="$c -force"
|
[[ $cword -eq 1 ]] && c+=" -force"
|
||||||
COMPREPLY=( $( compgen -W "$c" -- "$cur" ) )
|
COMPREPLY=( $( compgen -W "$c" -- "$cur" ) )
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
@ -92,7 +92,7 @@ _ip()
|
|||||||
local c="arp dynamic multicast allmulticast
|
local c="arp dynamic multicast allmulticast
|
||||||
promisc trailers txqueuelen name address
|
promisc trailers txqueuelen name address
|
||||||
broadcast mtu netns alias"
|
broadcast mtu netns alias"
|
||||||
[[ $prev != @(up|down) ]] && c="$c up down"
|
[[ $prev != @(up|down) ]] && c+=" up down"
|
||||||
COMPREPLY=( $( compgen -W "$c" -- "$cur" ) )
|
COMPREPLY=( $( compgen -W "$c" -- "$cur" ) )
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -63,17 +63,16 @@ _java_classes()
|
|||||||
for i in ${classpath//:/ }; do
|
for i in ${classpath//:/ }; do
|
||||||
if [[ "$i" == *.@(jar|zip) && -r $i ]]; then
|
if [[ "$i" == *.@(jar|zip) && -r $i ]]; then
|
||||||
if type zipinfo &>/dev/null; then
|
if type zipinfo &>/dev/null; then
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" $( zipinfo -1 \
|
COMPREPLY+=( $( zipinfo -1 "$i" "$cur*" 2>/dev/null | \
|
||||||
"$i" "$cur*" 2>/dev/null | \
|
|
||||||
command grep '^[^$]*\.class$' ) )
|
command grep '^[^$]*\.class$' ) )
|
||||||
else
|
else
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" $( jar tf "$i" \
|
COMPREPLY+=( $( jar tf "$i" "$cur" | \
|
||||||
"$cur" | command grep '^[^$]*\.class$' ) )
|
command grep '^[^$]*\.class$' ) )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
elif [ -d $i ]; then
|
elif [ -d $i ]; then
|
||||||
compopt -o nospace &>/dev/null
|
compopt -o nospace &>/dev/null
|
||||||
COMPREPLY=( "${COMPREPLY[@]}"
|
COMPREPLY+=(
|
||||||
$( compgen -d -- "$i/$cur" | sed -e "s|^$i/\(.*\)|\1.|" )
|
$( compgen -d -- "$i/$cur" | sed -e "s|^$i/\(.*\)|\1.|" )
|
||||||
$( compgen -f -X '!*.class' -- "$i/$cur" | \
|
$( compgen -f -X '!*.class' -- "$i/$cur" | \
|
||||||
sed -e '/\$/d' -e "s|^$i/||" )
|
sed -e '/\$/d' -e "s|^$i/||" )
|
||||||
@ -106,8 +105,8 @@ _java_packages()
|
|||||||
# parse each sourcepath element for packages
|
# parse each sourcepath element for packages
|
||||||
for i in ${sourcepath//:/ }; do
|
for i in ${sourcepath//:/ }; do
|
||||||
if [ -d $i ]; then
|
if [ -d $i ]; then
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" $( command ls -F -d \
|
COMPREPLY+=( $( command ls -F -d $i/$cur* 2>/dev/null | \
|
||||||
$i/$cur* 2>/dev/null | sed -e 's|^'$i'/||' ) )
|
sed -e 's|^'$i'/||' ) )
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
# keep only packages
|
# keep only packages
|
||||||
|
@ -17,12 +17,11 @@ _lintian_tags()
|
|||||||
| cut -d: -f1 )
|
| cut -d: -f1 )
|
||||||
tags=$( echo $tags | sed -e "s/\<$item\>//g" )
|
tags=$( echo $tags | sed -e "s/\<$item\>//g" )
|
||||||
done
|
done
|
||||||
COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$tags") )
|
COMPREPLY+=( $(compgen -W "$tags") )
|
||||||
elif [[ "$cur" == *,* ]]; then
|
elif [[ "$cur" == *,* ]]; then
|
||||||
COMPREPLY=( ${COMPREPLY[@]} $(compgen -P "${cur%,*}," -W "$tags" -- \
|
COMPREPLY+=( $(compgen -P "${cur%,*}," -W "$tags" -- "${cur##*,}") )
|
||||||
"${cur##*,}") )
|
|
||||||
else
|
else
|
||||||
COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$tags" -- "$cur") )
|
COMPREPLY+=( $(compgen -W "$tags" -- "$cur") )
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -44,12 +43,11 @@ _lintian_checks()
|
|||||||
checks=$( echo $checks | sed -e "s/\<$name\>//g" )
|
checks=$( echo $checks | sed -e "s/\<$name\>//g" )
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$checks") )
|
COMPREPLY+=( $(compgen -W "$checks") )
|
||||||
elif [[ "$cur" == *,* ]]; then
|
elif [[ "$cur" == *,* ]]; then
|
||||||
COMPREPLY=( ${COMPREPLY[@]} $(compgen -P "${cur%,*}," -W "$checks" \
|
COMPREPLY+=( $(compgen -P "${cur%,*}," -W "$checks" -- "${cur##*,}") )
|
||||||
-- "${cur##*,}") )
|
|
||||||
else
|
else
|
||||||
COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$checks" -- "$cur") )
|
COMPREPLY+=( $(compgen -W "$checks" -- "$cur") )
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -67,12 +65,11 @@ _lintian_infos()
|
|||||||
/usr/share/lintian/collection/*.desc | cut -d: -f1 )
|
/usr/share/lintian/collection/*.desc | cut -d: -f1 )
|
||||||
infos=$( echo $infos | sed -e "s/\<$item\>//g" )
|
infos=$( echo $infos | sed -e "s/\<$item\>//g" )
|
||||||
done
|
done
|
||||||
COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$infos") )
|
COMPREPLY+=( $(compgen -W "$infos") )
|
||||||
elif [[ "$cur" == *,* ]]; then
|
elif [[ "$cur" == *,* ]]; then
|
||||||
COMPREPLY=( ${COMPREPLY[@]} $(compgen -P "${cur%,*}," -W "$infos" \
|
COMPREPLY+=( $(compgen -P "${cur%,*}," -W "$infos" -- "${cur##*,}") )
|
||||||
-- "${cur##*,}") )
|
|
||||||
else
|
else
|
||||||
COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$infos" -- "$cur") )
|
COMPREPLY+=( $(compgen -W "$infos" -- "$cur") )
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -39,8 +39,7 @@ _mplayer()
|
|||||||
_filedir ttf
|
_filedir ttf
|
||||||
fi
|
fi
|
||||||
local IFS=$'\n'
|
local IFS=$'\n'
|
||||||
COMPREPLY=( "${COMPREPLY[@]}"
|
COMPREPLY+=( $( compgen -W '$( fc-list 2>/dev/null )' -- "$cur" ) )
|
||||||
$( compgen -W '$( fc-list 2>/dev/null )' -- "$cur" ) )
|
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
-sub)
|
-sub)
|
||||||
|
@ -11,7 +11,7 @@ _muttaddr()
|
|||||||
_muttaliases "$1"
|
_muttaliases "$1"
|
||||||
_muttquery "$1"
|
_muttquery "$1"
|
||||||
|
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -u -- "$1" ) )
|
COMPREPLY+=( $( compgen -u -- "$1" ) )
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -63,7 +63,7 @@ _muttconffiles()
|
|||||||
for file in "${newconffiles[@]}"; do
|
for file in "${newconffiles[@]}"; do
|
||||||
[[ ! -f "$file" || "${sofar/ ${file} / }" != "$sofar" ]] &&
|
[[ ! -f "$file" || "${sofar/ ${file} / }" != "$sofar" ]] &&
|
||||||
continue
|
continue
|
||||||
sofar="$sofar $file"
|
sofar+=" $file"
|
||||||
sofar=" $(eval _muttconffiles \"$sofar\" $file) "
|
sofar=" $(eval _muttconffiles \"$sofar\" $file) "
|
||||||
done
|
done
|
||||||
shift
|
shift
|
||||||
@ -84,7 +84,7 @@ _muttaliases()
|
|||||||
conffiles=( $(eval _muttconffiles $muttrc $muttrc) )
|
conffiles=( $(eval _muttconffiles $muttrc $muttrc) )
|
||||||
aliases=( $( sed -n 's|^alias[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*$|\1|p' \
|
aliases=( $( sed -n 's|^alias[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*$|\1|p' \
|
||||||
$(eval echo "${conffiles[@]}") ) )
|
$(eval echo "${conffiles[@]}") ) )
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "${aliases[*]}" -- "$cur" ) )
|
COMPREPLY+=( $( compgen -W "${aliases[*]}" -- "$cur" ) )
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -104,8 +104,7 @@ _muttquery()
|
|||||||
sed -n '2,$s|^\([^[:space:]]\{1,\}\).*|\1|p' ) )
|
sed -n '2,$s|^\([^[:space:]]\{1,\}\).*|\1|p' ) )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "${queryresults[*]}" \
|
COMPREPLY+=( $( compgen -W "${queryresults[*]}" -- "$cur" ) )
|
||||||
-- "$cur" ) )
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ _mysqladmin()
|
|||||||
--print-defaults --no-defaults --defaults-file --defaults-extra-file' \
|
--print-defaults --no-defaults --defaults-file --defaults-extra-file' \
|
||||||
-- "$cur" ) )
|
-- "$cur" ) )
|
||||||
|
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" \
|
COMPREPLY+=( \
|
||||||
$( compgen -W 'create debug drop extended-status flush-hosts \
|
$( compgen -W 'create debug drop extended-status flush-hosts \
|
||||||
flush-logs flush-status flush-tables flush-threads flush-privileges \
|
flush-logs flush-status flush-tables flush-threads flush-privileges \
|
||||||
kill password old-password ping processlist reload refresh shutdown \
|
kill password old-password ping processlist reload refresh shutdown \
|
||||||
|
@ -89,7 +89,7 @@ _ldapaddmodify()
|
|||||||
options='-c -S -n -v -M -MM -d -D -W -w -y -h -H -p -P -O -I \
|
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'
|
-Q -U -R -x -X -Y -Z -ZZ -f'
|
||||||
if [[ ${COMP_WORDS[0]} == ldapmodify ]]; then
|
if [[ ${COMP_WORDS[0]} == ldapmodify ]]; then
|
||||||
options="$options -a"
|
options+=" -a"
|
||||||
fi
|
fi
|
||||||
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
|
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
|
||||||
fi
|
fi
|
||||||
|
@ -75,10 +75,10 @@ _openssl()
|
|||||||
formats='DER PEM'
|
formats='DER PEM'
|
||||||
case $command in
|
case $command in
|
||||||
x509)
|
x509)
|
||||||
formats="$formats NET"
|
formats+=" NET"
|
||||||
;;
|
;;
|
||||||
smime)
|
smime)
|
||||||
formats="$formats SMIME"
|
formats+=" SMIME"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
COMPREPLY=( $( compgen -W "$formats" -- "$cur" ) )
|
COMPREPLY=( $( compgen -W "$formats" -- "$cur" ) )
|
||||||
|
@ -48,7 +48,7 @@ _perl()
|
|||||||
;;
|
;;
|
||||||
-m|-M)
|
-m|-M)
|
||||||
temp="${cur#-}"
|
temp="${cur#-}"
|
||||||
prefix="$prefix${cur%$temp}"
|
prefix+="${cur%$temp}"
|
||||||
cur="$temp"
|
cur="$temp"
|
||||||
_perlmodules $1
|
_perlmodules $1
|
||||||
return 0
|
return 0
|
||||||
@ -56,7 +56,7 @@ _perl()
|
|||||||
-V)
|
-V)
|
||||||
if [[ $cur == :* ]]; then
|
if [[ $cur == :* ]]; then
|
||||||
temp="${cur##+(:)}"
|
temp="${cur##+(:)}"
|
||||||
prefix="$prefix${cur%$temp}"
|
prefix+="${cur%$temp}"
|
||||||
local IFS=$'\n'
|
local IFS=$'\n'
|
||||||
COMPREPLY=( $( compgen -P "$prefix" -W \
|
COMPREPLY=( $( compgen -P "$prefix" -W \
|
||||||
'$( $1 -MConfig -e "print join \"\\n\",
|
'$( $1 -MConfig -e "print join \"\\n\",
|
||||||
@ -118,7 +118,7 @@ _perldoc()
|
|||||||
# return available modules (unless it is clearly a file)
|
# return available modules (unless it is clearly a file)
|
||||||
if [[ "$cur" != */* ]]; then
|
if [[ "$cur" != */* ]]; then
|
||||||
_perlmodules $perl
|
_perlmodules $perl
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
|
COMPREPLY+=( $( compgen -W \
|
||||||
'$( PAGER=/bin/cat man perl | \
|
'$( PAGER=/bin/cat man perl | \
|
||||||
sed -ne "/perl.*Perl overview/,/perlwin32/p" | \
|
sed -ne "/perl.*Perl overview/,/perlwin32/p" | \
|
||||||
awk "\$NF=2 && \$1 ~ /^perl/ { print \$1 }" )' -- "$cur" ) )
|
awk "\$NF=2 && \$1 ~ /^perl/ { print \$1 }" )' -- "$cur" ) )
|
||||||
|
@ -38,7 +38,7 @@ _portinstall()
|
|||||||
COMPREPLY2=( $( command grep -E "^[^\|]+\|$portsdir$cur" < $indexfile | \
|
COMPREPLY2=( $( command grep -E "^[^\|]+\|$portsdir$cur" < $indexfile | \
|
||||||
cut -d'|' -f2 ) )
|
cut -d'|' -f2 ) )
|
||||||
COMPREPLY2=( ${COMPREPLY2[@]#$portsdir} )
|
COMPREPLY2=( ${COMPREPLY2[@]#$portsdir} )
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" "${COMPREPLY2[@]}" )
|
COMPREPLY+=( "${COMPREPLY2[@]}" )
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
} &&
|
} &&
|
||||||
|
@ -29,13 +29,13 @@ _puppet_certs()
|
|||||||
else
|
else
|
||||||
cert_list=$( $puppetca --list )
|
cert_list=$( $puppetca --list )
|
||||||
fi
|
fi
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$cert_list" -- "$cur" ) )
|
COMPREPLY+=( $( compgen -W "$cert_list" -- "$cur" ) )
|
||||||
}
|
}
|
||||||
|
|
||||||
_puppet_types()
|
_puppet_types()
|
||||||
{
|
{
|
||||||
puppet_types=$( puppet describe --list | sed -e 's/^\(\S\+\).*$/\1/' )
|
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()
|
_puppet_references()
|
||||||
@ -45,7 +45,7 @@ _puppet_references()
|
|||||||
&& puppetdoc=puppetdoc
|
&& puppetdoc=puppetdoc
|
||||||
|
|
||||||
puppet_doc_list=$( $puppetdoc --list | sed -e 's/^\(\S\+\).*$/\1/' )
|
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()
|
_puppet()
|
||||||
@ -171,20 +171,17 @@ _puppet()
|
|||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
--clean|--fingerprint|--revoke|--verify)
|
--clean|--fingerprint|--revoke|--verify)
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" $( compgen \
|
COMPREPLY+=( $( compgen -W '--all' -- "$cur" ) )
|
||||||
-W '--all' -- "$cur" ) )
|
|
||||||
_puppet_certs --all
|
_puppet_certs --all
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
--sign)
|
--sign)
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" $( compgen \
|
COMPREPLY+=( $( compgen -W '--all' -- "$cur" ) )
|
||||||
-W '--all' -- "$cur" ) )
|
|
||||||
_puppet_certs
|
_puppet_certs
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
--list|--print)
|
--list|--print)
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" $( compgen \
|
COMPREPLY+=( $( compgen -W '--all' -- "$cur" ) )
|
||||||
-W '--all' -- "$cur" ) )
|
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
@ -23,7 +23,7 @@ _rcs()
|
|||||||
COMPREPLY[$i]=$dir$file
|
COMPREPLY[$i]=$dir$file
|
||||||
done
|
done
|
||||||
|
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -G "$dir/$file*,v" ) )
|
COMPREPLY+=( $( compgen -G "$dir/$file*,v" ) )
|
||||||
|
|
||||||
for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
|
for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
|
||||||
COMPREPLY[$i]=${COMPREPLY[$i]%,v}
|
COMPREPLY[$i]=${COMPREPLY[$i]%,v}
|
||||||
|
@ -14,10 +14,8 @@ _rdesktop()
|
|||||||
COMPREPLY=( $( command ls \
|
COMPREPLY=( $( command ls \
|
||||||
/usr/share/rdesktop/keymaps 2>/dev/null | \
|
/usr/share/rdesktop/keymaps 2>/dev/null | \
|
||||||
command grep -E -v '(common|modifiers)' ) )
|
command grep -E -v '(common|modifiers)' ) )
|
||||||
COMPREPLY=( ${COMPREPLY[@]:-} $( command ls \
|
COMPREPLY+=( $( command ls $HOME/.rdesktop/keymaps 2>/dev/null ) )
|
||||||
$HOME/.rdesktop/keymaps 2>/dev/null ) )
|
COMPREPLY+=( $( command ls ./keymaps 2>/dev/null ) )
|
||||||
COMPREPLY=( ${COMPREPLY[@]:-} $( command ls \
|
|
||||||
./keymaps 2>/dev/null ) )
|
|
||||||
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
|
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
|
@ -15,7 +15,7 @@ ri_get_methods()
|
|||||||
regex=Class
|
regex=Class
|
||||||
fi
|
fi
|
||||||
|
|
||||||
COMPREPLY=( ${COMPREPLY[@]} \
|
COMPREPLY+=( \
|
||||||
"$( ri ${classes[@]} 2>/dev/null | ruby -ane \
|
"$( ri ${classes[@]} 2>/dev/null | ruby -ane \
|
||||||
'if /^'"$regex"' methods:/.../^------------------|^$/ and \
|
'if /^'"$regex"' methods:/.../^------------------|^$/ and \
|
||||||
/^ / then print $_.split(/, |,$/).grep(/^[^\[]*$/).join("\n"); \
|
/^ / then print $_.split(/, |,$/).grep(/^[^\[]*$/).join("\n"); \
|
||||||
@ -23,7 +23,7 @@ ri_get_methods()
|
|||||||
else
|
else
|
||||||
# older versions of ri didn't distinguish between class/module and
|
# older versions of ri didn't distinguish between class/module and
|
||||||
# instance methods
|
# instance methods
|
||||||
COMPREPLY=( ${COMPREPLY[@]} \
|
COMPREPLY+=( \
|
||||||
"$( ruby -W0 $ri_path ${classes[@]} | ruby -ane \
|
"$( ruby -W0 $ri_path ${classes[@]} | ruby -ane \
|
||||||
'if /^-/.../^-/ and ! /^-/ and ! /^ +(class|module): / then \
|
'if /^-/.../^-/ and ! /^-/ and ! /^ +(class|module): / then \
|
||||||
print $_.split(/, |,$| +/).grep(/^[^\[]*$/).join("\n"); \
|
print $_.split(/, |,$| +/).grep(/^[^\[]*$/).join("\n"); \
|
||||||
|
@ -146,7 +146,7 @@ _rpm()
|
|||||||
;;
|
;;
|
||||||
-q*|--query)
|
-q*|--query)
|
||||||
# options common to all query types
|
# options common to all query types
|
||||||
opts="$opts --changelog --configfiles --conflicts --docfiles
|
opts+=" --changelog --configfiles --conflicts --docfiles
|
||||||
--dump --enhances --filesbypkg --filecaps --fileclass
|
--dump --enhances --filesbypkg --filecaps --fileclass
|
||||||
--filecolor --fileprovide --filerequire --filesbypkg --info
|
--filecolor --fileprovide --filerequire --filesbypkg --info
|
||||||
--list --obsoletes --pipe --provides --queryformat --rcfile
|
--list --obsoletes --pipe --provides --queryformat --rcfile
|
||||||
|
@ -12,7 +12,7 @@ _smartctl_device()
|
|||||||
areca*|3ware*|megaraid*|cciss*)
|
areca*|3ware*|megaraid*|cciss*)
|
||||||
local i mycur="${cur%%,*}"
|
local i mycur="${cur%%,*}"
|
||||||
for (( i=0; i <= 31; i++ )) ; do
|
for (( i=0; i <= 31; i++ )) ; do
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" "$mycur,$i" )
|
COMPREPLY+=( "$mycur,$i" )
|
||||||
done
|
done
|
||||||
COMPREPLY=( $( compgen -W '"${COMPREPLY[@]}"' -- "$cur" ) )
|
COMPREPLY=( $( compgen -W '"${COMPREPLY[@]}"' -- "$cur" ) )
|
||||||
;;
|
;;
|
||||||
@ -20,9 +20,9 @@ _smartctl_device()
|
|||||||
local l m n
|
local l m n
|
||||||
for (( l=1; l <= 4; l++ )) ; do
|
for (( l=1; l <= 4; l++ )) ; do
|
||||||
for (( m=1; m <= 8; m++ )) ; do
|
for (( m=1; m <= 8; m++ )) ; do
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" hpt,$l/$m )
|
COMPREPLY+=( hpt,$l/$m )
|
||||||
for (( n=1; n <= 5; n++ )) ; do
|
for (( n=1; n <= 5; n++ )) ; do
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" hpt,$l/$m/$n )
|
COMPREPLY+=( hpt,$l/$m/$n )
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
@ -4,7 +4,7 @@ have ssh || return
|
|||||||
|
|
||||||
_ssh_bindaddress()
|
_ssh_bindaddress()
|
||||||
{
|
{
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
|
COMPREPLY+=( $( compgen -W \
|
||||||
"$( PATH="$PATH:/sbin" ifconfig -a | \
|
"$( PATH="$PATH:/sbin" ifconfig -a | \
|
||||||
sed -ne 's/.*addr:\([^[:space:]]*\).*/\1/p' \
|
sed -ne 's/.*addr:\([^[:space:]]*\).*/\1/p' \
|
||||||
-ne 's/.*inet[[:space:]]\{1,\}\([^[:space:]]*\).*/\1/p' )" \
|
-ne 's/.*inet[[:space:]]\{1,\}\([^[:space:]]*\).*/\1/p' )" \
|
||||||
@ -13,14 +13,14 @@ _ssh_bindaddress()
|
|||||||
|
|
||||||
_ssh_ciphers()
|
_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 \
|
aes192-cbc aes256-cbc aes128-ctr aes192-ctr aes256-ctr arcfour128 \
|
||||||
arcfour256 arcfour blowfish-cbc cast128-cbc' -- "$cur" ) )
|
arcfour256 arcfour blowfish-cbc cast128-cbc' -- "$cur" ) )
|
||||||
}
|
}
|
||||||
|
|
||||||
_ssh_macs()
|
_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' \
|
umac-64@openssh.com hmac-ripemd160 hmac-sha1-96 hmac-md5-96' \
|
||||||
-- "$cur" ) )
|
-- "$cur" ) )
|
||||||
}
|
}
|
||||||
@ -184,7 +184,7 @@ _ssh()
|
|||||||
_known_hosts_real -a -F "$configfile" "$cur"
|
_known_hosts_real -a -F "$configfile" "$cur"
|
||||||
if [ $COMP_CWORD -ne 1 ]; then
|
if [ $COMP_CWORD -ne 1 ]; then
|
||||||
_compopt_o_filenames
|
_compopt_o_filenames
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -c -- "$cur" ) )
|
COMPREPLY+=( $( compgen -c -- "$cur" ) )
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -282,7 +282,7 @@ _scp_remote_files()
|
|||||||
sed -e 's/'$_scp_path_esc'/\\\\\\&/g' -e 's/[*@|=]$//g' \
|
sed -e 's/'$_scp_path_esc'/\\\\\\&/g' -e 's/[*@|=]$//g' \
|
||||||
-e 's/[^\/]$/& /g' )
|
-e 's/[^\/]$/& /g' )
|
||||||
fi
|
fi
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" $files )
|
COMPREPLY+=( $files )
|
||||||
}
|
}
|
||||||
|
|
||||||
# This approach is used instead of _filedir to get a space appended
|
# This approach is used instead of _filedir to get a space appended
|
||||||
@ -300,10 +300,10 @@ _scp_local_files()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if $dirsonly ; then
|
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/") )
|
sed -e "s/$_scp_path_esc/\\\\&/g" -e '/[^\/]$/d' -e "s/^/$1/") )
|
||||||
else
|
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' \
|
sed -e "s/$_scp_path_esc/\\\\&/g" -e 's/[*@|=]$//g' \
|
||||||
-e 's/[^\/]$/& /g' -e "s/^/$1/") )
|
-e 's/[^\/]$/& /g' -e "s/^/$1/") )
|
||||||
fi
|
fi
|
||||||
|
@ -174,7 +174,7 @@ _svk()
|
|||||||
-s --sync -m --merge -q --quiet'
|
-s --sync -m --merge -q --quiet'
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
options="$options --help -h"
|
options+=" --help -h"
|
||||||
|
|
||||||
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
|
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
|
||||||
else
|
else
|
||||||
|
@ -150,9 +150,9 @@ _sysbench()
|
|||||||
|
|
||||||
if [[ $test ]]; then
|
if [[ $test ]]; then
|
||||||
local help=( $( _parse_help $1 "--test=$test help" ) )
|
local help=( $( _parse_help $1 "--test=$test help" ) )
|
||||||
opts="$opts ${help[@]/%/=} prepare run cleanup help version"
|
opts+=" ${help[@]/%/=} prepare run cleanup help version"
|
||||||
else
|
else
|
||||||
opts="$opts --test="
|
opts+=" --test="
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$cur" == -* || ! $test ]]; then
|
if [[ "$cur" == -* || ! $test ]]; then
|
||||||
|
@ -19,7 +19,7 @@ _iwconfig()
|
|||||||
essid)
|
essid)
|
||||||
COMPREPLY=( $( compgen -W 'on off any' -- "$cur" ) )
|
COMPREPLY=( $( compgen -W 'on off any' -- "$cur" ) )
|
||||||
if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
|
if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
|
COMPREPLY+=( $( compgen -W \
|
||||||
"$( iwlist ${COMP_WORDS[1]} scan | \
|
"$( iwlist ${COMP_WORDS[1]} scan | \
|
||||||
awk -F'\"' '/ESSID/ {print $2}' )" -- "$cur" ) )
|
awk -F'\"' '/ESSID/ {print $2}' )" -- "$cur" ) )
|
||||||
fi
|
fi
|
||||||
@ -43,7 +43,7 @@ _iwconfig()
|
|||||||
ap)
|
ap)
|
||||||
COMPREPLY=( $( compgen -W 'on off any' -- "$cur" ) )
|
COMPREPLY=( $( compgen -W 'on off any' -- "$cur" ) )
|
||||||
if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
|
if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
|
COMPREPLY+=( $( compgen -W \
|
||||||
"$( iwlist ${COMP_WORDS[1]} scan | \
|
"$( iwlist ${COMP_WORDS[1]} scan | \
|
||||||
awk -F ': ' '/Address/ {print $2}' )" -- "$cur" ) )
|
awk -F ': ' '/Address/ {print $2}' )" -- "$cur" ) )
|
||||||
fi
|
fi
|
||||||
@ -51,7 +51,7 @@ _iwconfig()
|
|||||||
;;
|
;;
|
||||||
rate)
|
rate)
|
||||||
COMPREPLY=( $( compgen -W 'auto fixed' -- "$cur" ) )
|
COMPREPLY=( $( compgen -W 'auto fixed' -- "$cur" ) )
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
|
COMPREPLY+=( $( compgen -W \
|
||||||
"$( iwlist ${COMP_WORDS[1]} rate | \
|
"$( iwlist ${COMP_WORDS[1]} rate | \
|
||||||
awk '/^[ \t]*[0-9]/ {print $1"M"}' )" -- "$cur" ) )
|
awk '/^[ \t]*[0-9]/ {print $1"M"}' )" -- "$cur" ) )
|
||||||
return 0
|
return 0
|
||||||
|
@ -98,12 +98,10 @@ _cdrecord()
|
|||||||
# files are always eligible completion
|
# files are always eligible completion
|
||||||
_filedir
|
_filedir
|
||||||
# track options are always available
|
# track options are always available
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" \
|
COMPREPLY+=( $( compgen -W '${track_options[@]}' -- "$cur" ) )
|
||||||
$( compgen -W '${track_options[@]}' -- "$cur" ) )
|
|
||||||
# general options are no more available after file or track option
|
# general options are no more available after file or track option
|
||||||
if [ $track_mode -eq 0 ]; then
|
if [ $track_mode -eq 0 ]; then
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" \
|
COMPREPLY+=( $( compgen -W '${generic_options[@]}' -- "$cur" ) )
|
||||||
$( compgen -W '${generic_options[@]}' -- "$cur" ) )
|
|
||||||
fi
|
fi
|
||||||
[[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} != *= ]] && \
|
[[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} != *= ]] && \
|
||||||
compopt +o nospace &>/dev/null
|
compopt +o nospace &>/dev/null
|
||||||
|
@ -193,7 +193,7 @@ _xm()
|
|||||||
;;
|
;;
|
||||||
create)
|
create)
|
||||||
_filedir
|
_filedir
|
||||||
COMPREPLY=( ${COMPREPLY[@]:-} \
|
COMPREPLY+=( \
|
||||||
$( compgen -W '$( command ls /etc/xen 2>/dev/null )' \
|
$( compgen -W '$( command ls /etc/xen 2>/dev/null )' \
|
||||||
-- "$cur" ) )
|
-- "$cur" ) )
|
||||||
;;
|
;;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user