Merge branch 'master' into garik

Conflicts:
	contrib/pkgtools
This commit is contained in:
Igor Murzov 2010-07-04 17:06:21 +04:00
commit faeb77c23d
544 changed files with 2530 additions and 1924 deletions

67
CHANGES
View File

@ -1,5 +1,23 @@
bash-completion (2.x)
[ David Paleino ]
* Fixed "service" completion, thanks to John Hedges (Debian: #586210)
[ Ville Skyttä ]
* Activate hping2 completion also for hping and hping3.
* Add crontab and lrzip completions.
* Add gif to mplayer filename completions (Alioth: #312512).
* Add "short" tarball extensions to unxz, unlzma etc completions.
* Improve /etc/init.d/* and sqlite3 completions.
[ Freddy Vulto ]
* Added _tilde(), fix ~username completion (Alioth: #312613, Debian: #587095)
* Speed up `compopt' availability detection
-- David Paleino <d.paleino@gmail.com> Wed, 16 Jun 2010 17:53:22 +0200
bash-completion (1.2)
[ David Paleino ]
* Don't use pidof in _known_hosts_real() to detect whether Avahi is
available, since it's not available on MacOS X. Thanks to Rainer
@ -16,6 +34,12 @@ bash-completion (2.x)
* Style policy: don't use fancy globbing in case labels
* Added .fdf completion to okular and evince
* Added .okular completion to okular (Debian: #545530)
* Added lintian completion
* Refreshed reportbug completion, added --from-buildd (Debian: #579471)
* Special-case "apt-get source" (Debian: #572000)
* Added lintian completion (Debian: #547361)
* contrib/dpkg: update completion to current API
* Styleguide: establish line wrapping and $() instead of ``
[ Ville Skyttä ]
* Create bz2 dist tarball too.
@ -27,13 +51,13 @@ bash-completion (2.x)
* Remove many unnecessary short option completions where long ones exist.
* Improve chsh, chgrp, chown, configure, curl, cvs, find, gkrellm, gzip,
iconv, lftp, look, lzma, make, man, mdadm, modprobe, mount, mplayer,
mysqladmin, perldoc, rsync, screen, service, scp, ssh, sshfs,
mysqladmin, perldoc, rsync, screen, service, scp, ssh, sshfs, unzip,
update-alternatives, vncviewer, wget, yp-tools, xine based players' and
general hostname completions.
* Add abook and wtf completion, based on work by Raphaël Droz.
* Add cvsps, dragon, fusermount, jarsigner, k3b, lftpget, pm-utils, rtcwake,
pack200, unpack200, pbzip2, pbunzip2, pbzcat, pigz, unpigz, and wol
completions.
* Add cvsps, dragon, fusermount, jarsigner, k3b, lftpget, modplug123,
pm-utils, rtcwake, pack200, unpack200, pbzip2, pbunzip2, pbzcat, pigz,
unpigz, and wol completions.
* Don't overwrite other host completions when completing from multiple
SSH known hosts files.
* Speed up installed rpm package completion on SUSE, based on work by
@ -45,16 +69,22 @@ bash-completion (2.x)
to using the complete/compgen features directly, and BASH_VERSINFO
for bash version checks.
* Protect various completions from unusual user input by not embedding the
input in external command arguments (Debian: 552631).
input in external command arguments (Debian: #552631).
* Add /sbin to $PATH when invoking ifconfig and iwconfig.
* Combine dcop and qdbus completions into the latter.
* awk and sed usage portability fixes (Alioth: #311393).
* awk and sed usage portability fixes (Alioth: #311393, Debian: #501479).
* Fix leaking local variables from various completions.
* Turn on -o filenames in _filedir on bash >= 4.
* Deprecate modules completion, upstream modules >= 3.2.7 ships one.
* Protect grep invocations from user aliases (Alioth: 312143).
* Protect grep invocations from user aliases (Alioth: #312143).
* Split sshfs completion from contrib/ssh into contrib/sshfs.
* Split mount and umount completion into contrib/mount.
* Split service completion into contrib/service.
* Split chown, chgrp, and id completions into contrib/coreutils.
* Split kill, look, and renice completions into contrib/util-linux.
* Split killall, pkill, pgrep and related completions into contrib/procps.
* Split ipsec completion into contrib/ipsec.
* Split ifup and ifdown completions into contrib/ifupdown.
* Do basic HTML file completion with Firefox and Chrome and friends,
and Epiphany.
* Do basic diff/patch completion with cdiff and kompare.
@ -63,13 +93,25 @@ bash-completion (2.x)
* Do meta-command completion for aoss and padsp.
[ Freddy Vulto ]
* Added _get_pword() helper function, thanks to Sung Pae (Alioth: #312030)
* Prevent root PATH expansion prolifering in _root_command (bash >= 4.1.4)
* Only complete xhost if (_)xhost is available.
* Added _get_comp_words_by_ref to replace both _get_cword & _get_pword.
Also additional variables `words' and `cword' can be returned.
* Added _upvar & _upvars helper functions to aid in passing variables
by reference.
* Make _filedir emulate `-o filenames'
* Fixed completion perl modules containing colons.
* Merged __get_cword3 & __get_cword4 to _get_cword.
* Added __expand_tilde_by_ref helper function.
* Added __ltrim_colon_completions to fix completions containing colons
* Improved mutt completion
* Added _get_pword helper function, thanks to Sung Pae (Alioth: #312030)
[ Ted Stern ]
* Fix modules completion for "(default)" entries.
[ Jeremie Lasalle Ratelle ]
* Fix rsync remote path completion (Alioth: #312173).
* Fix rsync remote path completion (Alioth: #312173, Gentoo: #297818).
[ Leonard Crestez ]
* Improve ssh -o suboption completion (Alioth: #312122).
@ -77,7 +119,8 @@ bash-completion (2.x)
* Fix completion of usernames (Alioth: #311396, Debian: #511788).
* Fix chown test crashing on systems with no root group (Alioth: #312306).
* Fixed tests when BASH_COMPLETION or TESTDIR contain spaces.
* Fix mount handling of escapes (Alioth: #311410, Launchpad: #219971).
* Fix mount handling of escapes (Alioth: #311410, Launchpad: #219971,
Debian: #511149).
* Cleanup scripts to run tests. Make runUnit and runCompletion use test/run.
Make it possible to run tests from any directory.
* Add a --debug-xtrace option to test/run using BASH_XTRACEFD from bash-4.1.
@ -102,12 +145,12 @@ bash-completion (2.x)
* Improve xz completion (Alioth: #312466).
[ Mario Schwalbe ]
* Update find completion (Alioth: #312491).
* Update find completion (Alioth: #312491, Launchpad: #570113).
[ Mark van Rossum ]
* Add basic lyx completion.
-- David Paleino <d.paleino@gmail.com> Sun, 11 Oct 2009 11:11:57 +0200
-- David Paleino <d.paleino@gmail.com> Wed, 16 Jun 2010 17:44:59 +0200
bash-completion (1.1)

View File

@ -25,9 +25,11 @@ bashcomp_DATA = contrib/abook \
contrib/cksfv \
contrib/clisp \
contrib/configure \
contrib/coreutils \
contrib/cowsay \
contrib/cpan2dist \
contrib/cpio \
contrib/crontab \
contrib/cups \
contrib/cryptsetup \
contrib/cvs \
@ -54,10 +56,12 @@ bashcomp_DATA = contrib/abook \
contrib/heimdal \
contrib/hping2 \
contrib/iconv \
contrib/ifupdown \
contrib/imagemagick \
contrib/info \
contrib/iptables \
contrib/ipmitool \
contrib/ipsec \
contrib/ipv6calc \
contrib/isql \
contrib/jar \
@ -69,7 +73,9 @@ bashcomp_DATA = contrib/abook \
contrib/lftp \
contrib/lilo \
contrib/links \
contrib/lintian \
contrib/lisp \
contrib/lrzip \
contrib/lvm \
contrib/lzma \
contrib/lzop \
@ -108,6 +114,7 @@ bashcomp_DATA = contrib/abook \
contrib/postfix \
contrib/postgresql \
contrib/povray \
contrib/procps \
contrib/python \
contrib/qdbus \
contrib/qemu \
@ -127,10 +134,12 @@ bashcomp_DATA = contrib/abook \
contrib/samba \
contrib/sbcl \
contrib/screen \
contrib/service \
contrib/shadow \
contrib/sitecopy \
contrib/smartctl \
contrib/snownews \
contrib/sqlite3 \
contrib/ssh \
contrib/sshfs \
contrib/strace \
@ -142,10 +151,12 @@ bashcomp_DATA = contrib/abook \
contrib/unace \
contrib/unrar \
contrib/update-alternatives \
contrib/util-linux \
contrib/vncviewer \
contrib/vpnc \
contrib/wireless-tools \
contrib/wodim \
contrib/wol \
contrib/wtf \
contrib/wvdial \
contrib/xhost \

View File

@ -70,14 +70,15 @@ complete -d pushd
# START exclude -- do NOT remove this line
# bzcmp, bzdiff, bz*grep, bzless, bzmore intentionally not here, see Debian: #455510
complete -f -X '!*.?(t)bz?(2)' bunzip2 bzcat pbunzip2 pbzcat
complete -f -X '!*.@(zip|ZIP|[ejw]ar|[EJW]AR|exe|EXE|pk3|wsz|zargo|xpi|sxw|ott|od[fgpst]|epub)' unzip zipinfo
complete -f -X '!*.@(zip|ZIP|[ejw]ar|[EJW]AR|exe|EXE|pk3|wsz|zargo|xpi|sxw|o[tx]t|od[fgpst]|epub)' unzip zipinfo
complete -f -X '*.Z' compress znew
# zcmp, zdiff, z*grep, zless, zmore intentionally not here, see Debian: #455510
complete -f -X '!*.@(Z|[gGd]z|t[ag]z)' gunzip zcat unpigz
complete -f -X '!*.Z' uncompress
# lzcmp, lzdiff intentionally not here, see Debian: #455510
complete -f -X '!*.lzma' lzcat lzegrep lzfgrep lzgrep lzless lzmore unlzma
complete -f -X '!*.@(xz|lzma)' unxz xzcat
complete -f -X '!*.@(tlz|lzma)' lzcat lzegrep lzfgrep lzgrep lzless lzmore unlzma
complete -f -X '!*.@(?(t)xz|tlz|lzma)' unxz xzcat
complete -f -X '!*.lrz' lrunzip
complete -f -X '!*.@(gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx|GIF|JP?(E)G|MIFF|TIF?(F)|PN[GM]|P[BGP]M|BMP|XPM|ICO|XWD|TGA|PCX)' ee
complete -f -X '!*.@(gif|jp?(e)g|tif?(f)|png|p[bgp]m|bmp|x[bp]m|rle|rgb|pcx|fits|pm|GIF|JPG|JP?(E)G|TIF?(F)|PNG|P[BGP]M|BMP|X[BP]M|RLE|RGB|PCX|FITS|PM)' xv qiv
complete -f -X '!*.@(@(?(e)ps|?(E)PS|pdf|PDF)?(.gz|.GZ|.bz2|.BZ2|.Z))' gv ggv kghostview
@ -92,7 +93,7 @@ complete -f -X '!*.@(?(e)ps|?(E)PS|pdf|PDF)' ps2pdf ps2pdf12 ps2pdf13 ps2pdf14 p
complete -f -X '!*.texi*' makeinfo texi2html
complete -f -X '!*.@(?(la)tex|?(LA)TEX|texi|TEXI|dtx|DTX|ins|INS|ltx|LTX)' tex latex slitex jadetex pdfjadetex pdftex pdflatex texi2dvi
complete -f -X '!*.@(mp3|MP3)' mpg123 mpg321 madplay
complete -f -X '!*@(.@(mp?(e)g|MP?(E)G|wma|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|wmv|mp[234]|MP[234]|m4[pv]|M4[PV]|mkv|MKV|og[gmv]|OG[GMV]|wav|WAV|flac|FLAC|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM)|+([0-9]).@(vdr|VDR))' xine aaxine fbxine kaffeine dragon
complete -f -X '!*@(.@(mp?(e)g|MP?(E)G|wma|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|wmv|mp[234]|MP[234]|m4[pv]|M4[PV]|mkv|MKV|og[gmv]|OG[GMV]|t[ps]|T[PS]|wav|WAV|flac|FLAC|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM)|+([0-9]).@(vdr|VDR))' xine aaxine fbxine kaffeine dragon
complete -f -X '!*.@(avi|asf|wmv)' aviplay
complete -f -X '!*.@(rm?(j)|ra?(m)|smi?(l))' realplay
complete -f -X '!*.@(mpg|mpeg|avi|mov|qt)' xanim
@ -101,7 +102,7 @@ complete -f -X '!*.@(mp3|MP3|ogg|OGG|pls|m3u)' gqmpeg freeamp
complete -f -X '!*.fig' xfig
complete -f -X '!*.@(mid?(i)|MID?(I)|cmf|CMF)' playmidi
complete -f -X '!*.@(mid?(i)|MID?(I)|rmi|RMI|rcp|RCP|[gr]36|[GR]36|g18|G18|mod|MOD|xm|XM|it|IT|x3m|X3M|s[3t]m|S[3T]M|kar|KAR)' timidity
complete -f -X '!*.@(m[eo]d|M[EO]D|s[3t]m|S[3T]M|xm|XM|it|IT)' modplugplay
complete -f -X '!*.@(m[eo]d|M[EO]D|s[3t]m|S[3T]M|xm|XM|it|IT)' modplugplay modplug123
complete -f -X '*.@(o|so|so.!(conf)|a|rpm|gif|GIF|jp?(e)g|JP?(E)G|mp3|MP3|mp?(e)g|MPG|avi|AVI|asf|ASF|ogg|OGG|class|CLASS)' vi vim gvim rvim view rview rgvim rgview gview emacs xemacs sxemacs kate kwrite
complete -f -X '!*.@([eE][xX][eE]?(.[sS][oO])|[cC][oO][mM]|[sS][cC][rR])' wine
complete -f -X '!*.@(zip|ZIP|z|Z|gz|GZ|tgz|TGZ)' bzme
@ -114,7 +115,6 @@ complete -f -X '!*.@(sxd|std|sda|sdd|odg|otg)' oodraw
complete -f -X '!*.@(sxm|smf|mml|odf)' oomath
complete -f -X '!*.odb' oobase
complete -f -X '!*.rpm' rpm2cpio
complete -f -X '!*.sqlite' sqlite3
complete -f -X '!*.aux' bibtex
complete -f -X '!*.po' poedit gtranslator kbabel lokalize
complete -f -X '!*.@([Pp][Rr][Gg]|[Cc][Ll][Pp])' harbour gharbour hbpp
@ -204,6 +204,68 @@ dequote()
}
# Assign variable one scope above the caller
# Usage: local "$1" && _upvar $1 "value(s)"
# Param: $1 Variable name to assign value to
# Param: $* Value(s) to assign. If multiple values, an array is
# assigned, otherwise a single value is assigned.
# NOTE: For assigning multiple variables, use '_upvars'. Do NOT
# use multiple '_upvar' calls, since one '_upvar' call might
# reassign a variable to be used by another '_upvar' call.
# See: http://fvue.nl/wiki/Bash:_Passing_variables_by_reference
_upvar() {
if unset -v "$1"; then # Unset & validate varname
if (( $# == 2 )); then
eval $1=\"\$2\" # Return single value
else
eval $1=\(\"\${@:2}\"\) # Return array
fi
fi
}
# Assign variables one scope above the caller
# Usage: local varname [varname ...] &&
# _upvars [-v varname value] | [-aN varname [value ...]] ...
# Available OPTIONS:
# -aN Assign next N values to varname as array
# -v Assign single value to varname
# Return: 1 if error occurs
# See: http://fvue.nl/wiki/Bash:_Passing_variables_by_reference
_upvars() {
if ! (( $# )); then
echo "${FUNCNAME[0]}: usage: ${FUNCNAME[0]} [-v varname"\
"value] | [-aN varname [value ...]] ..." 1>&2
return 2
fi
while (( $# )); do
case $1 in
-a*)
# Error checking
[[ ${1#-a} ]] || { echo "bash: ${FUNCNAME[0]}: \`$1': missing"\
"number specifier" 1>&2; return 1; }
printf %d "${1#-a}" &> /dev/null || { echo "bash:"\
"${FUNCNAME[0]}: \`$1': invalid number specifier" 1>&2
return 1; }
# Assign array of -aN elements
[[ "$2" ]] && unset -v "$2" && eval $2=\(\"\${@:3:${1#-a}}\"\) &&
shift $((${1#-a} + 2)) || { echo "bash: ${FUNCNAME[0]}:"\
"\`$1${2+ }$2': missing argument(s)" 1>&2; return 1; }
;;
-v)
# Assign single value
[[ "$2" ]] && unset -v "$2" && eval $2=\"\$3\" &&
shift 3 || { echo "bash: ${FUNCNAME[0]}: $1: missing"\
"argument(s)" 1>&2; return 1; }
;;
*)
echo "bash: ${FUNCNAME[0]}: $1: invalid option" 1>&2
return 1 ;;
esac
done
}
# Reassemble command line words, excluding specified characters from the
# list of word completion separators (COMP_WORDBREAKS).
# @param $1 chars Characters out of $COMP_WORDBREAKS which should
@ -248,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;
@ -267,30 +329,10 @@ __reassemble_comp_words_by_ref() {
# @param $4 cur Name of variable to return current word to complete to
# @see ___get_cword_at_cursor_by_ref()
__get_cword_at_cursor_by_ref() {
# NOTE: The call to the main function ___get_cword_at_cursor_by_ref() is
# wrapped to make collisions with local variable names less likely.
local __words __cword __cur
___get_cword_at_cursor_by_ref "$1" __words __cword __cur
eval $2=\( \"\${__words[@]}\" \)
eval $3=\$__cword
eval $4=\$__cur
}
# @param $1 exclude
# @param $2 words Name of variable to return words to
# @param $3 cword Name of variable to return cword to
# @param $4 cur Name of variable to return current word to complete to
# @note Do not call this function directly but call
# `__get_cword_at_cursor_by_ref()' instead to make variable name collisions
# less likely
# @see __get_cword_at_cursor_by_ref()
___get_cword_at_cursor_by_ref() {
local cword words
local cword words=()
__reassemble_comp_words_by_ref "$1" words cword
local i
local i cur2
local cur="$COMP_LINE"
local index="$COMP_POINT"
for (( i = 0; i <= cword; ++i )); do
@ -318,13 +360,13 @@ ___get_cword_at_cursor_by_ref() {
if [[ "${words[cword]:0:${#cur}}" != "$cur" ]]; then
# We messed up. At least return the whole word so things keep working
eval $4=\"\${words[cword]}\"
cur2=${words[cword]}
else
eval $4=\"\${cur:0:\$index}\"
cur2=${cur:0:$index}
fi
eval $2=\( \"\${words[@]}\" \)
eval $3=\$cword
local "$2" "$3" "$4" &&
_upvars -a${#words[@]} $2 "${words[@]}" -v $3 "$cword" -v $4 "$cur2"
}
@ -334,62 +376,66 @@ ___get_cword_at_cursor_by_ref() {
# (For example, if the line is "ls foobar",
# and the cursor is here --------> ^
# Also one is able to cross over possible wordbreak characters.
# Usage: _get_comp_words_by_ref [OPTIONS] VAR1 [VAR2 [VAR3]]
# Usage: _get_comp_words_by_ref [OPTIONS] [VARNAMES]
# Available VARNAMES:
# cur Return cur via $cur
# prev Return prev via $prev
# words Return words via $words
# cword Return cword via $cword
#
# Available OPTIONS:
# -n EXCLUDE Characters out of $COMP_WORDBREAKS which should NOT be
# considered word breaks. This is useful for things like scp
# where we want to return host:path and not only path, so we
# would pass the colon (:) as -n option in this case. Bash-3
# doesn't do word splitting, so this ensures we get the same
# word on both bash-3 and bash-4.
# -c VARNAME Return cur via $VARNAME
# -p VARNAME Return prev via $VARNAME
# -w VARNAME Return words via $VARNAME
# -i VARNAME Return cword via $VARNAME
#
# Example usage:
#
# $ _get_comp_words_by_ref -n : cur prev
#
# Options: -n EXCLUDE Characters out of $COMP_WORDBREAKS which should NOT
# be considered word breaks. This is useful for things like scp where
# we want to return host:path and not only path, so we would pass the
# colon (:) as -n option in this case. Bash-3 doesn't do word splitting,
# so this ensures we get the same word on both bash-3 and bash-4.
# @see __get_comp_words_by_ref
_get_comp_words_by_ref() {
# NOTE: The call to the main function __get_comp_words_by_ref() is wrapped
# to make collisions with local variable name less likely.
local __words __cword __cur __var __vars
__get_comp_words_by_ref __words __cword __cur __vars "$@"
set -- "${__vars[@]}"
eval $1=\$__cur
shift
for __var; do
((__cword--))
[[ ${__words[__cword]} ]] && eval $__var=\${__words[__cword]}
done
}
# @param $1 words Name of variable to return words to
# @param $2 cword Name of variable to return cword to
# @param $3 cur Name of variable to return current word to complete to
# @param $4 varnames Name of variable to return array of variable names to
# @param $@ Arguments to _get_comp_words_by_ref()
# @note Do not call this function directly but call `_get_comp_words_by_ref()'
# instead to make variable name collisions less likely
# @see _get_comp_words_by_ref()
__get_comp_words_by_ref()
_get_comp_words_by_ref()
{
local exclude flag i OPTIND=5 # Skip first four arguments
local cword words cur varnames=()
while getopts "n:" flag "$@"; do
local exclude flag i OPTIND=1
local cur cword words=()
local upargs=() upvars=() vcur vcword vprev vwords
while getopts "c:i:n:p:w:" flag "$@"; do
case $flag in
c) vcur=$OPTARG ;;
i) vcword=$OPTARG ;;
n) exclude=$OPTARG ;;
p) vprev=$OPTARG ;;
w) vwords=$OPTARG ;;
esac
done
varnames=( ${!OPTIND} )
let "OPTIND += 1"
while [[ $# -ge $OPTIND ]]; do
varnames+=( ${!OPTIND} )
case ${!OPTIND} in
cur) vcur=cur ;;
prev) vprev=prev ;;
cword) vcword=cword ;;
words) vwords=words ;;
*) echo "bash: $FUNCNAME(): \`${!OPTIND}': unknown argument" \
1>&2; return 1
esac
let "OPTIND += 1"
done
__get_cword_at_cursor_by_ref "$exclude" words cword cur
eval $1=\( \"\${words[@]}\" \)
eval $2=\$cword
eval $3=\$cur
eval $4=\( \"\${varnames[@]}\" \)
[[ $vcur ]] && { upvars+=("$vcur" ); upargs+=(-v $vcur "$cur" ); }
[[ $vcword ]] && { upvars+=("$vcword"); upargs+=(-v $vcword "$cword"); }
[[ $vprev ]] && { upvars+=("$vprev" ); upargs+=(-v $vprev
"${words[cword - 1]}"); }
[[ $vwords ]] && { upvars+=("$vwords"); upargs+=(-a${#words[@]} $vwords
"${words[@]}"); }
(( ${#upvars[@]} )) && local "${upvars[@]}" && _upvars "${upargs[@]}"
}
@ -407,7 +453,8 @@ __get_comp_words_by_ref()
# current word (default is 0, previous is 1), respecting the exclusions
# given at $1. For example, `_get_cword "=:" 1' returns the word left of
# the current word, respecting the exclusions "=:".
#
# @deprecated Use `_get_comp_words_by_ref cur' instead
# @see _get_comp_words_by_ref()
_get_cword()
{
local LC_CTYPE=C
@ -417,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
@ -461,7 +508,8 @@ _get_cword()
# This is a good alternative to `prev=${COMP_WORDS[COMP_CWORD-1]}' because bash4
# will properly return the previous word with respect to any given exclusions to
# COMP_WORDBREAKS.
# @see _get_cword()
# @deprecated Use `_get_comp_words_by_ref cur prev' instead
# @see _get_comp_words_by_ref()
#
_get_pword()
{
@ -520,16 +568,32 @@ __ltrim_colon_completions() {
# $ compgen -f "a\\\\\'b/" # Good (bash-3)
# a\'b/c
#
# See also: http://lists.gnu.org/archive/html/bug-bash/2009-03/msg00155.html
# On bash-3, special characters need to be escaped extra. This is
# unless the first character is a single quote ('). If the single
# quote appears further down the string, bash default completion also
# fails, e.g.:
#
# $ ls 'a&b/'
# f
# $ foo 'a&b/<TAB> # Becomes: foo 'a&b/f'
# $ foo a'&b/<TAB> # Nothing happens
#
# See also:
# - http://lists.gnu.org/archive/html/bug-bash/2009-03/msg00155.html
# - http://www.mail-archive.com/bash-completion-devel@lists.alioth.\
# debian.org/msg01944.html
# @param $1 Argument to quote
# @param $2 Name of variable to return result to
_quote_readline_by_ref()
{
if [[ ${1:0:1} == "'" ]]; then
if [[ ${BASH_VERSINFO[0]} -ge 4 ]]; then
# Leave out first character
printf -v $2 %s "${1:1}"
else
# Quote word, leaving out first character
printf -v $2 %q "${1:1}"
if [[ ${BASH_VERSINFO[0]} -le 3 ]]; then
# Double-quote word on bash-3
# Double-quote word (bash-3)
printf -v $2 %q ${!2}
fi
elif [[ ${BASH_VERSINFO[0]} -le 3 && ${1:0:1} == '"' ]]; then
@ -554,7 +618,7 @@ _filedir()
{
local i IFS=$'\t\n' xspec
__expand_tilde_by_ref cur
_tilde "$cur" || return 0
local -a toks
local quoted tmp
@ -573,30 +637,12 @@ _filedir()
}
))
# On bash-3, special characters need to be escaped extra. This is
# unless the first character is a single quote ('). If the single
# quote appears further down the string, bash default completion also
# fails, e.g.:
#
# $ ls 'a&b/'
# f
# $ foo 'a&b/<TAB> # Becomes: foo 'a&b/f'
# $ foo a'&b/<TAB> # Nothing happens
#
if [[ "$1" != -d ]]; then
xspec=${1:+"!*.$1"}
if [[ ${cur:0:1} == "'" && ${BASH_VERSINFO[0]} -ge 4 ]]; then
toks=( ${toks[@]-} $(
eval compgen -f -X \"\$xspec\" -- $quoted
) )
else
toks=( ${toks[@]-} $(
compgen -f -X "$xspec" -- $quoted
) )
fi
toks=( ${toks[@]-} $( compgen -f -X "$xspec" -- $quoted) )
if [ ${#toks[@]} -ne 0 ]; then
# If `compopt' is available, set `-o filenames'
compopt &>/dev/null && compopt -o filenames ||
type compopt &>/dev/null && compopt -o filenames ||
# No, `compopt' isn't available;
# Is `-o filenames' set?
[[ (
@ -757,7 +803,26 @@ _available_interfaces()
}
# Perform tilde (~) completion
# @return True (0) if completion needs further processing,
# False (> 0) if tilde is followed by a valid username, completions
# are put in COMPREPLY and no further processing is necessary.
_tilde() {
local result=0
# Does $1 start with tilde (~) and doesn't contain slash (/)?
if [[ ${1:0:1} == "~" && $1 == ${1//\/} ]]; then
# Try generate username completions
COMPREPLY=( $( compgen -P '~' -u "${1#\~}" ) )
result=${#COMPREPLY[@]}
fi
return $result
}
# Expand variable starting with tilde (~)
# We want to expand ~foo/... to /home/foo/... to avoid problems when
# word-to-complete starting with a tilde is fed to commands and ending up
# quoted instead of expanded.
# Only the first portion of the variable from the tilde up to the first slash
# (~../) is expanded. The remainder of the variable, containing for example
# a dollar sign variable ($) or asterisk (*) is not expanded.
@ -1082,299 +1147,13 @@ _dvd_devices()
patch configure build install reinstall deinstall clean clean-depends \
kernel buildworld' make
# This completes on a list of all available service scripts for the
# 'service' command and/or the SysV init.d directory, followed by
# that script's available commands
#
{ have service || [ -d /etc/init.d/ ]; } &&
_service()
{
local cur prev sysvdir
COMPREPLY=()
prev=${COMP_WORDS[COMP_CWORD-1]}
cur=`_get_cword`
# don't complete for things like killall, ssh and mysql if it's
# the standalone command, rather than the init script
[[ ${COMP_WORDS[0]} != @(*init.d/!(functions|~)|service) ]] && return 0
# don't complete past 2nd token
[ $COMP_CWORD -gt 2 ] && return 0
[ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d
if [[ $COMP_CWORD -eq 1 ]] && [[ $prev == "service" ]]; then
_services
else
COMPREPLY=( $( compgen -W '`sed -e "y/|/ /" \
-ne "s/^.*\(U\|msg_u\)sage.*{\(.*\)}.*$/\2/p" \
$sysvdir/${prev##*/} 2>/dev/null`' -- "$cur" ) )
fi
return 0
} &&
complete -F _service service
[ -d /etc/init.d/ ] && complete -F _service -o default \
$(for i in /etc/init.d/*; do printf '%s\n' ${i##*/}; done)
# chown(1) completion
#
_chown()
{
local cur prev split=false
# Get cur and prev words; but don't treat user:group as separate words.
cur=`_get_cword :`
prev=`_get_pword :`
_split_longopt && split=true
case "$prev" in
--from)
_usergroup
return 0
;;
--reference)
_filedir
return 0
;;
esac
$split && return 0
if [[ "$cur" == -* ]]; then
# Complete -options
local w opts
for w in "${COMP_WORDS[@]}" ; do
[[ "$w" == -@(R|-recursive) ]] && opts="-H -L -P" && break
done
COMPREPLY=( $( compgen -W '-c -h -f -R -v --changes --dereference \
--no-dereference --from --silent --quiet --reference --recursive \
--verbose --help --version $opts' -- "$cur" ) )
else
local args
# The first argument is an usergroup; the rest are filedir.
_count_args :
if [[ $args == 1 ]]; then
_usergroup
else
_filedir
fi
fi
} # _chown()
complete -F _chown -o filenames chown
# chgrp(1) completion
#
_chgrp()
{
local cur prev split=false
COMPREPLY=()
cur=`_get_cword`
cur=${cur//\\\\/}
prev=${COMP_WORDS[COMP_CWORD-1]}
_split_longopt && split=true
if [[ "$prev" == --reference ]]; then
_filedir
return 0
fi
$split && return 0
# options completion
if [[ "$cur" == -* ]]; then
local w opts
for w in "${COMP_WORDS[@]}" ; do
[[ "$w" == -@(R|-recursive) ]] && opts="-H -L -P" && break
done
COMPREPLY=( $( compgen -W '-c -h -f -R -v --changes --dereference \
--no-dereference --silent --quiet --reference --recursive \
--verbose --help --version $opts' -- "$cur" ) )
return 0
fi
# first parameter on line or first since an option?
if [[ $COMP_CWORD -eq 1 && "$cur" != -* || "$prev" == -* ]]; then
local IFS=$'\n'
COMPREPLY=( $( compgen -g "$cur" 2>/dev/null ) )
else
_filedir || return 0
fi
return 0
} # _chgrp()
complete -F _chgrp -o filenames chgrp
# renice(8) completion
#
_renice()
{
local command cur curopt i
COMPREPLY=()
cur=`_get_cword`
command=$1
i=0
# walk back through command line and find last option
while [[ $i -le $COMP_CWORD && ${#COMPREPLY[@]} -eq 0 ]]; do
curopt=${COMP_WORDS[COMP_CWORD-$i]}
case "$curopt" in
-u)
COMPREPLY=( $( compgen -u -- "$cur" ) )
;;
-g)
_pgids
;;
-p|$command)
_pids
;;
esac
i=$(( ++i ))
done
}
complete -F _renice renice
# kill(1) completion
#
_kill()
{
local cur
COMPREPLY=()
cur=`_get_cword`
if [[ $COMP_CWORD -eq 1 && "$cur" == -* ]]; then
# return list of available signals
_signals
else
# return list of available PIDs
_pids
fi
}
complete -F _kill kill
# killall(1) (Linux and FreeBSD) and pkill(1) completion.
#
[[ $UNAME == Linux || $UNAME == FreeBSD ]] || have pkill &&
_killall()
{
local cur
COMPREPLY=()
cur=`_get_cword`
if [[ $COMP_CWORD -eq 1 && "$cur" == -* ]]; then
_signals
else
_pnames
fi
return 0
}
[[ $UNAME == Linux || $UNAME == FreeBSD ]] && complete -F _killall killall
have pkill && complete -F _killall pkill
# pgrep(1) completion.
#
[ $UNAME = Linux ] || have pgrep &&
_pgrep()
{
local cur
COMPREPLY=()
cur=`_get_cword`
_pnames
return 0
}
have pgrep && complete -F _pgrep pgrep
# Linux pidof(8) completion.
[ $UNAME = Linux ] && complete -F _pgrep pidof
# Red Hat & Debian GNU/Linux if{up,down} completion
#
[ $USERLAND = GNU ] && { have ifup || have ifdown; } &&
_ifupdown()
{
local cur
COMPREPLY=()
cur=`_get_cword`
if [ $COMP_CWORD -eq 1 ]; then
_configured_interfaces
COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- "$cur") )
fi
return 0
} &&
complete -F _ifupdown ifup ifdown
[ $USERLAND = GNU ] && have ifstatus && complete -F _ifupdown ifstatus
# Linux ipsec(8) completion (for FreeS/WAN)
#
[ $UNAME = Linux ] && have ipsec &&
_ipsec()
{
local cur
COMPREPLY=()
cur=`_get_cword`
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $( compgen -W 'auto barf eroute klipsdebug look manual \
pluto ranbits rsasigkey setup showdefaults showhostkey spi spigrp \
tncfg whack' -- "$cur" ) )
return 0
fi
case ${COMP_WORDS[1]} in
auto)
COMPREPLY=( $( compgen -W '--asynchronous --up --add --delete \
--replace --down --route --unroute \
--ready --status --rereadsecrets' \
-- "$cur" ) )
;;
manual)
COMPREPLY=( $( compgen -W '--up --down --route --unroute \
--union' -- "$cur" ) )
;;
ranbits)
COMPREPLY=( $( compgen -W '--quick --continuous --bytes' \
-- "$cur" ) )
;;
setup)
COMPREPLY=( $( compgen -W '--start --stop --restart' -- "$cur" ) )
;;
*)
;;
esac
return 0
} &&
complete -F _ipsec ipsec
# This function provides simple user@host completion
#
_user_at_host() {
local cur
COMPREPLY=()
cur=`_get_cword :`
_get_comp_words_by_ref -n : cur
if [[ $cur == *@* ]]; then
_known_hosts_real "$cur"
@ -1580,7 +1359,8 @@ complete -F _known_hosts traceroute traceroute6 tracepath tracepath6 ping \
#
_cd()
{
local IFS=$'\t\n' cur=`_get_cword` i j k
local cur IFS=$'\t\n' i j k
_get_comp_words_by_ref cur
# try to allow variable completion
if [[ "$cur" == ?(\\)\$* ]]; then
@ -1683,7 +1463,7 @@ _command_offset()
COMP_CWORD=$(( $COMP_CWORD - $word_offset ))
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [[ $COMP_CWORD -eq 0 ]]; then
COMPREPLY=( $( compgen -c -- "$cur" ) )
@ -1729,7 +1509,8 @@ complete -F _command -o filenames nohup exec nice eval time ltrace then \
_root_command()
{
PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin _command $1 $2 $3
local PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin
_command $1 $2 $3
}
complete -F _root_command -o filenames sudo fakeroot really gksudo gksu kdesudo
@ -1737,8 +1518,7 @@ _longopt()
{
local cur prev
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
if _split_longopt; then
case "$prev" in
@ -1778,48 +1558,13 @@ for i in env netstat seq uname units; do
done
unset i
# look(1) completion
#
have look &&
_look()
{
local cur
COMPREPLY=()
cur=`_get_cword`
if [ $COMP_CWORD = 1 ]; then
COMPREPLY=( $( compgen -W '$(look "$cur" 2>/dev/null)' -- "$cur" ) )
fi
} &&
complete -F _look -o default look
# id(1) completion
#
have id &&
_id()
{
local cur
COMPREPLY=()
cur=`_get_cword`
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-a -g --group -G --groups -n --name\
-r --real -u --user --help --version' -- "$cur" ) )
else
COMPREPLY=( $( compgen -u "$cur" ) )
fi
} &&
complete -F _id id
_filedir_xspec()
{
local IFS cur xspec
IFS=$'\t\n'
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
_expand || return 0

View File

@ -9,8 +9,7 @@ _mock()
local cur prev plugins cfgdir split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
plugins='tmpfs root_cache yum_cache bind_mount ccache'
cfgdir=/etc/mock

View File

@ -49,8 +49,7 @@ _module ()
local cur prev options
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
if [ $COMP_CWORD -eq 1 ] ; then
# First parameter on line -- we expect it to be a mode selection

View File

@ -10,7 +10,7 @@ _svn()
local cur prev commands options command
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur prev
commands='add blame praise annotate ann cat checkout co cleanup commit \
ci copy cp delete del remove rm diff di export help ? h import \
@ -27,7 +27,6 @@ _svn()
fi
else
prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in
--config-dir)
_filedir -d
@ -280,7 +279,7 @@ _svnadmin()
local cur prev commands options mode
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur prev
commands='create deltify dump help ? hotcopy list-dblogs \
list-unused-dblogs load lslocks lstxns recover rmlocks \
@ -293,7 +292,6 @@ _svnadmin()
COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
fi
else
prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in
--config-dir)
_filedir -d
@ -359,7 +357,7 @@ _svnlook()
local cur prev commands options mode
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
commands='author cat changed date diff dirs-changed help ? h history \
info lock log propget pget pg proplist plist pl tree uuid \

View File

@ -39,8 +39,7 @@ _yum()
local cur prev special i split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
if [[ ${COMP_WORDS[i]} == @(install|update|upgrade|remove|erase|deplist|info) ]]; then

View File

@ -9,8 +9,7 @@ _repomanage()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
[[ "$prev" == -@(h|-help|k|-keep) ]] && return 0

View File

@ -6,8 +6,7 @@ _abook()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
# abook only takes options, tabbing after command name adds a single
# dash (bash4)

View File

@ -7,8 +7,7 @@ _ant()
local cur prev buildfile i
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-buildfile|-file|-f)

View File

@ -5,7 +5,7 @@ _apache2ctl() {
local APWORDS cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
APWORDS=$(apache2ctl 2>&1 >/dev/null | awk 'NR<2 { print $3; exit }' | \
tr "|" " ")

View File

@ -6,8 +6,7 @@ _apt_get()
local cur prev special i
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
if [[ ${COMP_WORDS[i]} == @(install|remove|autoremove|purge|source|build-dep) ]]; then
@ -27,6 +26,12 @@ _apt_get()
fi
return 0
;;
source)
COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" \
2> /dev/null ) $( apt-cache dumpavail | \
command grep "^Source: $cur" | sort -u | cut -f2 -d" " ) )
return 0
;;
*)
COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" \
2> /dev/null ) )
@ -76,9 +81,7 @@ _apt_cache()
local cur prev special i
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
if [ "$cur" != show ]; then
for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do

View File

@ -6,8 +6,7 @@ _apt_build()
local cur prev special i
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
if [[ ${COMP_WORDS[i]} == @(install|remove|source|info|clean) ]]; then

View File

@ -19,9 +19,7 @@ _aptitude()
local cur dashoptions prev special i
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
dashoptions='-S -u -i -h --help --version -s --simulate -d \
--download-only -P --prompt -y --assume-yes -F \

View File

@ -19,8 +19,7 @@ _aspell()
local cur prev split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
_split_longopt && split=true

View File

@ -6,7 +6,7 @@ _autorpm()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
COMPREPLY=( $( compgen -W '--notty --debug --help --version auto add \
fullinfo info help install list remove set' -- "$cur" ) )

View File

@ -5,7 +5,7 @@ _alias()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
case $COMP_LINE in
*[^=])
@ -26,7 +26,7 @@ _export()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
case $COMP_LINE in
*=\$*)
@ -52,8 +52,7 @@ _function()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
if [[ $1 == @(declare|typeset) ]]; then
if [ "$prev" = -f ]; then
@ -76,8 +75,7 @@ _complete()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-o)

View File

@ -6,7 +6,7 @@ _nslookup()
local cur
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]#-}
_get_comp_words_by_ref cur
COMPREPLY=( $( compgen -P '-' -W 'all class= debug d2 domain= srchlist= \
defname search port= querytype= type= recurse retry root timeout vc \

View File

@ -5,7 +5,7 @@ _bk() {
local BKCMDS
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
BKCMDS="$( bk help topics | awk '/^ bk/ { print $4 }' | \
xargs printf '%s ' )"

View File

@ -7,8 +7,7 @@ _btdownload()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
--responsefile|--saveas)

View File

@ -33,8 +33,7 @@ _hcitool()
local cur prev split=false arg
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
_split_longopt && split=true
@ -116,8 +115,7 @@ _sdptool()
local cur prev split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
_split_longopt && split=true
@ -178,8 +176,7 @@ _l2ping()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-i)
@ -202,8 +199,7 @@ _rfcomm()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-f|--config)
@ -248,8 +244,7 @@ _ciptool()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-i)
@ -285,8 +280,7 @@ _dfutool()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-d|--device)
@ -317,7 +311,7 @@ _hciconfig()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
_get_first_arg
if [ -z $arg ]; then
@ -363,7 +357,7 @@ _hciattach()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-n -p -t -b -s -l' -- "$cur" ) )
@ -401,7 +395,7 @@ _hid2hci()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--help --quiet -0 --tohci -1 \
@ -415,7 +409,7 @@ _avctrl()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--help --quiet' -- "$cur" ) )

View File

@ -6,7 +6,7 @@ _brctl()
local cur command
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
command=${COMP_WORDS[1]}
case $COMP_CWORD in

View File

@ -6,8 +6,7 @@ _bzip2()
local cur prev xspec helpopts
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
helpopts=`_parse_help ${COMP_WORDS[0]}`
case $prev in

View File

@ -6,7 +6,7 @@ _cardctl()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $( compgen -W 'status config ident suspend \

View File

@ -17,8 +17,7 @@ _cfagent()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-f|--file)
@ -35,10 +34,10 @@ complete -F _cfagent cfagent
_cfrun()
{
local i section cfinputs
local i section cfinputs cur prev
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur prev
section=1
for (( i=1; i < COMP_CWORD; i++ )); do
@ -49,7 +48,6 @@ _cfrun()
case $section in
1)
prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in
-f)
_filedir

View File

@ -6,8 +6,7 @@ _chkconfig()
local cur prev split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
_split_longopt && split=true

View File

@ -5,8 +5,7 @@ _chsh()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
--list-shells|--help|-v|--version)

View File

@ -3,15 +3,17 @@
have cksfv &&
_cksfv()
{
local cur prev
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur prev
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $( compgen -W '-C -f -i -q -v' -- "$cur" ) )
return 0
fi
case ${COMP_WORDS[$COMP_CWORD-1]} in
case "$prev" in
-C)
_filedir -d
return 0

View File

@ -7,7 +7,7 @@ _clisp()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
# completing an option (may or may not be separated by a space)
if [[ "$cur" == -* ]]; then

3
contrib/configure vendored
View File

@ -5,8 +5,7 @@ _configure()
local cur prev split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
_split_longopt && split=true

122
contrib/coreutils Normal file
View File

@ -0,0 +1,122 @@
# Completions for various core utilities
# chown(1) completion
#
have chown &&
_chown()
{
local cur prev split=false
# Get cur and prev words; but don't treat user:group as separate words.
_get_comp_words_by_ref -n : cur prev
_split_longopt && split=true
case "$prev" in
--from)
_usergroup
return 0
;;
--reference)
_filedir
return 0
;;
esac
$split && return 0
if [[ "$cur" == -* ]]; then
# Complete -options
local w opts
for w in "${COMP_WORDS[@]}" ; do
[[ "$w" == -@(R|-recursive) ]] && opts="-H -L -P" && break
done
COMPREPLY=( $( compgen -W '-c -h -f -R -v --changes --dereference \
--no-dereference --from --silent --quiet --reference --recursive \
--verbose --help --version $opts' -- "$cur" ) )
else
local args
# The first argument is an usergroup; the rest are filedir.
_count_args :
if [[ $args == 1 ]]; then
_usergroup
else
_filedir
fi
fi
} &&
complete -F _chown -o filenames chown
# chgrp(1) completion
#
have chgrp &&
_chgrp()
{
local cur prev split=false
COMPREPLY=()
_get_comp_words_by_ref cur prev
cur=${cur//\\\\/}
_split_longopt && split=true
if [[ "$prev" == --reference ]]; then
_filedir
return 0
fi
$split && return 0
# options completion
if [[ "$cur" == -* ]]; then
local w opts
for w in "${COMP_WORDS[@]}" ; do
[[ "$w" == -@(R|-recursive) ]] && opts="-H -L -P" && break
done
COMPREPLY=( $( compgen -W '-c -h -f -R -v --changes --dereference \
--no-dereference --silent --quiet --reference --recursive \
--verbose --help --version $opts' -- "$cur" ) )
return 0
fi
# first parameter on line or first since an option?
if [[ $COMP_CWORD -eq 1 && "$cur" != -* || "$prev" == -* ]]; then
local IFS=$'\n'
COMPREPLY=( $( compgen -g "$cur" 2>/dev/null ) )
else
_filedir || return 0
fi
return 0
} &&
complete -F _chgrp -o filenames chgrp
# id(1) completion
#
have id &&
_id()
{
local cur
COMPREPLY=()
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-a -g --group -G --groups -n --name\
-r --real -u --user --help --version' -- "$cur" ) )
else
COMPREPLY=( $( compgen -u "$cur" ) )
fi
} &&
complete -F _id id
# Local variables:
# mode: shell-script
# sh-basic-offset: 4
# sh-indent-comment: t
# indent-tabs-mode: nil
# End:
# ex: ts=4 sw=4 et filetype=sh

View File

@ -6,8 +6,7 @@ _cowsay()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-f)

View File

@ -6,8 +6,7 @@ _cpan2dist()
local cur prev packagelist cpandirs
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
--format)

View File

@ -11,8 +11,7 @@ _cpio()
local cur prev split=false
COMPREPLY=()
cur=`_get_cword :`
prev=`_get_pword :`
_get_comp_words_by_ref -n : cur prev
_split_longopt && split=true

60
contrib/crontab Normal file
View File

@ -0,0 +1,60 @@
# crontab(1) completion
have crontab &&
_crontab()
{
local cur prev
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in
-u)
COMPREPLY=( $( compgen -u -- "$cur" ) )
return 0
;;
esac
local i opts=" -u -l -r -e" # leading space at start is significant...
[ "$(uname -s)" = Linux ] && opts="$opts -i"
[ -e /etc/selinux ] && opts="$opts -s"
for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
case "${COMP_WORDS[i]}" in
-l)
opts=${opts// -l -r -e/}
opts=${opts// -i/}
opts=${opts// -s/}
;;
-e)
opts=${opts// -l -r -e/}
opts=${opts// -i/}
;;
-r)
opts=${opts// -l -r -e/}
;;
-u)
opts=${opts// -u/}
opts=${opts// -i/}
;;
-i|-s)
opts=${opts// ${COMP_WORDS[i]}/}
;;
esac
done
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$opts' -- "$cur" ) )
return 0
fi
# do filenames only if we did not have -l, -r, or -e
[[ "${COMP_LINE}" == *\ -@(l|r|e)* ]] || _filedir
} &&
complete -F _crontab -o filenames crontab
# Local variables:
# mode: shell-script
# sh-basic-offset: 4
# sh-indent-comment: t
# indent-tabs-mode: nil
# End:
# ex: ts=4 sw=4 et filetype=sh

View File

@ -6,7 +6,7 @@ _cancel()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
COMPREPLY=( $( compgen -W "$( lpstat | cut -d' ' -f1 )" -- "$cur" ) )
} &&

View File

@ -60,8 +60,7 @@ _cvs()
local -a flags miss files entries changed newremoved
COMPREPLY=()
cur=`_get_cword :`
prev=`_get_pword :`
_get_comp_words_by_ref -n : cur prev
count=0
for i in "${COMP_WORDS[@]}"; do
@ -239,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

@ -4,7 +4,8 @@ have cvsps &&
_cvsps()
{
COMPREPLY=()
local cur=`_get_cword :` prev=`_get_pword :`
local cur prev
_get_comp_words_by_ref -n : cur prev
case $prev in
-h|-z|-f|-d|-l|--diff-opts|--debuglvl)

View File

@ -6,7 +6,7 @@ _dd()
local cur
COMPREPLY=()
cur=`_get_cword =`
_get_comp_words_by_ref -n = cur
case $cur in
if=*|of=*)

View File

@ -5,8 +5,7 @@ have dhclient && _dhclient()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-cf|-lf|-pf|-sf)

View File

@ -12,8 +12,7 @@ _dict()
local cur prev host port db dictfile
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
dictfile=/usr/share/dict/words
for (( i=1; i < COMP_CWORD; i++ )); do

View File

@ -6,8 +6,7 @@ _dselect()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
--admindir)

View File

@ -6,8 +6,7 @@ _arpspoof()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=`_get_pword`
_get_comp_words_by_ref cur prev
case $prev in
-i)
@ -35,8 +34,7 @@ _dnsspoof()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-i)
@ -62,8 +60,7 @@ _dsniff()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-r|-w|-f)
@ -89,8 +86,7 @@ _snarf()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-i)
@ -112,8 +108,7 @@ _macof()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-i)
@ -136,7 +131,7 @@ _sshmitm()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-d -I -p' -- "$cur" ) )
@ -153,8 +148,7 @@ _sshow()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-i)
@ -176,8 +170,7 @@ _tcpkill()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-i)
@ -199,8 +192,7 @@ _tcpnice()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-i)
@ -222,8 +214,7 @@ _urlsnarf()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-i)
@ -245,7 +236,7 @@ _webmitm()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-d' -- "$cur" ) )

View File

@ -8,8 +8,7 @@ _find()
local cur prev i exprfound onlyonce
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-maxdepth|-mindepth)

View File

@ -6,8 +6,7 @@ _civserver()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-f|-g|-l|-r|--file|--log|--gamelog|--read)
@ -31,8 +30,7 @@ _civclient()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-l|-S|-t|--log|--Sound|--tiles)

View File

@ -4,7 +4,8 @@ have fusermount &&
_fusermount()
{
COMPREPLY=()
local cur=`_get_cword` prev=`_get_pword`
local cur prev
_get_comp_words_by_ref cur prev
case $prev in
-h|-V|-o)

View File

@ -14,7 +14,7 @@ _gcc()
local cur cc backend
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
_expand || return 0

View File

@ -7,7 +7,7 @@ _gcl()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
# completing an option (may or may not be separated by a space)
if [[ "$cur" == -* ]]; then

View File

@ -6,8 +6,7 @@ _gdb()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
if [ $COMP_CWORD -eq 1 ]; then
local IFS

View File

@ -6,8 +6,7 @@ _mkisofs()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-o|-abstract|-biblio|-check-session|-copyright|-log-file| \

View File

@ -6,8 +6,7 @@ _getent()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
passwd)

View File

@ -6,8 +6,7 @@ _gkrellm()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-t|--theme)

View File

@ -6,7 +6,7 @@ _gnatmake()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
# relevant (and less relevant ;-) )options completion

View File

@ -6,8 +6,7 @@ _gpg()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-s|--sign|--clearsign|--decrypt-files|--load-extension)

View File

@ -6,8 +6,7 @@ _gpg2 ()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
--homedir)

View File

@ -6,8 +6,7 @@ _gzip()
local cur prev xspec helpopts
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
helpopts=`_parse_help ${COMP_WORDS[0]}`
case $prev in

View File

@ -28,8 +28,7 @@ _ktutil()
local cur prev command options split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
_split_longopt && split=true

View File

@ -1,6 +1,6 @@
# bash completion for hping2
have hping2 &&
have hping || have hping2 || have hping3 &&
_hping2()
{
local cur prev
@ -44,7 +44,7 @@ _hping2()
_known_hosts_real "$cur"
fi
} &&
complete -F _hping2 hping2 hping
complete -F _hping2 hping hping2 hping3
# Local variables:
# mode: shell-script

View File

@ -6,8 +6,7 @@ _iconv()
local cur prev split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
_split_longopt && split=true

27
contrib/ifupdown Normal file
View File

@ -0,0 +1,27 @@
# Red Hat & Debian GNU/Linux if{up,down} completion
#
[ $USERLAND = GNU ] && { have ifup || have ifdown; } &&
_ifupdown()
{
local cur
COMPREPLY=()
_get_comp_words_by_ref cur
if [ $COMP_CWORD -eq 1 ]; then
_configured_interfaces
COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- "$cur") )
fi
return 0
} &&
complete -F _ifupdown ifup ifdown
[ $USERLAND = GNU ] && have ifstatus && complete -F _ifupdown ifstatus
# Local variables:
# mode: shell-script
# sh-basic-offset: 4
# sh-indent-comment: t
# indent-tabs-mode: nil
# End:
# ex: ts=4 sw=4 et filetype=sh

View File

@ -3,8 +3,8 @@
have convert && {
_ImageMagick()
{
local prev
prev=${COMP_WORDS[COMP_CWORD-1]}
local cur prev
_get_comp_words_by_ref cur prev
case $prev in
-channel)
@ -135,7 +135,7 @@ _convert()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
_ImageMagick
@ -196,7 +196,7 @@ _mogrify()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
_ImageMagick
@ -252,7 +252,7 @@ _display()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
_ImageMagick
@ -292,7 +292,7 @@ _animate()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
_ImageMagick
@ -326,7 +326,7 @@ _identify()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
_ImageMagick
@ -351,7 +351,7 @@ _montage()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
_ImageMagick
@ -389,7 +389,7 @@ _composite()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
_ImageMagick
@ -424,7 +424,7 @@ _compare()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
_ImageMagick
@ -451,7 +451,7 @@ _conjure()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
_ImageMagick
@ -471,7 +471,7 @@ _import()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
_ImageMagick
@ -502,7 +502,7 @@ _stream()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
_ImageMagick

View File

@ -6,7 +6,7 @@ _info()
local cur i infopath
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
_expand || return 0

View File

@ -6,8 +6,7 @@ _ipmitool()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-I)

51
contrib/ipsec Normal file
View File

@ -0,0 +1,51 @@
# Linux ipsec(8) completion (for FreeS/WAN)
#
[ $UNAME = Linux ] && have ipsec &&
_ipsec()
{
local cur
COMPREPLY=()
_get_comp_words_by_ref cur
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $( compgen -W 'auto barf eroute klipsdebug look manual \
pluto ranbits rsasigkey setup showdefaults showhostkey spi spigrp \
tncfg whack' -- "$cur" ) )
return 0
fi
case ${COMP_WORDS[1]} in
auto)
COMPREPLY=( $( compgen -W '--asynchronous --up --add --delete \
--replace --down --route --unroute \
--ready --status --rereadsecrets' \
-- "$cur" ) )
;;
manual)
COMPREPLY=( $( compgen -W '--up --down --route --unroute \
--union' -- "$cur" ) )
;;
ranbits)
COMPREPLY=( $( compgen -W '--quick --continuous --bytes' \
-- "$cur" ) )
;;
setup)
COMPREPLY=( $( compgen -W '--start --stop --restart' -- "$cur" ) )
;;
*)
;;
esac
return 0
} &&
complete -F _ipsec ipsec
# Local variables:
# mode: shell-script
# sh-basic-offset: 4
# sh-indent-comment: t
# indent-tabs-mode: nil
# End:
# ex: ts=4 sw=4 et filetype=sh

View File

@ -6,8 +6,7 @@ _iptables()
local cur prev table chain
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
chain='s/^Chain \([^ ]\{1,\}\).*$/\1/p'
if [[ $COMP_LINE == *-t\ *filter* ]]; then

View File

@ -4,8 +4,9 @@ _ipv6calc()
local cur prev split=false
COMPREPLY=()
cur=`_get_cword =`
prev=`_get_pword`
_get_comp_words_by_ref -n = cur prev
#cur=`_get_cword =`
#prev=`_get_pword`
_split_longopt && split=true

View File

@ -4,7 +4,7 @@ have isql &&
_isql()
{
local cur
cur=`_get_cword`
_get_comp_words_by_ref cur
[ -f "$ODBCINI" ] \
&& COMPREPLY=( $( command grep \\["$cur" "$ODBCINI" | tr -d \\[\\] ) )

View File

@ -6,7 +6,7 @@ _jar()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [ $COMP_CWORD = 1 ]; then
COMPREPLY=( $( compgen -W 'c t x u' -- "$cur" ) )

View File

@ -121,8 +121,7 @@ _java()
local cur prev i
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
for ((i=1; i < $COMP_CWORD; i++)); do
case ${COMP_WORDS[$i]} in
@ -174,8 +173,7 @@ _javadoc()
COMPREPLY=()
local cur prev classpath
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-overview|-helpfile|-stylesheetfile)
@ -222,8 +220,7 @@ _javac()
COMPREPLY=()
local cur prev
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-d)
@ -253,7 +250,8 @@ have pack200 &&
_pack200()
{
COMPREPLY=()
local cur=`_get_cword` prev=`_get_pword`
local cur prev
_get_comp_words_by_ref cur prev
case $prev in
-S|--segment-limit|-P|--pass-file|-C|--class-attribute|\
@ -320,7 +318,8 @@ have unpack200 &&
_unpack200()
{
COMPREPLY=()
local cur=`_get_cword` prev=`_get_pword`
local cur prev
_get_comp_words_by_ref cur prev
case $prev in
'-?'|-h|--help|-V|--version|-J)
@ -365,7 +364,8 @@ have jarsigner &&
_jarsigner()
{
COMPREPLY=()
local cur=`_get_cword` prev=`_get_pword`
local cur prev
_get_comp_words_by_ref cur prev
case $prev in
-keystore)

View File

@ -3,7 +3,8 @@
have k3b &&
_k3b()
{
local cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]}
local cur prev
_get_comp_words_by_ref cur prev
COMPREPLY=()
case $prev in

View File

@ -9,7 +9,7 @@ _kldload()
moddir=/modules/
[ -d $moddir ] || moddir=/boot/kernel/
cur=`_get_cword`
_get_comp_words_by_ref cur
COMPREPLY=( $( compgen -f "$moddir$cur" ) )
COMPREPLY=( ${COMPREPLY[@]#$moddir} )
@ -22,7 +22,7 @@ complete -F _kldload -o filenames kldload
_kldunload()
{
local cur
cur=`_get_cword`
_get_comp_words_by_ref cur
COMPREPLY=( $( kldstat | \
sed -ne "s/^.*[ \t]\{1,\}\($cur[a-z_]\{1,\}\).ko$/\1/p" ) )
}

View File

@ -6,8 +6,7 @@ _larch()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
if [[ $COMP_CWORD -eq 1 || "$prev" == -* ]]; then
COMPREPLY=( $( compgen -W ' \

View File

@ -6,8 +6,7 @@ _ldapvi()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-h|--host)

View File

@ -6,8 +6,7 @@ _lftp()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-f)
@ -34,7 +33,8 @@ have lftpget &&
_lftpget()
{
COMPREPLY=()
local cur=`_get_cword`
local cur
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]] ; then
COMPREPLY=( $( compgen -W '-c -d -v' -- "$cur" ) )

View File

@ -12,8 +12,7 @@ _lilo()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-C|-i|-m|-s|-S)

View File

@ -6,7 +6,7 @@ _links()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
case $cur in
--*)

186
contrib/lintian Normal file
View File

@ -0,0 +1,186 @@
# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
# ex: ts=8 sw=8 noet filetype=sh
#
# bash completion for lintian(1) and lintian-info(1)
have lintian && {
_lintian_tags() {
local match search tags
tags=$( grep -e ^Tag /usr/share/lintian/checks/*.desc | cut -d\ -f2 )
if [[ "$cur" == *, ]]; then
search=${cur//,/ }
for item in $search; do
match=$(grep -nE "^Tag: $item$" /usr/share/lintian/checks/*.desc \
| cut -d: -f1 )
tags=$( echo $tags | sed -e "s/\<$item\>//g" )
done
COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$tags") )
elif [[ "$cur" == *,* ]]; then
COMPREPLY=( ${COMPREPLY[@]} $(compgen -P "${cur%,*}," -W "$tags" -- \
"${cur##*,}") )
else
COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$tags" -- "$cur") )
fi
return 0
}
_lintian_checks() {
local match search todisable checks
checks=$(grep -e ^Check-Script -e ^Abbrev \
/usr/share/lintian/checks/*.desc | cut -d\ -f2 )
if [[ "$cur" == *, ]]; then
search=${cur//,/ }
for item in $search; do
match=$(grep -nE "^(Check-Script|Abbrev): $item$" \
/usr/share/lintian/checks/*.desc | cut -d: -f1 )
todisable=$(grep -e ^Check-Script -e ^Abbrev $match | \
cut -d\ -f2 )
for name in $todisable; do
checks=$( echo $checks | sed -e "s/\<$name\>//g" )
done
done
COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$checks") )
elif [[ "$cur" == *,* ]]; then
COMPREPLY=( ${COMPREPLY[@]} $(compgen -P "${cur%,*}," -W "$checks" \
-- "${cur##*,}") )
else
COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$checks" -- "$cur") )
fi
return 0
}
_lintian_infos() {
local match search infos
infos=$(grep -e ^Collector /usr/share/lintian/collection/*.desc \
| cut -d\ -f2 )
if [[ "$cur" == *, ]]; then
search=${cur//,/ }
for item in $search; do
match=$( grep -nE "^Collector: $item$" \
/usr/share/lintian/collection/*.desc | cut -d: -f1 )
infos=$( echo $infos | sed -e "s/\<$item\>//g" )
done
COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$infos") )
elif [[ "$cur" == *,* ]]; then
COMPREPLY=( ${COMPREPLY[@]} $(compgen -P "${cur%,*}," -W "$infos" \
-- "${cur##*,}") )
else
COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$infos" -- "$cur") )
fi
return 0
}
_lintian_arches() {
return 0
}
_lintian() {
local cur prev action lint_actions general_opts behaviour_opts \
configuration_opts selection_opts
_get_comp_words_by_ref cur prev
lint_actions="--setup-lab --remove-lab --check --check-part --tags \
--tags-from-file --ftp-master-rejects --dont-check-part \
--unpack --remove"
general_opts="--help --version --print-version --verbose --debug --quiet"
behaviour_opts="--info --display-info --display-experimental --pedantic \
--display-level --suppress-tags --unpack-level \
--suppress-tags-from-file --no-override --show-overrides \
--color --unpack-info --md5sums --checksums --allow-root \
--fail-on-warnings --keep-lab"
configuration_opts="--cfg --lab --archivedir --dist --area --section \
--arch --root"
selection_opts="--all --binary --source --udeb --packages-file"
if [[ "$prev" = -* ]]; then
case $prev in
-C|--check-part|-X|--dont-check-part)
_lintian_checks
;;
-T|--tags|--suppress-tags)
_lintian_tags
;;
--tags-from-file|--suppress-tags-from-file|--cfg|-p|\
--packages-file)
_filedir
;;
--lab|--archivedir|--dist|--root)
_filedir -d
;;
-l|--unpack-level)
COMPREPLY=($(compgen -W "0 none 1 basic 2 contents" -- \
"$cur"))
;;
--color)
COMPREPLY=($(compgen -W "never always auto html" -- "$cur"))
;;
-U|--unpack-info)
_lintian_infos
;;
--area|--section)
COMPREPLY=($(compgen -W "main contrib non-free" -- "$cur"))
;;
--arch)
;;
esac
fi
case "$cur" in
--*)
COMPREPLY=($(compgen -W "$lint_actions $general_opts \
$behaviour_opts $configuration_opts" -- "$cur"))
;;
*,)
# If we're here, the user is trying to complete on
# --action tag,tag,<TAB>
# Only few actions permit that, re-complete them now.
echo $prev
case "$prev" in
-C|--check-part|-X|--dont-check-part)
_lintian_checks
;;
-T|--tags|--suppress-tags)
_lintian_tags
;;
-U|--unpack-info)
_lintian_infos
;;
esac
;;
*)
_filedir '@(?(u)deb|changes|dsc)'
;;
esac
return 0
}
_lintian_info() {
local cur prev
_get_comp_words_by_ref cur prev
case "$prev" in
-t|--tags)
_lintian_tags
return 0
;;
esac
case "$cur" in
--*)
COMPREPLY=($(compgen -W "--annotate --help --tags" -- "$cur"))
;;
*)
_filedir
;;
esac
return 0
}
complete -F _lintian -o filenames lintian
complete -F _lintian_info -o filenames lintian-info
}

View File

@ -7,7 +7,7 @@ _lisp()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
# completing an option (may or may not be separated by a space)
if [[ "$cur" == -* ]]; then

63
contrib/lrzip Normal file
View File

@ -0,0 +1,63 @@
# lrzip(1) completion
have lrzip &&
_lrzip()
{
COMPREPLY=()
local cur prev
_get_comp_words_by_ref cur prev
if [[ "$cur" == -* && $prev != -N ]]; then
COMPREPLY=( $( compgen -W '-w -d -o -O -S -f -D -q -L -n -l -b -g -M \
-T -N -v -vv -V -h' -- "$cur" ) )
return 0
fi
local xspec="*.lrz"
case $prev in
-w|-S|-V|-h)
return 0
;;
-d)
xspec="!"$xspec
;;
-o)
_filedir
return 0
;;
-O)
_filedir -d
return 0
;;
-L)
COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9' -- "$cur" ) )
return 0
;;
-T)
COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9 10' -- "$cur" ) )
return 0
;;
-N)
COMPREPLY=( $( compgen -W '-20 -19 -18 -17 -16 -15 -14 -13 -12 \
-11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 \
12 13 14 15 16 17 18 19' -- "$cur" ) )
return 0
;;
esac
_expand || return 0
local IFS=$'\t\n'
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) )
} &&
complete -F _lrzip -o filenames lrzip
# Local variables:
# mode: shell-script
# sh-basic-offset: 4
# sh-indent-comment: t
# indent-tabs-mode: nil
# End:
# ex: ts=4 sw=4 et filetype=sh

View File

@ -49,7 +49,7 @@ _lvmdiskscan()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--debug --help \
@ -63,7 +63,7 @@ _pvscan()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--debug --exported --novolumegroup \
@ -78,8 +78,7 @@ _pvs()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-o|-O|--options|--sort)
@ -111,8 +110,7 @@ _pvdisplay()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
--units)
@ -135,8 +133,7 @@ _pvchange()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-A|-x|--autobackup|--allocatable)
@ -161,8 +158,7 @@ _pvcreate()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
--restorefile)
@ -200,8 +196,7 @@ _pvmove()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-A|--autobackup)
@ -228,7 +223,7 @@ _pvremove()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--debug --force \
@ -244,7 +239,7 @@ _vgscan()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--debug --help \
@ -259,8 +254,7 @@ _vgs()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-o|-O|--options|--sort)
@ -294,8 +288,7 @@ _vgdisplay()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
--units)
@ -319,8 +312,7 @@ _vgchange()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-a|-A|-x|--available|--autobackup|--resizeable)
@ -346,8 +338,7 @@ _vgcreate()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-A|--autobackup)
@ -385,7 +376,7 @@ _vgremove()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--debug --help --test \
@ -401,8 +392,7 @@ _vgrename()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-A|--autobackup)
@ -425,8 +415,7 @@ _vgreduce()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-A|--autobackup)
@ -456,8 +445,7 @@ _vgextend()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-A|--autobackup)
@ -489,7 +477,7 @@ _vgport()
local cur prev
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--all --debug \
@ -502,10 +490,10 @@ complete -F _vgport vgimport vgexport
_vgck()
{
local cur prev
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--debug \
@ -521,8 +509,7 @@ _vgconvert()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-M|--metadatatype)
@ -554,8 +541,7 @@ _vgcfgbackup()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-f|--file)
@ -579,8 +565,7 @@ _vgcfgrestore()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-f|--file)
@ -612,8 +597,7 @@ _vgmerge()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-A|--autobackup)
@ -636,8 +620,7 @@ _vgsplit()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-A|--autobackup)
@ -670,7 +653,7 @@ _vgmknodes()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--debug --help --verbose \
@ -686,7 +669,7 @@ _lvscan()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--blockdevice --debug \
@ -701,8 +684,7 @@ _lvs()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-o|-O|--options|--sort)
@ -733,8 +715,7 @@ _lvdisplay()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
--units)
@ -757,8 +738,7 @@ _lvchange()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-a|-A|-C|-M|--available|--autobackup|--continguous|--persistent)
@ -789,8 +769,7 @@ _lvcreate()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-A|-C|-M|-Z|--autobackup|--continguous|--persistent|--zero)
@ -834,8 +813,7 @@ _lvremove()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-A|--autobackup)
@ -858,8 +836,7 @@ _lvrename()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-A|--autobackup)
@ -882,8 +859,7 @@ _lvreduce()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-A|--autobackup)
@ -911,8 +887,7 @@ _lvresize()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-A|--autobackup)
@ -946,8 +921,7 @@ _lvextend()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-A|--autobackup)
@ -981,7 +955,7 @@ _lvm()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $( compgen -W 'dumpconfig help lvchange \

View File

@ -6,8 +6,7 @@ _lzma()
local cur prev xspec
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-1 -2 -3 -4 -5 -6 -7 -8 -9 \

View File

@ -6,8 +6,7 @@ _lzop()
local cur prev xspec
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-1 -2 -3 -4 -5 -6 -7 -8 -9 -P \

View File

@ -11,7 +11,7 @@ _list_lists()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--advertised --virtual-host-overview \
@ -28,8 +28,7 @@ _add_members()
local cur prev split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
_split_longopt && split=true
@ -63,8 +62,7 @@ _remove_members()
local cur prev split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
_split_longopt && split=true
@ -93,8 +91,7 @@ _find_member()
local cur prev split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
_split_longopt && split=true
@ -121,8 +118,7 @@ _clone_member()
local cur prev split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
_split_longopt && split=true
@ -149,8 +145,7 @@ _sync_members()
local cur prev split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
_split_longopt && split=true
@ -183,7 +178,7 @@ _unshunt()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--help' -- "$cur" ) )
@ -200,7 +195,7 @@ _list_admins()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--all-vhost --all --help' -- "$cur" ) )
@ -217,7 +212,7 @@ _list_owners()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--with-listnames --moderators \
@ -235,8 +230,7 @@ _list_members()
local cur prev split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
_split_longopt && split=true
@ -274,8 +268,7 @@ _change_pw()
local cur prev split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
_split_longopt && split=true
@ -302,7 +295,7 @@ _withlist()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--lock --interactive \
@ -320,7 +313,7 @@ _newlist()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--language --quiet --help' -- "$cur" ) )
@ -337,7 +330,7 @@ _rmlist()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--archives --help' -- "$cur" ) )
@ -354,8 +347,7 @@ _config_list()
local cur prev split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
_split_longopt && split=true
@ -386,8 +378,7 @@ _arch()
local cur prev split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
_split_longopt && split=true
@ -433,7 +424,7 @@ _cleanarch()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--status --dry-run --quiet \
@ -449,8 +440,7 @@ _inject()
local cur prev split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
_split_longopt && split=true
@ -478,7 +468,7 @@ _dumpdb()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--marshal --pickle --noprint \
@ -496,7 +486,7 @@ _check_db()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--all --verbose --help' -- "$cur" ) )
@ -513,7 +503,7 @@ _check_perms()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-f -v -h' -- "$cur" ) )
@ -528,7 +518,7 @@ _genaliases()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--quiet --help' -- "$cur" ) )
@ -543,7 +533,7 @@ _mmsitepass()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--listcreator --help' -- "$cur" ) )
@ -558,8 +548,7 @@ _qrunner()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
_split_longopt && return 0
@ -577,7 +566,7 @@ _mailmanctl()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--no-restart --run-as-user \

View File

@ -6,8 +6,7 @@ _make()
local file makef makef_dir="." makef_inc cur prev i split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
_split_longopt && split=true

View File

@ -11,8 +11,7 @@ _man()
mansect="@([0-9lnp]|[0-9][px]|3pm)"
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
if [[ "$prev" == -l ]]; then
_filedir $manext

View File

@ -6,8 +6,7 @@ _mc()
local cur prev split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
_split_longopt && split=true

View File

@ -6,8 +6,7 @@ _mcrypt()
local cur prev i decrypt
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-g|--openpgp-z)

View File

@ -75,8 +75,7 @@ _mdadm()
local cur prev mode options split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
_split_longopt && split=true

View File

@ -6,8 +6,7 @@ _minicom()
local cur prev confdir
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-a|-c)

View File

@ -6,8 +6,7 @@ _mkinitrd()
local cur prev args split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
_split_longopt && split=true

View File

@ -9,7 +9,7 @@ _rmmod()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
_installed_modules "$cur"
return 0
@ -26,8 +26,7 @@ _insmod()
local cur prev modpath
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
# behave like lsmod for modprobe -r
if [[ ${1##*/} == modprobe && "${COMP_WORDS[1]}" == -r ]]; then

View File

@ -4,7 +4,7 @@ have monodevelop &&
_monodevelop()
{
local cur
cur=`_get_cword`
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-? -help -help2 -ipc-tcp -newwindow -nologo \
@ -23,8 +23,7 @@ _mdtool()
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
if [[ ${COMP_WORDS[i]} == @(build|generate-makefiles|setup) ]]; then

View File

@ -80,8 +80,7 @@ _mount()
local cur sm host prev
COMPREPLY=()
cur=`_get_cword ':'`
prev=`_get_pword ':'`
_get_comp_words_by_ref -n : cur prev
case $prev in
-t|--types)
@ -138,10 +137,10 @@ complete -F _mount -o default -o dirnames mount
have umount &&
_umount()
{
local cur
_get_comp_words_by_ref cur
COMPREPLY=()
local cur=`_get_cword`
if [[ $(uname -s) = Linux && -r /proc/mounts ]]; then
# Linux /proc/mounts is properly quoted. This is important when
# unmounting usb devices with pretty names.

View File

@ -15,8 +15,7 @@ _mplayer()
COMPREPLY=()
cmd=${COMP_WORDS[0]}
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
case $prev in
-[av][cfo]|-[av]fm|-vop|-fstype|-demuxer|-o[av]c|-of|-profile)
@ -237,7 +236,7 @@ _mplayer()
-e "/^-\(Total\|.*\*\)\{0,1\}$/!p" )' -- "$cur" ) )
;;
*)
_filedir '@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|ASF|vob|VOB|bin|BIN|dat|DAT|vcd|VCD|ps|PS|pes|PES|fl[iv]|FL[IV]|fxm|FXM|viv|VIV|rm?(j)|RM?(J)|ra?(m)|RA?(M)|yuv|YUV|mov|MOV|qt|QT|mp[234]|MP[234]|m4[av]|M4[AV]|og[gmavx]|OG[GMAVX]|w?(a)v|W?(A)V|dump|DUMP|mk[av]|MK[AV]|m4a|M4A|aac|AAC|m[24]v|M[24]V|dv|DV|rmvb|RMVB|mid|MID|ts|TS|3g[p2]|mpc|MPC|flac|FLAC|vro|VRO|divx|DIVX|aif?(f)|AIF?(F)|m2ts|M2TS|vdr|VDR|xvid|XVID|ape|APE)'
_filedir '@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|ASF|vob|VOB|bin|BIN|dat|DAT|vcd|VCD|ps|PS|pes|PES|fl[iv]|FL[IV]|fxm|FXM|viv|VIV|rm?(j)|RM?(J)|ra?(m)|RA?(M)|yuv|YUV|mov|MOV|qt|QT|mp[234]|MP[234]|m4[av]|M4[AV]|og[gmavx]|OG[GMAVX]|w?(a)v|W?(A)V|dump|DUMP|mk[av]|MK[AV]|m4a|M4A|aac|AAC|m[24]v|M[24]V|dv|DV|rmvb|RMVB|mid|MID|t[ps]|T[PS]|3g[p2]|mpc|MPC|flac|FLAC|vro|VRO|divx|DIVX|aif?(f)|AIF?(F)|m2ts|M2TS|vdr|VDR|xvid|XVID|ape|APE|gif|GIF)'
;;
esac

View File

@ -6,11 +6,7 @@ _msynctool()
local cur prev anteprev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
if [ $COMP_CWORD -ge 2 ]; then
anteprev=${COMP_WORDS[COMP_CWORD-2]}
fi
_get_comp_words_by_ref cur prev anteprev
case $anteprev in
--configure)

View File

@ -6,8 +6,7 @@ _mtx()
local cur prev options tapes drives
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
options="-f nobarcode invert noattach --version inquiry noattach \
inventory status load unload eepos first last next"

View File

@ -6,8 +6,7 @@ _munin_run()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=`_get_pword`
_get_comp_words_by_ref cur prev
case $prev in
--config|--sconffile)
@ -36,8 +35,7 @@ _munindoc()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=`_get_pword`
_get_comp_words_by_ref cur prev
COMPREPLY=( $( compgen -W '$( command ls /usr/share/munin/plugins )' \
-- "$cur" ) )
@ -50,8 +48,7 @@ _munin_update()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=`_get_pword`
_get_comp_words_by_ref cur prev
case $prev in
--config)
@ -78,8 +75,7 @@ _munin_node_configure()
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=`_get_pword`
_get_comp_words_by_ref cur prev
case $prev in
--config)

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) "
@ -137,8 +137,9 @@ _muttfiledir()
_mutt()
{
local cur prev
cur=`_get_cword =+!`
prev=`_get_pword =+!`
_get_comp_words_by_ref -n =+! cur prev
#cur=`_get_cword =+!`
#prev=`_get_pword =+!`
COMPREPLY=()

View File

@ -6,8 +6,7 @@ _mysqladmin()
local cur prev split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_get_comp_words_by_ref cur prev
_split_longopt && split=true

View File

@ -6,7 +6,7 @@ _ncftp()
local cur
COMPREPLY=()
cur=`_get_cword`
_get_comp_words_by_ref cur
if [[ $COMP_CWORD -eq 1 && -f ~/.ncftp/bookmarks ]]; then
COMPREPLY=( $( compgen -W '$( sed -ne "s/^\([^,]\{1,\}\),.*$/\1/p" \

Some files were not shown because too many files have changed in this diff Show More