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) 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 ] [ David Paleino ]
* Don't use pidof in _known_hosts_real() to detect whether Avahi is * 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 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 * Style policy: don't use fancy globbing in case labels
* Added .fdf completion to okular and evince * Added .fdf completion to okular and evince
* Added .okular completion to okular (Debian: #545530) * 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ä ] [ Ville Skyttä ]
* Create bz2 dist tarball too. * Create bz2 dist tarball too.
@ -27,13 +51,13 @@ bash-completion (2.x)
* Remove many unnecessary short option completions where long ones exist. * Remove many unnecessary short option completions where long ones exist.
* Improve chsh, chgrp, chown, configure, curl, cvs, find, gkrellm, gzip, * Improve chsh, chgrp, chown, configure, curl, cvs, find, gkrellm, gzip,
iconv, lftp, look, lzma, make, man, mdadm, modprobe, mount, mplayer, 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 update-alternatives, vncviewer, wget, yp-tools, xine based players' and
general hostname completions. general hostname completions.
* Add abook and wtf completion, based on work by Raphaël Droz. * Add abook and wtf completion, based on work by Raphaël Droz.
* Add cvsps, dragon, fusermount, jarsigner, k3b, lftpget, pm-utils, rtcwake, * Add cvsps, dragon, fusermount, jarsigner, k3b, lftpget, modplug123,
pack200, unpack200, pbzip2, pbunzip2, pbzcat, pigz, unpigz, and wol pm-utils, rtcwake, pack200, unpack200, pbzip2, pbunzip2, pbzcat, pigz,
completions. unpigz, and wol completions.
* Don't overwrite other host completions when completing from multiple * Don't overwrite other host completions when completing from multiple
SSH known hosts files. SSH known hosts files.
* Speed up installed rpm package completion on SUSE, based on work by * 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 to using the complete/compgen features directly, and BASH_VERSINFO
for bash version checks. for bash version checks.
* Protect various completions from unusual user input by not embedding the * 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. * Add /sbin to $PATH when invoking ifconfig and iwconfig.
* Combine dcop and qdbus completions into the latter. * 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. * Fix leaking local variables from various completions.
* Turn on -o filenames in _filedir on bash >= 4. * Turn on -o filenames in _filedir on bash >= 4.
* Deprecate modules completion, upstream modules >= 3.2.7 ships one. * 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 sshfs completion from contrib/ssh into contrib/sshfs.
* Split mount and umount completion into contrib/mount. * 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, * Do basic HTML file completion with Firefox and Chrome and friends,
and Epiphany. and Epiphany.
* Do basic diff/patch completion with cdiff and kompare. * 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. * Do meta-command completion for aoss and padsp.
[ Freddy Vulto ] [ 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 ] [ Ted Stern ]
* Fix modules completion for "(default)" entries. * Fix modules completion for "(default)" entries.
[ Jeremie Lasalle Ratelle ] [ Jeremie Lasalle Ratelle ]
* Fix rsync remote path completion (Alioth: #312173). * Fix rsync remote path completion (Alioth: #312173, Gentoo: #297818).
[ Leonard Crestez ] [ Leonard Crestez ]
* Improve ssh -o suboption completion (Alioth: #312122). * Improve ssh -o suboption completion (Alioth: #312122).
@ -77,7 +119,8 @@ bash-completion (2.x)
* Fix completion of usernames (Alioth: #311396, Debian: #511788). * Fix completion of usernames (Alioth: #311396, Debian: #511788).
* Fix chown test crashing on systems with no root group (Alioth: #312306). * Fix chown test crashing on systems with no root group (Alioth: #312306).
* Fixed tests when BASH_COMPLETION or TESTDIR contain spaces. * 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. * Cleanup scripts to run tests. Make runUnit and runCompletion use test/run.
Make it possible to run tests from any directory. Make it possible to run tests from any directory.
* Add a --debug-xtrace option to test/run using BASH_XTRACEFD from bash-4.1. * 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). * Improve xz completion (Alioth: #312466).
[ Mario Schwalbe ] [ Mario Schwalbe ]
* Update find completion (Alioth: #312491). * Update find completion (Alioth: #312491, Launchpad: #570113).
[ Mark van Rossum ] [ Mark van Rossum ]
* Add basic lyx completion. * 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) bash-completion (1.1)

View File

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

View File

@ -70,14 +70,15 @@ complete -d pushd
# START exclude -- do NOT remove this line # START exclude -- do NOT remove this line
# bzcmp, bzdiff, bz*grep, bzless, bzmore intentionally not here, see Debian: #455510 # 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 '!*.?(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 complete -f -X '*.Z' compress znew
# zcmp, zdiff, z*grep, zless, zmore intentionally not here, see Debian: #455510 # 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|[gGd]z|t[ag]z)' gunzip zcat unpigz
complete -f -X '!*.Z' uncompress complete -f -X '!*.Z' uncompress
# lzcmp, lzdiff intentionally not here, see Debian: #455510 # lzcmp, lzdiff intentionally not here, see Debian: #455510
complete -f -X '!*.lzma' lzcat lzegrep lzfgrep lzgrep lzless lzmore unlzma complete -f -X '!*.@(tlz|lzma)' lzcat lzegrep lzfgrep lzgrep lzless lzmore unlzma
complete -f -X '!*.@(xz|lzma)' unxz xzcat 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|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 '!*.@(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 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 '!*.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 '!*.@(?(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 '!*.@(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 '!*.@(avi|asf|wmv)' aviplay
complete -f -X '!*.@(rm?(j)|ra?(m)|smi?(l))' realplay complete -f -X '!*.@(rm?(j)|ra?(m)|smi?(l))' realplay
complete -f -X '!*.@(mpg|mpeg|avi|mov|qt)' xanim 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 '!*.fig' xfig
complete -f -X '!*.@(mid?(i)|MID?(I)|cmf|CMF)' playmidi 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 '!*.@(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 '*.@(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 '!*.@([eE][xX][eE]?(.[sS][oO])|[cC][oO][mM]|[sS][cC][rR])' wine
complete -f -X '!*.@(zip|ZIP|z|Z|gz|GZ|tgz|TGZ)' bzme 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 '!*.@(sxm|smf|mml|odf)' oomath
complete -f -X '!*.odb' oobase complete -f -X '!*.odb' oobase
complete -f -X '!*.rpm' rpm2cpio complete -f -X '!*.rpm' rpm2cpio
complete -f -X '!*.sqlite' sqlite3
complete -f -X '!*.aux' bibtex complete -f -X '!*.aux' bibtex
complete -f -X '!*.po' poedit gtranslator kbabel lokalize complete -f -X '!*.po' poedit gtranslator kbabel lokalize
complete -f -X '!*.@([Pp][Rr][Gg]|[Cc][Ll][Pp])' harbour gharbour hbpp 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 # Reassemble command line words, excluding specified characters from the
# list of word completion separators (COMP_WORDBREAKS). # list of word completion separators (COMP_WORDBREAKS).
# @param $1 chars Characters out of $COMP_WORDBREAKS which should # @param $1 chars Characters out of $COMP_WORDBREAKS which should
@ -248,7 +310,7 @@ __reassemble_comp_words_by_ref() {
ref="$2[$j]" ref="$2[$j]"
eval $2[$j]=\${!ref}\${COMP_WORDS[i]} eval $2[$j]=\${!ref}\${COMP_WORDS[i]}
# Indicate new cword # Indicate new cword
[ $i = $COMP_CWORD ] && [[ ${COMP_WORDS[i]} ]] && eval $3=$j [[ $i == $COMP_CWORD && ${COMP_WORDS[i]} ]] && eval $3=$j
done done
else else
# No, list of word completions separators hasn't changed; # 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 # @param $4 cur Name of variable to return current word to complete to
# @see ___get_cword_at_cursor_by_ref() # @see ___get_cword_at_cursor_by_ref()
__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 local cword words=()
# 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
__reassemble_comp_words_by_ref "$1" words cword __reassemble_comp_words_by_ref "$1" words cword
local i local i cur2
local cur="$COMP_LINE" local cur="$COMP_LINE"
local index="$COMP_POINT" local index="$COMP_POINT"
for (( i = 0; i <= cword; ++i )); do for (( i = 0; i <= cword; ++i )); do
@ -318,13 +360,13 @@ ___get_cword_at_cursor_by_ref() {
if [[ "${words[cword]:0:${#cur}}" != "$cur" ]]; then if [[ "${words[cword]:0:${#cur}}" != "$cur" ]]; then
# We messed up. At least return the whole word so things keep working # We messed up. At least return the whole word so things keep working
eval $4=\"\${words[cword]}\" cur2=${words[cword]}
else else
eval $4=\"\${cur:0:\$index}\" cur2=${cur:0:$index}
fi fi
eval $2=\( \"\${words[@]}\" \) local "$2" "$3" "$4" &&
eval $3=\$cword _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", # (For example, if the line is "ls foobar",
# and the cursor is here --------> ^ # and the cursor is here --------> ^
# Also one is able to cross over possible wordbreak characters. # 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: # Example usage:
# #
# $ _get_comp_words_by_ref -n : cur prev # $ _get_comp_words_by_ref -n : cur prev
# #
# Options: -n EXCLUDE Characters out of $COMP_WORDBREAKS which should NOT _get_comp_words_by_ref()
# 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()
{ {
local exclude flag i OPTIND=5 # Skip first four arguments local exclude flag i OPTIND=1
local cword words cur varnames=() local cur cword words=()
while getopts "n:" flag "$@"; do local upargs=() upvars=() vcur vcword vprev vwords
while getopts "c:i:n:p:w:" flag "$@"; do
case $flag in case $flag in
c) vcur=$OPTARG ;;
i) vcword=$OPTARG ;;
n) exclude=$OPTARG ;; n) exclude=$OPTARG ;;
p) vprev=$OPTARG ;;
w) vwords=$OPTARG ;;
esac esac
done done
varnames=( ${!OPTIND} )
let "OPTIND += 1"
while [[ $# -ge $OPTIND ]]; do 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" let "OPTIND += 1"
done done
__get_cword_at_cursor_by_ref "$exclude" words cword cur __get_cword_at_cursor_by_ref "$exclude" words cword cur
eval $1=\( \"\${words[@]}\" \) [[ $vcur ]] && { upvars+=("$vcur" ); upargs+=(-v $vcur "$cur" ); }
eval $2=\$cword [[ $vcword ]] && { upvars+=("$vcword"); upargs+=(-v $vcword "$cword"); }
eval $3=\$cur [[ $vprev ]] && { upvars+=("$vprev" ); upargs+=(-v $vprev
eval $4=\( \"\${varnames[@]}\" \) "${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 # current word (default is 0, previous is 1), respecting the exclusions
# given at $1. For example, `_get_cword "=:" 1' returns the word left of # given at $1. For example, `_get_cword "=:" 1' returns the word left of
# the current word, respecting the exclusions "=:". # the current word, respecting the exclusions "=:".
# # @deprecated Use `_get_comp_words_by_ref cur' instead
# @see _get_comp_words_by_ref()
_get_cword() _get_cword()
{ {
local LC_CTYPE=C local LC_CTYPE=C
@ -417,7 +464,7 @@ _get_cword()
# return previous word offset by $2 # return previous word offset by $2
if [[ ${2//[^0-9]/} ]]; then if [[ ${2//[^0-9]/} ]]; then
printf "%s" "${words[cword-$2]}" 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]}" printf "%s" "${words[cword]}"
else else
local i local i
@ -461,7 +508,8 @@ _get_cword()
# This is a good alternative to `prev=${COMP_WORDS[COMP_CWORD-1]}' because bash4 # 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 # will properly return the previous word with respect to any given exclusions to
# COMP_WORDBREAKS. # COMP_WORDBREAKS.
# @see _get_cword() # @deprecated Use `_get_comp_words_by_ref cur prev' instead
# @see _get_comp_words_by_ref()
# #
_get_pword() _get_pword()
{ {
@ -520,16 +568,32 @@ __ltrim_colon_completions() {
# $ compgen -f "a\\\\\'b/" # Good (bash-3) # $ compgen -f "a\\\\\'b/" # Good (bash-3)
# a\'b/c # 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 $1 Argument to quote
# @param $2 Name of variable to return result to # @param $2 Name of variable to return result to
_quote_readline_by_ref() _quote_readline_by_ref()
{ {
if [[ ${1:0:1} == "'" ]]; then 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 # Quote word, leaving out first character
printf -v $2 %q "${1:1}" printf -v $2 %q "${1:1}"
if [[ ${BASH_VERSINFO[0]} -le 3 ]]; then # Double-quote word (bash-3)
# Double-quote word on bash-3
printf -v $2 %q ${!2} printf -v $2 %q ${!2}
fi fi
elif [[ ${BASH_VERSINFO[0]} -le 3 && ${1:0:1} == '"' ]]; then elif [[ ${BASH_VERSINFO[0]} -le 3 && ${1:0:1} == '"' ]]; then
@ -554,7 +618,7 @@ _filedir()
{ {
local i IFS=$'\t\n' xspec local i IFS=$'\t\n' xspec
__expand_tilde_by_ref cur _tilde "$cur" || return 0
local -a toks local -a toks
local quoted tmp 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 if [[ "$1" != -d ]]; then
xspec=${1:+"!*.$1"} xspec=${1:+"!*.$1"}
if [[ ${cur:0:1} == "'" && ${BASH_VERSINFO[0]} -ge 4 ]]; then toks=( ${toks[@]-} $( compgen -f -X "$xspec" -- $quoted) )
toks=( ${toks[@]-} $(
eval compgen -f -X \"\$xspec\" -- $quoted
) )
else
toks=( ${toks[@]-} $(
compgen -f -X "$xspec" -- $quoted
) )
fi
if [ ${#toks[@]} -ne 0 ]; then if [ ${#toks[@]} -ne 0 ]; then
# If `compopt' is available, set `-o filenames' # 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; # No, `compopt' isn't available;
# Is `-o filenames' set? # 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 (~) # 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 # 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 # (~../) is expanded. The remainder of the variable, containing for example
# a dollar sign variable ($) or asterisk (*) is not expanded. # a dollar sign variable ($) or asterisk (*) is not expanded.
@ -1082,299 +1147,13 @@ _dvd_devices()
patch configure build install reinstall deinstall clean clean-depends \ patch configure build install reinstall deinstall clean clean-depends \
kernel buildworld' make 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 # This function provides simple user@host completion
# #
_user_at_host() { _user_at_host() {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword :` _get_comp_words_by_ref -n : cur
if [[ $cur == *@* ]]; then if [[ $cur == *@* ]]; then
_known_hosts_real "$cur" _known_hosts_real "$cur"
@ -1580,7 +1359,8 @@ complete -F _known_hosts traceroute traceroute6 tracepath tracepath6 ping \
# #
_cd() _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 # try to allow variable completion
if [[ "$cur" == ?(\\)\$* ]]; then if [[ "$cur" == ?(\\)\$* ]]; then
@ -1683,7 +1463,7 @@ _command_offset()
COMP_CWORD=$(( $COMP_CWORD - $word_offset )) COMP_CWORD=$(( $COMP_CWORD - $word_offset ))
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` _get_comp_words_by_ref cur
if [[ $COMP_CWORD -eq 0 ]]; then if [[ $COMP_CWORD -eq 0 ]]; then
COMPREPLY=( $( compgen -c -- "$cur" ) ) COMPREPLY=( $( compgen -c -- "$cur" ) )
@ -1729,7 +1509,8 @@ complete -F _command -o filenames nohup exec nice eval time ltrace then \
_root_command() _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 complete -F _root_command -o filenames sudo fakeroot really gksudo gksu kdesudo
@ -1737,8 +1518,7 @@ _longopt()
{ {
local cur prev local cur prev
cur=`_get_cword` _get_comp_words_by_ref cur prev
prev=${COMP_WORDS[COMP_CWORD-1]}
if _split_longopt; then if _split_longopt; then
case "$prev" in case "$prev" in
@ -1778,48 +1558,13 @@ for i in env netstat seq uname units; do
done done
unset i 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() _filedir_xspec()
{ {
local IFS cur xspec local IFS cur xspec
IFS=$'\t\n' IFS=$'\t\n'
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` _get_comp_words_by_ref cur
_expand || return 0 _expand || return 0

View File

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

View File

@ -49,8 +49,7 @@ _module ()
local cur prev options local cur prev options
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` _get_comp_words_by_ref cur prev
prev=${COMP_WORDS[COMP_CWORD-1]}
if [ $COMP_CWORD -eq 1 ] ; then if [ $COMP_CWORD -eq 1 ] ; then
# First parameter on line -- we expect it to be a mode selection # 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 local cur prev commands options command
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` _get_comp_words_by_ref cur prev
commands='add blame praise annotate ann cat checkout co cleanup commit \ commands='add blame praise annotate ann cat checkout co cleanup commit \
ci copy cp delete del remove rm diff di export help ? h import \ ci copy cp delete del remove rm diff di export help ? h import \
@ -27,7 +27,6 @@ _svn()
fi fi
else else
prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in case $prev in
--config-dir) --config-dir)
_filedir -d _filedir -d
@ -280,7 +279,7 @@ _svnadmin()
local cur prev commands options mode local cur prev commands options mode
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` _get_comp_words_by_ref cur prev
commands='create deltify dump help ? hotcopy list-dblogs \ commands='create deltify dump help ? hotcopy list-dblogs \
list-unused-dblogs load lslocks lstxns recover rmlocks \ list-unused-dblogs load lslocks lstxns recover rmlocks \
@ -293,7 +292,6 @@ _svnadmin()
COMPREPLY=( $( compgen -W "$commands" -- $cur ) ) COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
fi fi
else else
prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in case $prev in
--config-dir) --config-dir)
_filedir -d _filedir -d
@ -359,7 +357,7 @@ _svnlook()
local cur prev commands options mode local cur prev commands options mode
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` _get_comp_words_by_ref cur
commands='author cat changed date diff dirs-changed help ? h history \ commands='author cat changed date diff dirs-changed help ? h history \
info lock log propget pget pg proplist plist pl tree uuid \ 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 local cur prev special i split=false
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` _get_comp_words_by_ref cur prev
prev=${COMP_WORDS[COMP_CWORD-1]}
for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
if [[ ${COMP_WORDS[i]} == @(install|update|upgrade|remove|erase|deplist|info) ]]; then if [[ ${COMP_WORDS[i]} == @(install|update|upgrade|remove|erase|deplist|info) ]]; then

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

3
contrib/configure vendored
View File

@ -5,8 +5,7 @@ _configure()
local cur prev split=false local cur prev split=false
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` _get_comp_words_by_ref cur prev
prev=${COMP_WORDS[COMP_CWORD-1]}
_split_longopt && split=true _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 local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` _get_comp_words_by_ref cur prev
prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in case $prev in
-f) -f)

View File

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

View File

@ -11,8 +11,7 @@ _cpio()
local cur prev split=false local cur prev split=false
COMPREPLY=() COMPREPLY=()
cur=`_get_cword :` _get_comp_words_by_ref -n : cur prev
prev=`_get_pword :`
_split_longopt && split=true _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 local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` _get_comp_words_by_ref cur
COMPREPLY=( $( compgen -W "$( lpstat | cut -d' ' -f1 )" -- "$cur" ) ) COMPREPLY=( $( compgen -W "$( lpstat | cut -d' ' -f1 )" -- "$cur" ) )
} && } &&

View File

@ -60,8 +60,7 @@ _cvs()
local -a flags miss files entries changed newremoved local -a flags miss files entries changed newremoved
COMPREPLY=() COMPREPLY=()
cur=`_get_cword :` _get_comp_words_by_ref -n : cur prev
prev=`_get_pword :`
count=0 count=0
for i in "${COMP_WORDS[@]}"; do for i in "${COMP_WORDS[@]}"; do
@ -239,7 +238,7 @@ _cvs()
set_prefix 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 # if $COMP_CVS_REMOTE is not null, 'cvs commit' will
# complete on remotely checked-out files (requires # complete on remotely checked-out files (requires
# passwordless access to the remote repository # passwordless access to the remote repository

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,8 +6,7 @@ _iconv()
local cur prev split=false local cur prev split=false
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` _get_comp_words_by_ref cur prev
prev=${COMP_WORDS[COMP_CWORD-1]}
_split_longopt && split=true _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 && { have convert && {
_ImageMagick() _ImageMagick()
{ {
local prev local cur prev
prev=${COMP_WORDS[COMP_CWORD-1]} _get_comp_words_by_ref cur prev
case $prev in case $prev in
-channel) -channel)
@ -135,7 +135,7 @@ _convert()
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` _get_comp_words_by_ref cur
_ImageMagick _ImageMagick
@ -196,7 +196,7 @@ _mogrify()
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` _get_comp_words_by_ref cur
_ImageMagick _ImageMagick
@ -252,7 +252,7 @@ _display()
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` _get_comp_words_by_ref cur
_ImageMagick _ImageMagick
@ -292,7 +292,7 @@ _animate()
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` _get_comp_words_by_ref cur
_ImageMagick _ImageMagick
@ -326,7 +326,7 @@ _identify()
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` _get_comp_words_by_ref cur
_ImageMagick _ImageMagick
@ -351,7 +351,7 @@ _montage()
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` _get_comp_words_by_ref cur
_ImageMagick _ImageMagick
@ -389,7 +389,7 @@ _composite()
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` _get_comp_words_by_ref cur
_ImageMagick _ImageMagick
@ -424,7 +424,7 @@ _compare()
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` _get_comp_words_by_ref cur
_ImageMagick _ImageMagick
@ -451,7 +451,7 @@ _conjure()
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` _get_comp_words_by_ref cur
_ImageMagick _ImageMagick
@ -471,7 +471,7 @@ _import()
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` _get_comp_words_by_ref cur
_ImageMagick _ImageMagick
@ -502,7 +502,7 @@ _stream()
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` _get_comp_words_by_ref cur
_ImageMagick _ImageMagick

View File

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

View File

@ -6,8 +6,7 @@ _ipmitool()
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` _get_comp_words_by_ref cur prev
prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in case $prev in
-I) -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 local cur prev table chain
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` _get_comp_words_by_ref cur prev
prev=${COMP_WORDS[COMP_CWORD-1]}
chain='s/^Chain \([^ ]\{1,\}\).*$/\1/p' chain='s/^Chain \([^ ]\{1,\}\).*$/\1/p'
if [[ $COMP_LINE == *-t\ *filter* ]]; then if [[ $COMP_LINE == *-t\ *filter* ]]; then

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -15,8 +15,7 @@ _mplayer()
COMPREPLY=() COMPREPLY=()
cmd=${COMP_WORDS[0]} cmd=${COMP_WORDS[0]}
cur=`_get_cword` _get_comp_words_by_ref cur prev
prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in case $prev in
-[av][cfo]|-[av]fm|-vop|-fstype|-demuxer|-o[av]c|-of|-profile) -[av][cfo]|-[av]fm|-vop|-fstype|-demuxer|-o[av]c|-of|-profile)
@ -237,7 +236,7 @@ _mplayer()
-e "/^-\(Total\|.*\*\)\{0,1\}$/!p" )' -- "$cur" ) ) -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 esac

View File

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

View File

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

View File

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

View File

@ -58,7 +58,7 @@ _muttconffiles()
while [[ "$1" ]]; do while [[ "$1" ]]; do
newconffiles=( $(sed -n 's|^source[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*$|\1|p' $(eval echo $1) ) ) newconffiles=( $(sed -n 's|^source[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*$|\1|p' $(eval echo $1) ) )
for file in "${newconffiles[@]}"; do for file in "${newconffiles[@]}"; do
[[ ! "$file" ]] || [[ "${sofar/ ${file} / }" != "$sofar" ]] && [[ ! "$file" || "${sofar/ ${file} / }" != "$sofar" ]] &&
continue continue
sofar="$sofar $file" sofar="$sofar $file"
sofar=" $(eval _muttconffiles \"$sofar\" $file) " sofar=" $(eval _muttconffiles \"$sofar\" $file) "
@ -137,8 +137,9 @@ _muttfiledir()
_mutt() _mutt()
{ {
local cur prev local cur prev
cur=`_get_cword =+!` _get_comp_words_by_ref -n =+! cur prev
prev=`_get_pword =+!` #cur=`_get_cword =+!`
#prev=`_get_pword =+!`
COMPREPLY=() COMPREPLY=()

View File

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

View File

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