Merge branch 'master' into 1.x

Conflicts:
	CHANGES
	configure.ac
This commit is contained in:
David Paleino 2011-01-09 18:19:18 +01:00
commit a5e203cfe5
637 changed files with 5572 additions and 2817 deletions

74
CHANGES
View File

@ -1,3 +1,77 @@
bash-completion (1.3)
[ Guillaume Rousse ]
* added pure-perl perldoc completion helper, using work from Aristotle
Pagaltzis (pagaltzis@gmx.de)
[ David Paleino ]
* Fixed "service" completion, thanks to John Hedges (Debian: #586210)
* Complete on all files for mplayer's -dvd-device
[ Ville Skyttä ]
* Activate hping2 completion also for hping and hping3.
* Add badblocks, compgen, crontab, dumpe2fs, e2freefrag, e2label, ether-wake,
filefrag, growisofs, iftop, ip (Debian: #600617), lrzip, lsof, POSIX sh,
sha{,224,256,384,512}sum, sysbench, tune2fs, xmodmap, and xrdb completions.
* Add *.gif (Alioth: #312512), *.m2t (Alioth: #312770), *.3gpp, *.3gpp2,
*.awb, and *.iso (Alioth: #311420) to mplayer filename completions.
* Add "short" tarball extensions to unxz, unlzma etc completions.
* Improve /etc/init.d/*, ipmitool, jar, java, javadoc, man, mencoder, mkdir,
mplayer, povray, python, rpmbuild, sqlite3, tar, wodim, and general help
parsing completions.
* Fix p4 and povray completions (Alioth: #312625).
* Add *.xsd, *.xsl, *.rng, and *.wsdl to xmllint filename completions,
and *.gz versions of all of the supported ones.
* Recognize rpm query mode based on the --file, --group, --package, and
--all long options (RedHat: #630328).
* Improve rpm query option completions.
* Drop bad kompare filename completion (Alioth: #312708).
* Make _filedir and _filedir_xspec complete uppercase versions of their
filename extension arguments in addition to exact case matches.
* IPv6 known hosts completion fixes (Alioth: #312695, RedHat: #630658).
* Fixes to completions for filenames containing tabs (RedHat: #629518).
* Add *.iso (Alioth: #311420), *.m2t and *.m2ts (Alioth: #312770) to
xine-based player filename completions.
* Add /etc/ethers to MAC address completion sources.
* Add *.gem and *.spkg to tar filename completions.
* Complete known hosts from avahi-browse only if $COMP_KNOWN_HOSTS_WITH_AVAHI
is non-empty (Alioth: #312691, RedHat: #630326).
* Improve relevance of many user/group completions, depending on context.
* Remove most "-o filenames" options to "complete", turn "-o filenames" on
dynamically when needed instead.
* Add/improve various autotools completions.
* Add *.apk to unzip and jar filename completions.
* Do not load bash_completion in profile.d script if progcomp is not enabled.
* Ignore muttrc source entries that are not files (Alioth: #312881).
* Re-enable postgresql database and user completion (Alioth: #312914,
Ubuntu: #164772).
[ Freddy Vulto ]
* Added _tilde(), fix ~username completion (Alioth: #312613, Debian: #587095)
* Speed up `compopt' availability detection
* Fix _filedir `-o filenames' detection on bash-3 (Alioth: #312646)
* Fix __reassemble_comp_words_by_ref (Alioth #312740)
[ Anton Khirnov ]
* Improve mplayer and mencoder completions.
[ Paul Walmsley ]
* Add *.webm to mplayer file completions (Debian: #588079).
[ Miklos Vajna ]
* Add *.amr to mplayer file completions (Alioth: #312634).
[ Andrej Gelenberg ]
* Add *.part (partially downloaded) to mplayer and xine-based player
completions (Alioth: #312657).
[ Stephen Gildea ]
* Fix false posives for non-option words in _parse_help (Alioth: #312750).
[ Andrey G. Grozin ]
* Add *.fb2 to okular filename completions.
-- David Paleino <d.paleino@gmail.com> Wed, 16 Jun 2010 17:53:22 +0200
bash-completion (1.2)
[ David Paleino ]

View File

@ -1,172 +1,7 @@
SUBDIRS = test
SUBDIRS = completions test
sysconf_DATA = bash_completion
bashcompdir = $(sysconfdir)/bash_completion.d
bashcomp_DATA = contrib/abook \
contrib/ant \
contrib/apache2ctl \
contrib/apt \
contrib/apt-build \
contrib/aptitude \
contrib/aspell \
contrib/autorpm \
contrib/bash-builtins \
contrib/bind-utils \
contrib/bitkeeper \
contrib/bittorrent \
contrib/bluez \
contrib/brctl \
contrib/bzip2 \
contrib/cardctl \
contrib/cfengine \
contrib/chkconfig \
contrib/chsh \
contrib/cksfv \
contrib/clisp \
contrib/configure \
contrib/coreutils \
contrib/cowsay \
contrib/cpan2dist \
contrib/cpio \
contrib/cups \
contrib/cryptsetup \
contrib/cvs \
contrib/cvsps \
contrib/dd \
contrib/dhclient \
contrib/dict \
contrib/dpkg \
contrib/dselect \
contrib/dsniff \
contrib/findutils \
contrib/freeciv \
contrib/fuse \
contrib/gcc \
contrib/gcl \
contrib/gdb \
contrib/genisoimage \
contrib/getent \
contrib/gkrellm \
contrib/gnatmake \
contrib/gpg \
contrib/gpg2 \
contrib/gzip \
contrib/heimdal \
contrib/hping2 \
contrib/iconv \
contrib/ifupdown \
contrib/imagemagick \
contrib/info \
contrib/iptables \
contrib/ipmitool \
contrib/ipsec \
contrib/ipv6calc \
contrib/isql \
contrib/jar \
contrib/java \
contrib/k3b \
contrib/kldload \
contrib/larch \
contrib/ldapvi \
contrib/lftp \
contrib/lilo \
contrib/links \
contrib/lintian \
contrib/lisp \
contrib/lvm \
contrib/lzma \
contrib/lzop \
contrib/mailman \
contrib/make \
contrib/man \
contrib/mc \
contrib/mcrypt \
contrib/mdadm \
contrib/medusa \
contrib/minicom \
contrib/mkinitrd \
contrib/module-init-tools \
contrib/monodevelop \
contrib/mount \
contrib/mplayer \
contrib/msynctool \
contrib/mtx \
contrib/munin-node \
contrib/mutt \
contrib/mysqladmin \
contrib/ncftp \
contrib/net-tools \
contrib/nmap \
contrib/ntpdate \
contrib/openldap \
contrib/openssl \
contrib/p4 \
contrib/perl \
contrib/pine \
contrib/pkg-config \
contrib/pkg_install \
contrib/pkgtools \
contrib/pm-utils \
contrib/portupgrade \
contrib/postfix \
contrib/postgresql \
contrib/povray \
contrib/procps \
contrib/python \
contrib/qdbus \
contrib/qemu \
contrib/quota-tools \
contrib/rcs \
contrib/rdesktop \
contrib/reportbug \
contrib/resolvconf \
contrib/rfkill \
contrib/ri \
contrib/rpcdebug \
contrib/rpm \
contrib/rpmcheck \
contrib/rrdtool \
contrib/rsync \
contrib/rtcwake \
contrib/samba \
contrib/sbcl \
contrib/screen \
contrib/service \
contrib/shadow \
contrib/sitecopy \
contrib/smartctl \
contrib/snownews \
contrib/ssh \
contrib/sshfs \
contrib/strace \
contrib/svk \
contrib/sysctl \
contrib/sysv-rc \
contrib/tar \
contrib/tcpdump \
contrib/unace \
contrib/unrar \
contrib/update-alternatives \
contrib/util-linux \
contrib/vncviewer \
contrib/vpnc \
contrib/wireless-tools \
contrib/wodim \
contrib/wol \
contrib/wtf \
contrib/wvdial \
contrib/xhost \
contrib/xm \
contrib/xmllint \
contrib/xmlwf \
contrib/xmms \
contrib/xrandr \
contrib/xsltproc \
contrib/xz \
contrib/yp-tools \
contrib/yum-arch
profiledir = $(sysconfdir)/profile.d
profile_DATA = bash_completion.sh
@ -175,6 +10,4 @@ bash_completion.sh: bash_completion.sh.in Makefile
CLEANFILES = bash_completion.sh
EXTRA_DIST = CHANGES $(sysconf_DATA) $(bashcomp_DATA) bash_completion.sh.in \
contrib/_mock contrib/_modules contrib/_subversion contrib/_yum \
contrib/_yum-utils
EXTRA_DIST = CHANGES $(sysconf_DATA) bash_completion.sh.in

23
README
View File

@ -15,17 +15,20 @@ fi
(if you happen to have *only* bash >= 3.2 installed, see further if not)
If you don't have the package readily available for your distribution, or
you simply don't want to do this, put the bash_completion file somewhere
on your system and source it from either /etc/bashrc or ~/.bashrc, as
explained above.
you simply don't want to use one, you can install bash completion using the
standard commands for GNU autotools packages:
A more elaborate way that takes care of not loading on old, unsupported
bash versions as well as some other conditions is included in the bash
completion package as bash_completion.sh. If your system has the
/etc/profile.d directory and loads all files from it automatically,
you may place the file in it. If not, place the file somewhere on your
system and source it from /etc/bashrc or ~/.bashrc, or copy its contents
to one of those files.
./configure
make
make check # optional, requires dejagnu and tcllib
make install # as root
These commands installs the completions and helpers, as well as a
profile.d script that loads bash_completion where appropriate. If
your system does not use the profile.d directory (usually below /etc)
mechanism, i.e. does not automatically source shell scripts in it, you
can source the $sysconfdir/profile.d/bash_completion.sh script in
/etc/bashrc or ~/.bashrc.
If you're using MacOS X, /etc/bashrc is apparently not sourced at all.
In that case, you should put the bash_completion file in /sw/etc and add

View File

@ -1,4 +0,0 @@
#!/bin/sh
autoreconf -i
rm -rf autom4te.cache/

View File

@ -70,41 +70,42 @@ complete -d pushd
# START exclude -- do NOT remove this line
# bzcmp, bzdiff, bz*grep, bzless, bzmore intentionally not here, see Debian: #455510
complete -f -X '!*.?(t)bz?(2)' bunzip2 bzcat pbunzip2 pbzcat
complete -f -X '!*.@(zip|ZIP|[ejw]ar|[EJW]AR|exe|EXE|pk3|wsz|zargo|xpi|sxw|o[tx]t|od[fgpst]|epub)' unzip zipinfo
complete -f -X '!*.@(zip|[ejw]ar|exe|pk3|wsz|zargo|xpi|sxw|o[tx]t|od[fgpst]|epub|apk)' unzip zipinfo
complete -f -X '*.Z' compress znew
# zcmp, zdiff, z*grep, zless, zmore intentionally not here, see Debian: #455510
complete -f -X '!*.@(Z|[gGd]z|t[ag]z)' gunzip zcat unpigz
complete -f -X '!*.Z' uncompress
# lzcmp, lzdiff intentionally not here, see Debian: #455510
complete -f -X '!*.lzma' lzcat lzegrep lzfgrep lzgrep lzless lzmore unlzma
complete -f -X '!*.@(xz|lzma)' unxz xzcat
complete -f -X '!*.@(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 '!*.@(tlz|lzma)' lzcat lzegrep lzfgrep lzgrep lzless lzmore unlzma
complete -f -X '!*.@(?(t)xz|tlz|lzma)' unxz xzcat
complete -f -X '!*.lrz' lrunzip
complete -f -X '!*.@(gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx)' ee
complete -f -X '!*.@(gif|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 '!*.@(dvi|DVI)?(.@(gz|Z|bz2))' xdvi
complete -f -X '!*.@(dvi|DVI)?(.@(gz|Z|bz2))' kdvi
complete -f -X '!*.@(dvi|DVI)' dvips dviselect dvitype dvipdf advi dvipdfm dvipdfmx
complete -f -X '!*.@(pdf|PDF)' acroread gpdf xpdf
complete -f -X '!*.@(?(e)ps|?(E)PS|pdf|PDF)' kpdf
complete -f -X '!*.@(@(?(e)ps|?(E)PS|pdf|PDF|dvi|DVI)?(.gz|.GZ|.bz2|.BZ2)|cb[rz]|CB[RZ]|djv?(u)|DJV?(U)|dvi|DVI|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|fdf|FDF)' evince
complete -f -X '!*.@(okular|@(?(e|x)ps|?(E|X)PS|pdf|PDF|dvi|DVI|cb[rz]|CB[RZ]|djv?(u)|DJV?(U)|dvi|DVI|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|epub|EPUB|odt|ODT|fb|FB|mobi|MOBI|g3|G3|chm|CHM|fdf|FDF)?(.?(gz|GZ|bz2|BZ2)))' okular
complete -f -X '!*.@(?(e)ps|?(E)PS|pdf|PDF)' ps2pdf ps2pdf12 ps2pdf13 ps2pdf14 ps2pdfwr
complete -f -X '!*.@(dvi|DVI)?(.@(gz|Z|bz2))' xdvi kdvi
complete -f -X '!*.dvi' dvips dviselect dvitype dvipdf advi dvipdfm dvipdfmx
complete -f -X '!*.pdf' acroread gpdf xpdf
complete -f -X '!*.@(?(e)ps|pdf)' kpdf
complete -f -X '!*.@(@(?(e)ps|?(E)PS|pdf|PDF|dvi|DVI)?(.gz|.GZ|.bz2|.BZ2)|cb[rz]|djv?(u)|gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx|fdf)' evince
complete -f -X '!*.@(okular|@(?(e|x)ps|?(E|X)PS|pdf|PDF|dvi|DVI|cb[rz]|CB[RZ]|djv?(u)|DJV?(U)|dvi|DVI|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|epub|EPUB|odt|ODT|fb?(2)|FB?(2)|mobi|MOBI|g3|G3|chm|CHM|fdf|FDF)?(.?(gz|GZ|bz2|BZ2)))' okular
complete -f -X '!*.@(?(e)ps|pdf)' ps2pdf ps2pdf12 ps2pdf13 ps2pdf14 ps2pdfwr
complete -f -X '!*.texi*' makeinfo texi2html
complete -f -X '!*.@(?(la)tex|?(LA)TEX|texi|TEXI|dtx|DTX|ins|INS|ltx|LTX)' tex latex slitex jadetex pdfjadetex pdftex pdflatex texi2dvi
complete -f -X '!*.@(mp3|MP3)' mpg123 mpg321 madplay
complete -f -X '!*@(.@(mp?(e)g|MP?(E)G|wma|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|wmv|mp[234]|MP[234]|m4[pv]|M4[PV]|mkv|MKV|og[gmv]|OG[GMV]|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 '!*.@(?(la)tex|texi|dtx|ins|ltx)' tex latex slitex jadetex pdfjadetex pdftex pdflatex texi2dvi
complete -f -X '!*.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]|t[ps]|T[PS]|m2t?(s)|M2T?(S)|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))?(.part)' xine aaxine fbxine
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]|m2t?(s)|M2T?(S)|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|iso|ISO)|+([0-9]).@(vdr|VDR))?(.part)' kaffeine dragon
complete -f -X '!*.@(avi|asf|wmv)' aviplay
complete -f -X '!*.@(rm?(j)|ra?(m)|smi?(l))' realplay
complete -f -X '!*.@(mpg|mpeg|avi|mov|qt)' xanim
complete -f -X '!*.@(ogg|OGG|m3u|flac|spx)' ogg123
complete -f -X '!*.@(mp3|MP3|ogg|OGG|pls|m3u)' gqmpeg freeamp
complete -f -X '!*.@(ogg|m3u|flac|spx)' ogg123
complete -f -X '!*.@(mp3|ogg|pls|m3u)' gqmpeg freeamp
complete -f -X '!*.fig' xfig
complete -f -X '!*.@(mid?(i)|MID?(I)|cmf|CMF)' playmidi
complete -f -X '!*.@(mid?(i)|MID?(I)|rmi|RMI|rcp|RCP|[gr]36|[GR]36|g18|G18|mod|MOD|xm|XM|it|IT|x3m|X3M|s[3t]m|S[3T]M|kar|KAR)' timidity
complete -f -X '!*.@(m[eo]d|M[EO]D|s[3t]m|S[3T]M|xm|XM|it|IT)' modplugplay 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 '!*.@(mid?(i)|cmf)' playmidi
complete -f -X '!*.@(mid?(i)|rmi|rcp|[gr]36|g18|mod|xm|it|x3m|s[3t]m|kar)' timidity
complete -f -X '!*.@(m[eo]d|s[3t]m|xm|it)' modplugplay modplug123
complete -f -X '*.@(o|so|so.!(conf)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)' vi vim gvim rvim view rview rgvim rgview gview emacs xemacs sxemacs kate kwrite
complete -f -X '!*.@([eE][xX][eE]?(.[sS][oO])|[cC][oO][mM]|[sS][cC][rR])' wine
complete -f -X '!*.@(zip|ZIP|z|Z|gz|GZ|tgz|TGZ)' bzme
complete -f -X '!*.@(zip|z|gz|tgz)' bzme
# konqueror not here on purpose, it's more than a web/html browser
complete -f -X '!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))' netscape mozilla lynx opera galeon dillo elinks amaya firefox mozilla-firefox iceweasel google-chrome chromium-browser epiphany
complete -f -X '!*.@(sxw|stw|sxg|sgl|doc?([mx])|dot?([mx])|rtf|txt|htm|html|odt|ott|odm)' oowriter
@ -113,22 +114,20 @@ complete -f -X '!*.@(sxc|stc|xls?([bmx])|xlw|xlt?([mx])|[ct]sv|ods|ots)' oocalc
complete -f -X '!*.@(sxd|std|sda|sdd|odg|otg)' oodraw
complete -f -X '!*.@(sxm|smf|mml|odf)' oomath
complete -f -X '!*.odb' oobase
complete -f -X '!*.rpm' rpm2cpio
complete -f -X '!*.s@(qlite?(3)|?(3)db)' sqlite3
complete -f -X '!*.[rs]pm' rpm2cpio
complete -f -X '!*.aux' bibtex
complete -f -X '!*.po' poedit gtranslator kbabel lokalize
complete -f -X '!*.@([Pp][Rr][Gg]|[Cc][Ll][Pp])' harbour gharbour hbpp
complete -f -X '!*.[Hh][Rr][Bb]' hbrun
complete -f -X '!*.ly' lilypond ly2dvi
complete -f -X '!*.@(dif?(f)|?(d)patch)?(.@([gx]z|bz2|lzma))' cdiff
complete -f -X '!*.@(dif?(f)|?(d)patch)' kompare
complete -f -X '!*.lyx' lyx
# FINISH exclude -- do not remove this line
# start of section containing compspecs that can be handled within bash
# user commands see only users
complete -u su passwd write chfn groups slay w sux
complete -u su write chfn groups slay w sux
# bg completes with stopped jobs
complete -A stopped -P '"%' -S '"' bg
@ -310,7 +309,7 @@ __reassemble_comp_words_by_ref() {
ref="$2[$j]"
eval $2[$j]=\${!ref}\${COMP_WORDS[i]}
# Indicate new cword
[ $i = $COMP_CWORD ] && [[ ${COMP_WORDS[i]} ]] && eval $3=$j
[[ $i == $COMP_CWORD ]] && eval $3=$j
done
else
# No, list of word completions separators hasn't changed;
@ -464,7 +463,7 @@ _get_cword()
# return previous word offset by $2
if [[ ${2//[^0-9]/} ]]; then
printf "%s" "${words[cword-$2]}"
elif [[ "${#words[cword]}" -eq 0 ]] || [[ "$COMP_POINT" == "${#COMP_LINE}" ]]; then
elif [[ "${#words[cword]}" -eq 0 || "$COMP_POINT" == "${#COMP_LINE}" ]]; then
printf "%s" "${words[cword]}"
else
local i
@ -568,16 +567,32 @@ __ltrim_colon_completions() {
# $ compgen -f "a\\\\\'b/" # Good (bash-3)
# a\'b/c
#
# See also: http://lists.gnu.org/archive/html/bug-bash/2009-03/msg00155.html
# On bash-3, special characters need to be escaped extra. This is
# unless the first character is a single quote ('). If the single
# quote appears further down the string, bash default completion also
# fails, e.g.:
#
# $ ls 'a&b/'
# f
# $ foo 'a&b/<TAB> # Becomes: foo 'a&b/f'
# $ foo a'&b/<TAB> # Nothing happens
#
# See also:
# - http://lists.gnu.org/archive/html/bug-bash/2009-03/msg00155.html
# - http://www.mail-archive.com/bash-completion-devel@lists.alioth.\
# debian.org/msg01944.html
# @param $1 Argument to quote
# @param $2 Name of variable to return result to
_quote_readline_by_ref()
{
if [[ ${1:0:1} == "'" ]]; then
# Quote word, leaving out first character
printf -v $2 %q "${1:1}"
if [[ ${BASH_VERSINFO[0]} -le 3 ]]; then
# Double-quote word on bash-3
if [[ ${BASH_VERSINFO[0]} -ge 4 ]]; then
# Leave out first character
printf -v $2 %s "${1:1}"
else
# Quote word, leaving out first character
printf -v $2 %q "${1:1}"
# Double-quote word (bash-3)
printf -v $2 %q ${!2}
fi
elif [[ ${BASH_VERSINFO[0]} -le 3 && ${1:0:1} == '"' ]]; then
@ -593,16 +608,30 @@ _quote_readline_by_ref()
} # _quote_readline_by_ref()
# This function turns on "-o filenames" behavior dynamically. It is present
# for bash < 4 reasons. See http://bugs.debian.org/272660#64 for info about
# the bash < 4 compgen hack.
_compopt_o_filenames()
{
# We test for compopt availability first because directly invoking it on
# bash < 4 at this point may cause terminal echo to be turned off for some
# reason, see https://bugzilla.redhat.com/653669 for more info.
type compopt &>/dev/null && compopt -o filenames 2>/dev/null || \
compgen -f /non-existing-dir/ >/dev/null
}
# This function performs file and directory completion. It's better than
# simply using 'compgen -f', because it honours spaces in filenames.
# @param $1 If `-d', complete only on directories. Otherwise filter/pick only
# completions with `.$1' as file extension.
# completions with `.$1' and the uppercase version of it as file
# extension.
#
_filedir()
{
local i IFS=$'\t\n' xspec
local i IFS=$'\n' xspec
__expand_tilde_by_ref cur
_tilde "$cur" || return 0
local -a toks
local quoted tmp
@ -621,68 +650,14 @@ _filedir()
}
))
# On bash-3, special characters need to be escaped extra. This is
# unless the first character is a single quote ('). If the single
# quote appears further down the string, bash default completion also
# fails, e.g.:
#
# $ ls 'a&b/'
# f
# $ foo 'a&b/<TAB> # Becomes: foo 'a&b/f'
# $ foo a'&b/<TAB> # Nothing happens
#
if [[ "$1" != -d ]]; then
xspec=${1:+"!*.$1"}
if [[ ${cur:0:1} == "'" && ${BASH_VERSINFO[0]} -ge 4 ]]; then
toks=( ${toks[@]-} $(
eval compgen -f -X \"\$xspec\" -- $quoted
) )
else
toks=( ${toks[@]-} $(
compgen -f -X "$xspec" -- $quoted
) )
fi
if [ ${#toks[@]} -ne 0 ]; then
# If `compopt' is available, set `-o filenames'
compopt &>/dev/null && compopt -o filenames ||
# No, `compopt' isn't available;
# Is `-o filenames' set?
[[ (
${COMP_WORDS[0]} &&
"$(complete -p ${COMP_WORDS[0]})" == *"-o filenames"*
) ]] || {
# No, `-o filenames' isn't set;
# Emulate `-o filenames'
# NOTE: A side-effect of emulating `-o filenames' is that
# backslash escape characters are visible within the list
# of presented completions, e.g. the completions look
# like:
#
# $ foo a<TAB>
# a\ b/ a\$b/
#
# whereas with `-o filenames' active the completions look
# like:
#
# $ ls a<TAB>
# a b/ a$b/
#
for ((i=0; i < ${#toks[@]}; i++)); do
# If directory exists, append slash (/)
if [[ ${cur:0:1} != "'" ]]; then
[[ -d ${toks[i]} ]] && toks[i]="${toks[i]}"/
if [[ ${cur:0:1} == '"' ]]; then
toks[i]=${toks[i]//\\/\\\\}
toks[i]=${toks[i]//\"/\\\"}
toks[i]=${toks[i]//\$/\\\$}
else
toks[i]=$(printf %q ${toks[i]})
fi
fi
done
}
fi
# Munge xspec to contain uppercase version too
[[ ${BASH_VERSINFO[0]} -ge 4 ]] && \
xspec=${1:+"!*.@($1|${1^^})"} || \
xspec=${1:+"!*.@($1|$(printf %s $1 | tr '[:lower:]' '[:upper:]'))"}
toks=( ${toks[@]-} $( compgen -f -X "$xspec" -- $quoted) )
fi
[ ${#toks[@]} -ne 0 ] && _compopt_o_filenames
COMPREPLY=( "${COMPREPLY[@]}" "${toks[@]}" )
} # _filedir()
@ -705,13 +680,13 @@ _split_longopt()
return 1
}
# This function tries to parse the output of $command --help
# This function tries to parse the help output of the given command.
# @param $1 command
# @param $2 command options (default: --help)
#
_parse_help() {
local cmd
cmd=$1
$cmd --help 2>&1 | command grep -- "^[[:space:]]*-" | tr "," " " | \
awk '{print $1; if ($2 ~ /-.*/) { print $2 } }' | sed -e "s:=.*::g"
$1 ${2:---help} 2>&1 | sed -e '/^[[:space:]]*-/!d' -e 's|[,/]| |g' | \
awk '{ print $1; if ($2 ~ /^-/) { print $2 } }' | sed -e 's|=.*||'
}
# This function completes on signal names
@ -746,6 +721,10 @@ _mac_addresses()
"s/.*[[:space:]]\($re\)[[:space:]].*/\1/p" -ne \
"s/.*[[:space:]]\($re\)[[:space:]]*$/\1/p" ) )
# /etc/ethers
COMPREPLY=( "${COMPREPLY[@]}" $( sed -ne \
"s/^[[:space:]]*\($re\)[[:space:]].*/\1/p" /etc/ethers 2>/dev/null ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
__ltrim_colon_completions "$cur"
}
@ -805,7 +784,27 @@ _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
_compopt_o_filenames
# Try generate username completions
COMPREPLY=( $( compgen -P '~' -u "${1#\~}" ) )
result=${#COMPREPLY[@]}
fi
return $result
}
# Expand variable starting with tilde (~)
# We want to expand ~foo/... to /home/foo/... to avoid problems when
# word-to-complete starting with a tilde is fed to commands and ending up
# quoted instead of expanded.
# Only the first portion of the variable from the tilde up to the first slash
# (~../) is expanded. The remainder of the variable, containing for example
# a dollar sign variable ($) or asterisk (*) is not expanded.
@ -834,7 +833,7 @@ __expand_tilde_by_ref() {
# becomes "~a". Double quotes allow eval.
# 2: Remove * before the first slash (/), i.e. "~a/b"
# becomes "b". Single quotes prevent eval.
# +-----1----+ +---2----+
# +-----1----+ +---2----+
eval $1="${!1/%\/*}"/'${!1#*/}'
else
# No, $1 doesn't contain slash
@ -982,10 +981,10 @@ _installed_modules()
# The : must be added manually; it will only complete usernames initially.
# The legacy user.group format is not supported.
#
# It assumes compopt -o filenames; but doesn't touch it.
# @param $1 If -u, only return users/groups the user has access to in
# context of current completion.
_usergroup()
{
local IFS=$'\n'
if [[ $cur = *\\\\* || $cur = *:*:* ]]; then
# Give up early on if something seems horribly wrong.
return
@ -996,19 +995,61 @@ _usergroup()
local prefix
prefix=${cur%%*([^:])}
prefix=${prefix//\\}
COMPREPLY=( $( compgen -P "$prefix" -g -- "${cur#*[:]}" ) )
local mycur="${cur#*[:]}"
if [[ $1 == -u ]]; then
_allowed_groups "$mycur"
else
local IFS=$'\n'
COMPREPLY=( $( compgen -g -- "$mycur" ) )
fi
COMPREPLY=( $( compgen -P "$prefix" -W "${COMPREPLY[@]}" ) )
elif [[ $cur = *:* ]]; then
# Completing group after 'user:gr<TAB>'.
# Reply with a list of unprefixed groups since readline with split on :
# and only replace the 'gr' part
COMPREPLY=( $( compgen -g -- "${cur#*:}" ) )
local mycur="${cur#*:}"
if [[ $1 == -u ]]; then
_allowed_groups "$mycur"
else
local IFS=$'\n'
COMPREPLY=( $( compgen -g -- "$mycur" ) )
fi
else
# Completing a partial 'usernam<TAB>'.
#
# Don't suffix with a : because readline will escape it and add a
# slash. It's better to complete into 'chown username ' than 'chown
# username\:'.
COMPREPLY=( $( compgen -u -- "$cur" ) )
if [[ $1 == -u ]]; then
_allowed_users "$cur"
else
local IFS=$'\n'
COMPREPLY=( $( compgen -u -- "$cur" ) )
fi
fi
}
_allowed_users()
{
if _complete_as_root; then
local IFS=$'\n'
COMPREPLY=( $( compgen -u -- "${1:-$cur}" ) )
else
local IFS=$'\n '
COMPREPLY=( $( compgen -W \
"$( id -un 2>/dev/null || whoami 2>/dev/null )" -- "${1:-$cur}" ) )
fi
}
_allowed_groups()
{
if _complete_as_root; then
local IFS=$'\n'
COMPREPLY=( $( compgen -g -- "$1" ) )
else
local IFS=$'\n '
COMPREPLY=( $( compgen -W \
"$( id -Gn 2>/dev/null || groups 2>/dev/null )" -- "$1" ) )
fi
}
@ -1164,7 +1205,8 @@ _known_hosts()
# Helper function for completing _known_hosts.
# This function performs host completion based on ssh's config and known_hosts
# files, as well as hostnames reported by avahi-browse. Also hosts from
# files, as well as hostnames reported by avahi-browse if
# COMP_KNOWN_HOSTS_WITH_AVAHI is set to a non-empty value. Also hosts from
# HOSTFILE (compgen -A hostname) are added, unless
# COMP_KNOWN_HOSTS_WITH_HOSTFILE is set to an empty value.
# Usage: _known_hosts_real [OPTIONS] CWORD
@ -1259,16 +1301,16 @@ _known_hosts_real()
awkcur=${awkcur//\./\\\.}
curd=$awkcur
if [[ "$awkcur" == [0-9]*.* ]]; then
# Digits followed by a dot - just search for that
awkcur="^$awkcur.*"
if [[ "$awkcur" == [0-9]*[.:]* ]]; then
# Digits followed by a dot or a colon - just search for that
awkcur="^$awkcur[.:]*"
elif [[ "$awkcur" == [0-9]* ]]; then
# Digits followed by no dot - search for digits followed
# by a dot
awkcur="^$awkcur.*\."
# Digits followed by no dot or colon - search for digits followed
# by a dot or a colon
awkcur="^$awkcur.*[.:]"
elif [ -z "$awkcur" ]; then
# A blank - search for a dot or an alpha character
awkcur="[a-z.]"
# A blank - search for a dot, a colon, or an alpha character
awkcur="[a-z.:]"
else
awkcur="^$awkcur"
fi
@ -1277,9 +1319,8 @@ _known_hosts_real()
# FS needs to look for a comma separated list
COMPREPLY=( "${COMPREPLY[@]}" $( awk 'BEGIN {FS=","}
/^\s*[^|\#]/ {for (i=1; i<=2; ++i) { \
gsub(" .*$", "", $i); \
gsub("[\\[\\]]", "", $i); \
gsub(":[0-9]+$", "", $i); \
sub(" .*$", "", $i); \
sub("^\\[", "", $i); sub("\\](:[0-9]+)?$", "", $i); \
if ($i ~ /'"$awkcur"'/) {print $i} \
}}' "${kh[@]}" 2>/dev/null ) )
fi
@ -1310,12 +1351,14 @@ _known_hosts_real()
-S "$suffix" -W "$hosts" -- "$cur" ) )
fi
# Add hosts reported by avahi-browse, if it's available.
# The original call to avahi-browse also had "-k", to avoid lookups into
# avahi's services DB. We don't need the name of the service, and if it
# contains ";", it may mistify the result. But on Gentoo (at least),
# -k isn't available (even if mentioned in the manpage), so...
if type avahi-browse >&/dev/null; then
# Add hosts reported by avahi-browse, if desired and it's available.
if [[ ${COMP_KNOWN_HOSTS_WITH_AVAHI:-} ]] && \
type avahi-browse &>/dev/null; then
# The original call to avahi-browse also had "-k", to avoid lookups
# into avahi's services DB. We don't need the name of the service, and
# if it contains ";", it may mistify the result. But on Gentoo (at
# least), -k wasn't available (even if mentioned in the manpage) some
# time ago, so...
COMPREPLY=( "${COMPREPLY[@]}" $( \
compgen -P "$prefix$user" -S "$suffix" -W \
"$( avahi-browse -cpr _workstation._tcp 2>/dev/null | \
@ -1342,7 +1385,7 @@ complete -F _known_hosts traceroute traceroute6 tracepath tracepath6 ping \
#
_cd()
{
local cur IFS=$'\t\n' i j k
local cur IFS=$'\n' i j k
_get_comp_words_by_ref cur
# try to allow variable completion
@ -1351,8 +1394,7 @@ _cd()
return 0
fi
# Enable -o filenames option, see Debian bug #272660
compgen -f /non-existing-dir/ >/dev/null
_compopt_o_filenames
# Use standard dir completion if no CDPATH or parameter starts with /,
# ./ or ../
@ -1365,7 +1407,7 @@ _cd()
local -r mark_symdirs=$(_rl_enabled mark-symlinked-directories && echo y)
# we have a CDPATH, so loop on its contents
for i in ${CDPATH//:/$'\t'}; do
for i in ${CDPATH//:/$'\n'}; do
# create an array of matched subdirs
k="${#COMPREPLY[@]}"
for j in $( compgen -d $i/$cur ); do
@ -1449,11 +1491,12 @@ _command_offset()
_get_comp_words_by_ref cur
if [[ $COMP_CWORD -eq 0 ]]; then
_compopt_o_filenames
COMPREPLY=( $( compgen -c -- "$cur" ) )
else
cmd=${COMP_WORDS[0]}
if complete -p $cmd &>/dev/null; then
cspec=$( complete -p $cmd )
if complete -p ${cmd##*/} &>/dev/null; then
cspec=$( complete -p ${cmd##*/} )
if [ "${cspec#* -F }" != "$cspec" ]; then
# complete -F <function>
@ -1475,68 +1518,74 @@ _command_offset()
cspec=${cspec%% *}
if [[ "$cspec" != @(dir|file)names ]]; then
COMPREPLY=("${COMPREPLY[@]//\\\\:/:}")
else
_compopt_o_filenames
fi
fi
elif [ -n "$cspec" ]; then
cspec=${cspec#complete};
cspec=${cspec%%$cmd};
cspec=${cspec%%${cmd##*/}};
COMPREPLY=( $( eval compgen "$cspec" -- "$cur" ) );
fi
elif [ ${#COMPREPLY[@]} -eq 0 ]; then
_filedir
fi
fi
[ ${#COMPREPLY[@]} -eq 0 ] && _filedir
}
complete -F _command -o filenames nohup exec nice eval time ltrace then \
else do vsound command xargs tsocks aoss padsp
complete -F _command aoss command do else eval exec ltrace nice nohup padsp \
then time tsocks vsound xargs
_root_command()
{
local PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin
local root_command=$1
_command $1 $2 $3
}
complete -F _root_command -o filenames sudo fakeroot really gksudo gksu kdesudo
complete -F _root_command fakeroot gksu gksudo kdesudo really sudo
# Return true if the completion should be treated as running as root
_complete_as_root()
{
[[ $EUID -eq 0 || ${root_command:-} ]]
}
_longopt()
{
local cur prev
local cur prev split=false
_get_comp_words_by_ref -n = cur prev
_get_comp_words_by_ref cur prev
_split_longopt && split=true
if _split_longopt; then
case "$prev" in
*[Dd][Ii][Rr]*)
_filedir -d
;;
*[Ff][Ii][Ll][Ee]*)
_filedir
;;
esac
return 0
fi
case "$prev" in
--*[Dd][Ii][Rr]*)
_filedir -d
return 0
;;
--*[Ff][Ii][Ll][Ee]*|--*[Pp][Aa][Tt][Hh]*)
_filedir
return 0
;;
esac
$split && return 0
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$( $1 --help 2>&1 | \
sed -ne 's/.*\(--[-A-Za-z0-9]\{1,\}\).*/\1/p' | sort -u )" \
-- "$cur" ) )
elif [[ "$1" == rmdir ]]; then
elif [[ "$1" == @(mk|rm)dir ]]; then
_filedir -d
else
_filedir
fi
}
# makeinfo and texi2dvi are defined elsewhere.
for i in a2ps autoconf automake bc gprof ld nm objcopy objdump readelf strip \
bison colordiff diff patch enscript cp df dir du ln ls mkfifo mknod mv rm \
touch vdir awk gperf grep grub indent less m4 sed shar date \
tee who texindex cat csplit cut expand fmt fold head \
md5sum nl od paste pr ptx sha1sum sort split tac tail tr unexpand \
uniq wc ldd bash id irb mkdir rmdir wget curl; do
have $i && complete -F _longopt -o filenames $i
done
# These commands do not use filenames, so '-o filenames' is not needed.
for i in env netstat seq uname units; do
for i in a2ps awk bash bc bison cat colordiff cp csplit \
curl cut date df diff dir du enscript env expand fmt fold gperf gprof \
grep grub head indent irb ld ldd less ln ls m4 md5sum mkdir mkfifo mknod \
mv netstat nl nm objcopy objdump od paste patch pr ptx readelf rm rmdir \
sed seq sha{,1,224,256,384,512}sum shar sort split strip tac tail tee \
texindex touch tr uname unexpand uniq units vdir wc wget who; do
have $i && complete -F _longopt -o default $i
done
unset i
@ -1545,7 +1594,7 @@ _filedir_xspec()
{
local IFS cur xspec
IFS=$'\t\n'
IFS=$'\n'
COMPREPLY=()
_get_comp_words_by_ref cur
@ -1570,14 +1619,26 @@ _filedir_xspec()
}
))
# Munge xspec to contain uppercase version too
eval xspec="${xspec}"
local matchop=!
if [[ $xspec == !* ]]; then
xspec=${xspec#!}
matchop=@
fi
[[ ${BASH_VERSINFO[0]} -ge 4 ]] && \
xspec="$matchop($xspec|${xspec^^})" || \
xspec="$matchop($xspec|$(printf %s $xspec | tr '[:lower:]' '[:upper:]'))"
toks=( ${toks[@]-} $(
eval compgen -f -X "$xspec" -- "\$(quote_readline "\$cur")" | {
eval compgen -f -X "!$xspec" -- "\$(quote_readline "\$cur")" | {
while read -r tmp; do
[ -n $tmp ] && printf '%s\n' $tmp
done
}
))
[ ${#toks[@]} -ne 0 ] && _compopt_o_filenames
COMPREPLY=( "${toks[@]}" )
}
list=( $( sed -ne '/^# START exclude/,/^# FINISH exclude/p' "$BASH_COMPLETION" | \
@ -1599,7 +1660,7 @@ list=( $( sed -ne '/^# START exclude/,/^# FINISH exclude/p' "$BASH_COMPLETION" |
if [ ${#list[@]} -gt 0 ]; then
eval complete -r ${list[@]}
# install new compspecs
eval complete -F _filedir_xspec -o filenames "${list[@]}"
eval complete -F _filedir_xspec "${list[@]}"
fi
unset list
@ -1608,8 +1669,8 @@ if [[ -d $BASH_COMPLETION_COMPAT_DIR && -r $BASH_COMPLETION_COMPAT_DIR && \
-x $BASH_COMPLETION_COMPAT_DIR ]]; then
for i in $(LC_ALL=C command ls "$BASH_COMPLETION_COMPAT_DIR"); do
i=$BASH_COMPLETION_COMPAT_DIR/$i
[[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|*.rpm@(orig|new|save)) \
&& ( -f $i || -h $i ) && -r $i ]] && . "$i"
[[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|*.rpm@(orig|new|save)|Makefile*) \
&& -f $i && -r $i ]] && . "$i"
done
fi
if [[ $BASH_COMPLETION_DIR != $BASH_COMPLETION_COMPAT_DIR && \
@ -1617,8 +1678,8 @@ if [[ $BASH_COMPLETION_DIR != $BASH_COMPLETION_COMPAT_DIR && \
-x $BASH_COMPLETION_DIR ]]; then
for i in $(LC_ALL=C command ls "$BASH_COMPLETION_DIR"); do
i=$BASH_COMPLETION_DIR/$i
[[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|*.rpm@(orig|new|save)) \
&& ( -f $i || -h $i ) && -r $i ]] && . "$i"
[[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|*.rpm@(orig|new|save)|Makefile*) \
&& -f $i && -r $i ]] && . "$i"
done
fi
unset i

View File

@ -4,7 +4,7 @@
# Check for recent enough version of bash.
bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.}
if [ $bmajor -gt 3 ] || [ $bmajor -eq 3 -a $bminor -ge 2 ]; then
if [ -r @sysconfdir@/bash_completion ]; then
if shopt -q progcomp && [ -r @sysconfdir@/bash_completion ]; then
# Source completion code.
. @sysconfdir@/bash_completion
fi

182
completions/Makefile.am Normal file
View File

@ -0,0 +1,182 @@
SUBDIRS = helpers
bashcomp_DATA = abook \
ant \
apache2ctl \
apt \
apt-build \
aptitude \
aspell \
autoconf \
automake \
autorpm \
bash-builtins \
bind-utils \
bitkeeper \
bittorrent \
bluez \
brctl \
bzip2 \
cardctl \
cfengine \
chkconfig \
chsh \
cksfv \
clisp \
configure \
coreutils \
cowsay \
cpan2dist \
cpio \
crontab \
cups \
cryptsetup \
cvs \
cvsps \
dd \
dhclient \
dict \
dpkg \
dselect \
dsniff \
dvd+rw-tools \
e2fsprogs \
findutils \
freeciv \
freerdp \
fuse \
gcc \
gcl \
gdb \
genisoimage \
getent \
gkrellm \
gnatmake \
gpg \
gpg2 \
gzip \
heimdal \
hping2 \
iconv \
iftop \
ifupdown \
imagemagick \
info \
iptables \
ipmitool \
iproute2 \
ipsec \
ipv6calc \
isql \
jar \
java \
k3b \
kldload \
larch \
ldapvi \
lftp \
lilo \
links \
lintian \
lisp \
lrzip \
lsof \
lvm \
lzma \
lzop \
mailman \
make \
man \
mc \
mcrypt \
mdadm \
medusa \
minicom \
mkinitrd \
module-init-tools \
monodevelop \
mount \
mplayer \
msynctool \
mtx \
munin-node \
mutt \
mysqladmin \
ncftp \
net-tools \
nmap \
ntpdate \
openldap \
openssl \
p4 \
perl \
pine \
pkg-config \
pkg_install \
pkgtools \
pm-utils \
portupgrade \
postfix \
postgresql \
povray \
procps \
python \
qdbus \
qemu \
quota-tools \
rcs \
rdesktop \
reportbug \
resolvconf \
rfkill \
ri \
rpcdebug \
rpm \
rpmcheck \
rrdtool \
rsync \
rtcwake \
samba \
sbcl \
screen \
service \
sh \
shadow \
sitecopy \
smartctl \
snownews \
sqlite3 \
ssh \
sshfs \
strace \
svk \
sysbench \
sysctl \
sysv-rc \
tar \
tcpdump \
unace \
unrar \
update-alternatives \
util-linux \
vncviewer \
vpnc \
wireless-tools \
wodim \
wol \
wtf \
wvdial \
xhost \
xm \
xmllint \
xmlwf \
xmms \
xmodmap \
xrandr \
xrdb \
xsltproc \
xz \
yp-tools \
yum-arch
EXTRA_DIST = $(bashcomp_DATA) \
_mock _modules _subversion _yum _yum-utils

View File

@ -27,7 +27,8 @@ _mock()
_split_longopt && split=true
case $prev in
-h|--help|--copyin|--copyout|--arch|-D|--define|--with|--without|--uniqueext|--rpmbuild_timeout|--sources|--cwd)
-h|--help|--copyin|--copyout|--arch|-D|--define|--with|--without|\
--uniqueext|--rpmbuild_timeout|--sources|--cwd)
return 0
;;
-r|--root)
@ -62,20 +63,18 @@ _mock()
$split && return 0
if [[ "$cur" == -* ]] ; then
COMPREPLY=( $( compgen -W '--version --help --rebuild \
--buildsrpm --shell --chroot --clean --init \
--installdeps --install --update --orphanskill \
--copyin --copyout --root --offline --no-clean \
--cleanup-after --no-cleanup-after --arch --target \
--define --with --without --resultdir --uniqueext \
--configdir --rpmbuild_timeout --unpriv --cwd --spec \
--sources --verbose --quiet --trace --enable-plugin \
--disable-plugin --print-root-path' -- "$cur" ) )
COMPREPLY=( $( compgen -W '--version --help --rebuild --buildsrpm
--shell --chroot --clean --init --installdeps --install --update
--orphanskill --copyin --copyout --root --offline --no-clean
--cleanup-after --no-cleanup-after --arch --target --define --with
--without --resultdir --uniqueext --configdir --rpmbuild_timeout
--unpriv --cwd --spec --sources --verbose --quiet --trace
--enable-plugin --disable-plugin --print-root-path' -- "$cur" ) )
else
_filedir '?(no)src.rpm'
_filedir '@(?(no)src.r|s)pm'
fi
} &&
complete -F _mock -o filenames mock
complete -F _mock mock
# Local variables:
# mode: shell-script

360
completions/_subversion Normal file
View File

@ -0,0 +1,360 @@
# Use of this file is deprecated. Upstream completion is available in
# subversion >= 0.12.0, use that instead.
# svn completion
have svn &&
{
_svn()
{
local cur prev commands options command
COMPREPLY=()
_get_comp_words_by_ref cur prev
commands='add blame praise annotate ann cat checkout co cleanup commit \
ci copy cp delete del remove rm diff di export help ? h import \
info list ls lock log merge mkdir move mv rename ren \
propdel pdel pd propedit pedit pe propget pget pg \
proplist plist pl propset pset ps resolved revert \
status stat st switch sw unlock update up'
if [[ $COMP_CWORD -eq 1 ]] ; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--version' -- $cur ) )
else
COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
fi
else
case $prev in
--config-dir)
_filedir -d
return 0
;;
-F|--file|--targets)
_filedir
return 0
;;
--encoding)
COMPREPLY=( $( compgen -W '$( iconv --list | \
sed -e "s@//@@;" )' -- "$cur" ) )
return 0
;;
--editor-cmd|--diff-cmd|--diff3-cmd)
COMP_WORDS=(COMP_WORDS[0] $cur)
COMP_CWORD=1
_command
return 0
;;
esac
command=${COMP_WORDS[1]}
if [[ "$cur" == -* ]]; then
# possible options for the command
case $command in
add)
options='--auto-props --no-auto-props --force --targets
--no-ignore --non-recursive -N -q --quiet'
;;
blame|annotate|ann|praise)
options='-r --revisions --username --password
--no-auth-cache --non-interactive -v --verbose
--incremental --xml'
;;
cat)
options='-r --revision --username --password
--no-auth-cache --non-interactive'
;;
checkout|co)
options='-r --revision -q --quiet -N --non-recursive
--username --password --no-auth-cache
--non-interactive --ignore-externals'
;;
cleanup)
options='--diff3-cmd'
;;
commit|ci)
options='-m --message -F --file --encoding --force-log -q
--quiet --non-recursive -N --targets --editor-cmd
--username --password --no-auth-cache
--non-interactive --no-unlock'
;;
copy|cp)
options='-m --message -F --file --encoding --force-log -r
--revision -q --quiet --editor-cmd -username
--password --no-auth-cache --non-interactive'
;;
delete|del|remove|rm)
options='--force -m --message -F --file --encoding
--force-log -q --quiet --targets --editor-cmd
--username --password --no-auth-cache
--non-interactive'
;;
diff|di)
options='-r --revision -x --extensions --diff-cmd
--no-diff-deleted -N --non-recursive --username
--password --no-auth-cache --non-interactive
--force --old --new --notice-ancestry'
;;
export)
options='-r --revision -q --quiet --username --password
--no-auth-cache --non-interactive -N
--non-recursive --force --native-eol
--ignore-externals'
;;
import)
options='--auto-props --no-auto-props -m --message -F
--file --encoding --force-log -q --quiet
--non-recursive --no-ignore --editor-cmd
--username --password --no-auth-cache
--non-interactive'
;;
info)
options='--username --password --no-auth-cache
--non-interactive -r --revision --xml --targets
-R --recursive --incremental'
;;
list|ls)
options='-r --revision -v --verbose -R --recursive
--username --password --no-auth-cache
--non-interactive --incremental --xml'
;;
lock)
options='-m --message -F --file --encoding --force-log
--targets --force --username --password
--no-auth-cache --non-interactive'
;;
log)
options='-r --revision -v --verbose --targets --username
--password --no-auth-cache --non-interactive
--stop-on-copy --incremental --xml -q --quiet
--limit'
;;
merge)
options='-r --revision -N --non-recursive -q --quiet
--force --dry-run --diff3-cmd --username
--password --no-auth-cache --non-interactive
--ignore-ancestry'
;;
mkdir)
options='-m --message -F --file --encoding --force-log -q
--quiet --editor-cmd --username --password
--no-auth-cache --non-interactive'
;;
move|mv|rename|ren)
options='-m --message -F --file --encoding --force-log -r
--revision -q --quiet --force --editor-cmd
--username --password --no-auth-cache
--non-interactive'
;;
propdel|pdel|pd)
options='-q --quiet -R --recursive -r --revision --revprop
--username --password --no-auth-cache
--non-interactive'
;;
propedit|pedit|pe)
options='-r --revision --revprop --encoding --editor-cmd
--username --password --no-auth-cache
--non-interactive --force'
;;
propget|pget|pg)
options='-R --recursive -r --revision --revprop --strict
--username --password --no-auth-cache
--non-interactive'
;;
proplist|plist|pl)
options='-v --verbose -R --recursive -r --revision
--revprop -q --quiet --username --password
--no-auth-cache --non-interactive'
;;
propset|pset|ps)
options='-F --file -q --quiet --targets -R --recursive
--revprop --encoding --username --password
--no-auth-cache --non-interactive -r --revision
--force'
;;
resolved)
options='--targets -R --recursive -q --quiet'
;;
revert)
options='--targets -R --recursive -q --quiet'
;;
status|stat|st)
options='-u --show-updates -v --verbose -N --non-recursive
-q --quiet --username --password --no-auth-cache
--non-interactive --no-ignore --ignore-externals
--incremental --xml'
;;
switch|sw)
options='--relocate -r --revision -N --non-recursive -q
--quiet --username --password --no-auth-cache
--non-interactive --diff3-cmd'
;;
unlock)
options='--targets --force --username --password
--no-auth-cache --non-interactive'
;;
update|up)
options='-r --revision -N --non-recursive -q --quiet
--username --password --no-auth-cache
--non-interactive --diff3-cmd --ignore-externals'
;;
esac
options="$options --help -h --config-dir"
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
else
if [[ "$command" == @(help|h|\?) ]]; then
COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
else
_filedir
fi
fi
fi
return 0
}
complete -F _svn svn
_svnadmin()
{
local cur prev commands options mode
COMPREPLY=()
_get_comp_words_by_ref cur prev
commands='create deltify dump help ? hotcopy list-dblogs list-unused-dblogs
load lslocks lstxns recover rmlocks rmtxns setlog verify'
if [[ $COMP_CWORD -eq 1 ]] ; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--version' -- $cur ) )
else
COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
fi
else
case $prev in
--config-dir)
_filedir -d
return 0
;;
--fs-type)
COMPREPLY=( $( compgen -W 'fsfs bdb' -- $cur ) )
return 0
;;
esac
command=${COMP_WORDS[1]}
if [[ "$cur" == -* ]]; then
# possible options for the command
case $command in
create)
options='--bdb-txn-nosync --bdb-log-keep --config-dir
--fs-type'
;;
deltify)
options='-r --revision -q --quiet'
;;
dump)
options='-r --revision --incremental -q --quiet --deltas'
;;
hotcopy)
options='--clean-logs'
;;
load)
options='--ignore-uuid --force-uuid --parent-dir -q --quiet
--use-pre-commit-hook --use-post-commit-hook'
;;
rmtxns)
options='-q --quiet'
;;
setlog)
options='-r --revision --bypass-hooks'
;;
esac
options="$options --help -h"
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
else
if [[ "$command" == @(help|h|\?) ]]; then
COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
else
_filedir
fi
fi
fi
return 0
}
complete -F _svnadmin -o default svnadmin
_svnlook()
{
local cur prev commands options mode
COMPREPLY=()
_get_comp_words_by_ref cur
commands='author cat changed date diff dirs-changed help ? h history info
lock log propget pget pg proplist plist pl tree uuid youngest'
if [[ $COMP_CWORD -eq 1 ]] ; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--version' -- $cur ) )
else
COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
fi
else
command=${COMP_WORDS[1]}
if [[ "$cur" == -* ]]; then
# possible options for the command
case $command in
author|cat|date|dirs-changed|info|log)
options='-r --revision -t --transaction'
;;
changed)
options='-r --revision -t --transaction --copy-info'
;;
diff)
options='-r --revision -t --transaction --no-diff-deleted
--no-diff-added --diff-copy-from'
;;
history)
options='-r --revision --show-ids'
;;
propget|proplist)
options='-r --revision -t --transaction --revprop'
;;
tree)
options='-r --revision -t --transaction --show-ids
--full-paths'
;;
esac
options="$options --help -h"
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
else
if [[ "$command" == @(help|h|\?) ]]; then
COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
else
_filedir
fi
fi
fi
return 0
}
complete -F _svnlook -o default svnlook
}
# 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

@ -146,7 +146,7 @@ _yum()
fi
}
} &&
complete -F _yum -o filenames yum
complete -F _yum yum
# Local variables:
# mode: shell-script

View File

@ -20,7 +20,7 @@ _repomanage()
_filedir -d
fi
} &&
complete -F _repomanage -o filenames repomanage
complete -F _repomanage repomanage
# Local variables:
# mode: shell-script

View File

@ -26,13 +26,11 @@ _abook()
case $prev in
--informat)
[ ${BASH_VERSINFO[0]} -ge 4 ] && compopt +o filenames
COMPREPLY=( $( compgen -W "$(abook --formats | \
sed -n -e 's/^\t\([a-z]*\).*/\1/p' -e '/^$/q')" -- "$cur" ) )
return 0
;;
--outformat)
[ ${BASH_VERSINFO[0]} -ge 4 ] && compopt +o filenames
COMPREPLY=( $( compgen -W "$(abook --formats | \
sed -n -e '/^$/,$s/^\t\([a-z]*\).*/\1/p')" -- "$cur" ) )
return 0
@ -53,7 +51,7 @@ _abook()
;;
esac
} &&
complete -F _abook -o filenames abook
complete -F _abook abook
# Local variables:
# mode: shell-script

View File

@ -58,8 +58,7 @@ _ant()
fi
}
have complete-ant-cmd.pl && \
complete -C complete-ant-cmd.pl -F _ant -o filenames ant || \
complete -F _ant -o filenames ant
complete -C complete-ant-cmd.pl -F _ant ant || complete -F _ant ant
}
# Local variables:

View File

@ -71,7 +71,7 @@ _apt_get()
return 0
} &&
complete -F _apt_get -o filenames apt-get
complete -F _apt_get apt-get
# Debian apt-cache(8) completion.
#
@ -146,7 +146,7 @@ _apt_cache()
return 0
} &&
complete -F _apt_cache -o filenames apt-cache
complete -F _apt_cache apt-cache
# Local variables:
# mode: shell-script

View File

@ -55,7 +55,7 @@ _apt_build()
return 0
} &&
complete -F _apt_build -o filenames apt-build
complete -F _apt_build apt-build
# Local variables:
# mode: shell-script

View File

@ -84,7 +84,7 @@ _aspell()
fi
}
complete -F _aspell -o filenames aspell
complete -F _aspell aspell
}
# Local variables:

124
completions/autoconf Normal file
View File

@ -0,0 +1,124 @@
# Completions for autoconf tools
have autoconf &&
_autoconf()
{
COMPREPLY=()
local cur prev split=false
_get_comp_words_by_ref cur prev
_split_longopt && split=true
case "$prev" in
--help|-h|--version|-V|--trace|-t)
return 0
;;
--output|-o)
_filedir
return 0
;;
--warnings|-W)
local cats=( cross obsolete syntax )
COMPREPLY=( $( compgen -W \
'${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) )
return 0
;;
--prepend-include|-B|--include|-I)
_filedir -d
return 0
;;
esac
$split && return 0
if [[ "$cur" == -* ]]; then
_longopt $1
return
fi
_filedir '@(ac|in)'
} &&
complete -F _autoconf autoconf
have autoreconf || have autoheader &&
_autoreconf()
{
COMPREPLY=()
local cur prev split=false
_get_comp_words_by_ref cur prev
_split_longopt && split=true
case "$prev" in
--help|-h|--version|-V)
return 0
;;
--warnings|-W)
local cats=( cross gnu obsolete override portability syntax \
unsupported )
COMPREPLY=( $( compgen -W \
'${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) )
return 0
;;
--prepend-include|-B|--include|-I)
_filedir -d
return 0
;;
esac
$split && return 0
if [[ "$cur" == -* ]]; then
_longopt $1
return 0
fi
if [[ $1 == autoheader ]] ; then
_filedir '@(ac|in)'
else
_filedir -d
fi
} &&
complete -F _autoreconf autoreconf autoheader
have autoscan || have autoupdate &&
_autoscan()
{
COMPREPLY=()
local cur prev split=false
_get_comp_words_by_ref cur prev
_split_longopt && split=true
case "$prev" in
--help|-h|--version|-V)
return 0
;;
--prepend-include|-B|--include|-I)
_filedir -d
return 0
;;
esac
$split && return 0
if [[ "$cur" == -* ]]; then
_longopt $1
return 0
fi
if [[ $1 == autoupdate ]] ; then
_filedir '@(ac|in)'
else
_filedir -d
fi
} &&
complete -F _autoscan autoscan autoupdate
# 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

80
completions/automake Normal file
View File

@ -0,0 +1,80 @@
# Completions for automake tools
have automake &&
_automake()
{
COMPREPLY=()
local cur prev split=false
_get_comp_words_by_ref cur prev
_split_longopt && split=true
case "$prev" in
--help|--version)
return 0
;;
--warnings|-W)
local cats=( gnu obsolete override portability syntax unsupported )
COMPREPLY=( $( compgen -W \
'${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) )
return 0
;;
--libdir)
_filedir -d
return 0
;;
esac
$split && return 0
if [[ "$cur" == -* ]]; then
_longopt $1
return
fi
_filedir
} &&
complete -F _automake automake automake-1.11
have aclocal &&
_aclocal()
{
COMPREPLY=()
local cur prev split=false
_get_comp_words_by_ref cur prev
_split_longopt && split=true
case "$prev" in
--help|--print-ac-dir|--version)
return 0
;;
--acdir|-I)
_filedir -d
return 0
;;
--output)
_filedir
return 0
;;
--warnings|-W)
local cats=( syntax unsupported )
COMPREPLY=( $( compgen -W \
'${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) )
return 0
;;
esac
$split && return 0
_longopt $1
} &&
complete -F _aclocal aclocal aclocal-1.11
# 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

@ -85,10 +85,9 @@ _complete()
;;
-A)
COMPREPLY=( $( compgen -W 'alias arrayvar binding \
builtin command directory disabled enabled \
export file function group helptopic hostname \
job keyword running service setopt shopt \
COMPREPLY=( $( compgen -W 'alias arrayvar binding builtin command \
directory disabled enabled export file function group \
helptopic hostname job keyword running service setopt shopt \
signal stopped user variable' -- "$cur" ) )
return 0
;;
@ -111,13 +110,14 @@ _complete()
if [[ "$cur" == -* ]]; then
# relevant options completion
COMPREPLY=( $( compgen -W '-a -b -c -d -e -f -g -j -k -o -s -v -u -A \
-G -W -P -S -X -F -C' -- "$cur" ) )
local opts="-a -b -c -d -e -f -g -j -k -o -s -u -v -A -G -W -P -S -X"
[[ $1 != compgen ]] && opts="$opts -F -C"
COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) )
else
COMPREPLY=( $( compgen -A command -- "$cur" ) )
fi
}
complete -F _complete complete
complete -F _complete compgen complete
# Local variables:
# mode: shell-script

View File

@ -21,7 +21,7 @@ _bzip2()
return 0
fi
local IFS=$'\t\n'
local IFS=$'\n'
xspec="*.bz2"
if [[ "$prev" == --* ]]; then
@ -36,10 +36,11 @@ _bzip2()
_expand || return 0
_compopt_o_filenames
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) )
} &&
complete -F _bzip2 -o filenames bzip2 pbzip2
complete -F _bzip2 bzip2 pbzip2
# Local variables:
# mode: shell-script

View File

@ -10,7 +10,7 @@ _configure()
_split_longopt && split=true
case $prev in
--prefix|--exec-prefix|--*dir)
--*prefix|--*dir)
_filedir -d
;;
esac
@ -33,7 +33,7 @@ _configure()
-- "$cur" ) )
fi
}
complete -F _configure -o filenames configure
complete -F _configure configure
# Local variables:
# mode: shell-script

View File

@ -41,13 +41,13 @@ _chown()
_count_args :
if [[ $args == 1 ]]; then
_usergroup
_usergroup -u
else
_filedir
fi
fi
} &&
complete -F _chown -o filenames chown
complete -F _chown chown
# chgrp(1) completion
@ -84,15 +84,14 @@ _chgrp()
# 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 ) )
_allowed_groups
else
_filedir || return 0
fi
return 0
} &&
complete -F _chgrp -o filenames chgrp
complete -F _chgrp chgrp
# id(1) completion
#

View File

@ -30,6 +30,7 @@ _cpio()
return 0
;;
--rsh-command)
_compopt_o_filenames
COMPREPLY=( $( compgen -c -- "$cur" ) )
return 0
;;
@ -90,7 +91,7 @@ _cpio()
esac
fi
}
complete -F _cpio -o filenames cpio
complete -F _cpio cpio
}
# Local variables:

60
completions/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)
_allowed_users
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 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

@ -10,7 +10,7 @@ _cancel()
COMPREPLY=( $( compgen -W "$( lpstat | cut -d' ' -f1 )" -- "$cur" ) )
} &&
complete -F _cancel -o filenames cancel
complete -F _cancel cancel
# Local variables:
# mode: shell-script

View File

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

View File

@ -9,26 +9,26 @@ _dd()
_get_comp_words_by_ref -n = cur
case $cur in
if=*|of=*)
cur=${cur#*=}
_filedir
return 0
;;
conv=*)
cur=${cur#*=}
COMPREPLY=( $( compgen -W 'ascii ebcdic ibm block unblock \
lcase notrunc ucase swab noerror sync' -- "$cur" ) )
return 0
;;
if=*|of=*)
cur=${cur#*=}
_filedir
return 0
;;
conv=*)
cur=${cur#*=}
COMPREPLY=( $( compgen -W 'ascii ebcdic ibm block unblock lcase
notrunc ucase swab noerror sync' -- "$cur" ) )
return 0
;;
esac
_expand || return 0
COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) \
$( compgen -W 'bs cbs conv count ibs if obs of seek skip'\
-S '=' -- "$cur" ) )
$( compgen -W 'bs cbs conv count ibs if obs of seek skip' \
-S '=' -- "$cur" ) )
} &&
complete -F _dd -o nospace -o filenames dd
complete -F _dd -o nospace dd
# Local variables:
# mode: shell-script

View File

@ -92,7 +92,7 @@ _dpkg()
}
complete -F _dpkg -o filenames dpkg dpkg-deb
complete -F _dpkg dpkg dpkg-deb
}
# Debian GNU dpkg-reconfigure(8) completion

View File

@ -27,10 +27,9 @@ _dselect()
remove quit' -- "$cur" ) )
fi
return 0
} &&
complete -F _dselect -o filenames dselect
complete -F _dselect dselect
# Local variables:
# mode: shell-script

47
completions/dvd+rw-tools Normal file
View File

@ -0,0 +1,47 @@
# dvd+rw-tools completions
have growisofs &&
_growisofs()
{
COMPREPLY=()
local cur prev
_get_comp_words_by_ref cur prev
case $prev in
-version|-speed)
return 0
;;
-Z|-M)
compopt -o nospace &>/dev/null
_dvd_devices
return 0
;;
/?(r)dev/*)
if [[ $cur == =* ]] ; then
# e.g. /dev/dvd=foo.iso, /dev/dvdrw=/dev/zero
cur="${cur#=}"
_filedir
return 0
fi
;;
esac
if [[ "$cur" == -* ]]; then
# TODO: mkisofs options
COMPREPLY=( $( compgen -W '-dvd-compat -overburn -speed= -Z -M' \
-- "$cur" ) )
[[ ${COMPREPLY[@]} == *= ]] && compopt -o nospace &>/dev/null
return 0
fi
_filedir
} &&
complete -F _growisofs growisofs
# 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

180
completions/e2fsprogs Normal file
View File

@ -0,0 +1,180 @@
# bash completion for e2fsprogs
have badblocks &&
_badblocks()
{
COMPREPLY=()
local cur prev
_get_comp_words_by_ref cur prev
case $prev in
-b|-c|-e|-d|-p|-t)
return 0
;;
-i|-o)
_filedir
return 0
;;
esac
if [[ "$cur" == -* ]]; then
# -w (dangerous) and -X (internal use) not here on purpose
COMPREPLY=( $( compgen -W '-b -c -e -d -f -i -n -o -p -s -t -v' \
-- "$cur" ) )
return 0
fi
cur=${cur:=/dev/}
_filedir
} &&
complete -F _badblocks badblocks
have dumpe2fs &&
_dumpe2fs()
{
COMPREPLY=()
local cur prev
_get_comp_words_by_ref cur prev
case $prev in
-o|-V)
return 0
;;
-i)
_filedir
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-b -o -f -h -i -x -V' -- "$cur" ) )
return 0
fi
cur=${cur:=/dev/}
_filedir
} &&
complete -F _dumpe2fs dumpe2fs
have e2freefrag &&
_e2freefrag()
{
COMPREPLY=()
local cur prev
_get_comp_words_by_ref cur prev
case $prev in
-c|-h)
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-c -h' -- "$cur" ) )
return 0
fi
cur=${cur:=/dev/}
_filedir
} &&
complete -F _e2freefrag e2freefrag
have e2label &&
_e2label()
{
COMPREPLY=()
local cur cword
_get_comp_words_by_ref cur cword
if [ $cword -eq 1 ]; then
cur=${cur:=/dev/}
_filedir
fi
} &&
complete -F _e2label e2label
have filefrag &&
_filefrag()
{
COMPREPLY=()
local cur
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-B -b -s -v -x' -- "$cur" ) )
return 0
fi
_filedir
} &&
complete -F _filefrag filefrag
have tune2fs &&
_tune2fs()
{
COMPREPLY=()
local cur prev
_get_comp_words_by_ref cur prev
case $prev in
-c|-C|-E|-i|-J|-L|-m|-r|-T)
return 0
;;
-e)
COMPREPLY=( $( compgen -W 'continue remount-ro panic' -- "$cur" ) )
return 0
;;
-g)
_gids
COMPREPLY=( $( compgen -g -W '${COMPREPLY[@]}' -- "$cur" ) )
return 0
;;
-M)
_filedir -d
;;
-o)
local -a opts=(^debug ^bsdgroups ^user_xattr ^acl ^uid16
^journal_data ^journal_data_ordered ^journal_data_writeback)
COMPREPLY=( $( compgen -W '${opts[@]} ${opts[@]#^}' -- "$cur" ) )
return 0
;;
-O)
local -a opts=(^dir_index ^dir_nlink ^extent ^extra_isize ^filetype
^flex_bg ^has_journal ^huge_file ^large_file ^resize_inode
^sparse_super ^uninit_bg)
COMPREPLY=( $( compgen -W '${opts[@]} ${opts[@]#^}' -- "$cur" ) )
return 0
;;
-u)
_uids
COMPREPLY=( $( compgen -u -W '${COMPREPLY[@]}' -- "$cur" ) )
return 0
;;
-U)
COMPREPLY=( $( compgen -W 'clear random time' -- "$cur" ) )
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-c -C -e -E -f -g -i -j -J -l -L -m -M -o
-O -r -T -u -U' -- "$cur" ) )
fi
cur=${cur:=/dev/}
_filedir
} &&
complete -F _tune2fs tune2fs
# 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

@ -117,7 +117,7 @@ _find()
return 0
} &&
complete -F _find -o filenames find
complete -F _find find
# Local variables:
# mode: shell-script

47
completions/freerdp Normal file
View File

@ -0,0 +1,47 @@
# bash completion for xfreerdp
have xfreerdp &&
_xfreerdp()
{
local cur prev
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in
-k)
COMPREPLY=( $( compgen -W "$(xfreerdp --kbd-list | \
awk '/^0x/ {print $1}')" -- "$cur" ) )
return 0
;;
-a)
COMPREPLY=( $( compgen -W '8 15 16 24 32' -- "$cur" ) )
return 0
;;
-x)
COMPREPLY=( $( compgen -W 'b broadband m modem l lan' -- $cur ) )
return 0
;;
--plugin)
COMPREPLY=( $( compgen -W 'cliprdr rdpsnd rdpdr' -- "$cur" ) )
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-u -d -s -c -p -n -t -g -a -z -f -x -O -o \
-k --kbd-list -h --plugin --data' -- "$cur" ) )
else
_known_hosts_real "$cur"
fi
} &&
complete -F _xfreerdp xfreerdp
# 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

@ -25,7 +25,7 @@ _fusermount()
_filedir -d
fi
} &&
complete -F _fusermount -o filenames fusermount
complete -F _fusermount fusermount
# Local variables:
# mode: shell-script

View File

@ -46,9 +46,9 @@ _gcc()
_filedir
fi
} &&
complete -o filenames -F _gcc gcc g++ c++ g77 gcj gpc
complete -F _gcc gcc g++ c++ g77 gcj gpc
[ $USERLAND = GNU -o $UNAME = Cygwin ] && \
[ -n "${have:-}" ] && complete -o filenames -F _gcc cc
[ -n "${have:-}" ] && complete -F _gcc cc
# Local variables:
# mode: shell-script

View File

@ -10,6 +10,7 @@ _gdb()
if [ $COMP_CWORD -eq 1 ]; then
local IFS
_compopt_o_filenames
if [[ "$cur" == */* ]]; then
# compgen -c works as expected if $cur contains any slashes.
IFS=$'\n'

View File

@ -66,7 +66,7 @@ _mkisofs()
fi
} &&
complete -F _mkisofs -o filenames mkisofs genisoimage
complete -F _mkisofs mkisofs genisoimage
# Local variables:
# mode: shell-script

View File

@ -43,7 +43,7 @@ _gkrellm()
fi
} &&
complete -F _gkrellm -o filenames gkrellm gkrellm2
complete -F _gkrellm gkrellm gkrellm2
# Local variables:
# mode: shell-script

View File

@ -26,7 +26,7 @@ _gnatmake()
_filedir '@(adb|ads)'
fi
} &&
complete -F _gnatmake -o filenames gnatmake
complete -F _gnatmake gnatmake
# Local variables:
# mode: shell-script

View File

@ -21,7 +21,7 @@ _gzip()
return 0
fi
local IFS=$'\t\n'
local IFS=$'\n'
xspec="*.@(gz|t[ag]z)"
if [[ "$prev" == --* ]]; then
@ -40,10 +40,11 @@ _gzip()
_expand || return 0
_compopt_o_filenames
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) )
} &&
complete -F _gzip -o filenames gzip pigz
complete -F _gzip gzip pigz
# Local variables:
# mode: shell-script

View File

@ -0,0 +1,3 @@
helpers_SCRIPTS = perl
EXTRA_DIST = $(helpers_SCRIPTS)

88
completions/helpers/perl Executable file
View File

@ -0,0 +1,88 @@
#!/usr/bin/env perl
use strict;
use Config;
use File::Spec::Functions;
my %seen;
sub print_modules_real {
my ($base, $dir, $word) = @_;
# return immediatly if potential completion doesn't match current word
# a double comparaison is used to avoid dealing with string lengths
# (the shorter being the pattern to be used as the regexp)
# word 'Fi', base 'File' -> match 'File' against 'Fi'
# word 'File::Sp', base 'File' -> match 'File::Sp' againt 'File'
return if
$base &&
$word &&
$base !~ /^\Q$word/ &&
$word !~ /^\Q$base/;
chdir($dir) or return;
# print each file
foreach my $file (glob('*.pm')) {
$file =~ s/\.pm$//;
my $module = $base . $file;
next if $module !~ /^\Q$word/;
next if $seen{$module}++;
print $module . "\n";
}
# recurse in each subdirectory
foreach my $directory (grep { -d } glob('*')) {
my $subdir = $dir . '/' . $directory;
if ($directory =~ /^(?:[.\d]+|$Config{archname}|auto)$/) {
# exclude subdirectory name from base
print_modules_real(undef, $subdir, $word);
} else {
# add subdirectory name to base
print_modules_real($base . $directory . '::', $subdir, $word);
}
}
}
sub print_modules {
my ($word) = @_;
foreach my $directory (@INC) {
print_modules_real(undef, $directory, $word);
}
}
sub print_functions {
my ($word) = @_;
my $perlfunc;
for ( @INC, undef ) {
return if not defined;
$perlfunc = catfile $_, qw( pod perlfunc.pod );
last if -r $perlfunc;
}
open my $fh, '<', $perlfunc or return;
my $nest_level = -1;
while ( <$fh> ) {
next if 1 .. /^=head2 Alphabetical Listing of Perl Functions$/;
++$nest_level if /^=over/;
--$nest_level if /^=back/;
next if $nest_level;
next unless /^=item (-?\w+)/;
my $function = $1;
next if $function !~ /^\Q$word/;
next if $seen{$function}++;
print $function . "\n";
}
}
my $type = shift;
my $word = shift;
if ($type eq 'functions') {
print_functions($word);
} elsif ($type eq 'modules') {
print_modules($word);
}

View File

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

View File

@ -36,8 +36,6 @@ _iconv()
fi
} &&
complete -F _iconv -o default iconv
# Intentionally not -o filenames here, -f/-t completions may contain slashes
# and -o filenames would break them.
# Local variables:
# mode: shell-script

35
completions/iftop Normal file
View File

@ -0,0 +1,35 @@
# iftop(8) completion
have iftop &&
_iftop()
{
COMPREPLY=()
local cur prev
_get_comp_words_by_ref cur prev
case $prev in
-h|-f|-F|-m)
return 0
;;
-i)
_available_interfaces -a
return 0
;;
-c)
_filedir
return 0
;;
esac
COMPREPLY=( $( compgen -W '-h -n -N -p -P -b -B -i -f -F -c -m' \
-- "$cur" ) )
} &&
complete -F _iftop iftop
# 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

@ -189,7 +189,7 @@ _convert()
_filedir
fi
}
complete -F _convert -o filenames convert
complete -F _convert convert
_mogrify()
{
@ -245,7 +245,7 @@ _mogrify()
_filedir
fi
}
complete -F _mogrify -o filenames mogrify
complete -F _mogrify mogrify
_display()
{
@ -285,7 +285,7 @@ _display()
_filedir
fi
}
complete -F _display -o filenames display
complete -F _display display
_animate()
{
@ -319,7 +319,7 @@ _animate()
_filedir
fi
}
complete -F _animate -o filenames animate
complete -F _animate animate
_identify()
{
@ -344,7 +344,7 @@ _identify()
_filedir
fi
}
complete -F _identify -o filenames identify
complete -F _identify identify
_montage()
{
@ -382,7 +382,7 @@ _montage()
_filedir
fi
}
complete -F _montage -o filenames montage
complete -F _montage montage
_composite()
{
@ -417,7 +417,7 @@ _composite()
_filedir
fi
}
complete -F _composite -o filenames composite
complete -F _composite composite
_compare()
{
@ -444,7 +444,7 @@ _compare()
_filedir
fi
}
complete -F _compare -o filenames compare
complete -F _compare compare
_conjure()
{
@ -464,7 +464,7 @@ _conjure()
_filedir
fi
}
complete -F _conjure -o filenames conjure
complete -F _conjure conjure
_import()
{
@ -495,7 +495,7 @@ _import()
_filedir
fi
}
complete -F _import -o filenames import
complete -F _import import
_stream()
{
@ -520,7 +520,7 @@ _stream()
_filedir
fi
}
complete -F _stream -o filenames stream
complete -F _stream stream
}
# Local variables:

View File

@ -47,7 +47,7 @@ _info()
return 0
} &&
complete -F _info -o filenames info
complete -F _info info
# Local variables:
# mode: shell-script

214
completions/ipmitool Normal file
View File

@ -0,0 +1,214 @@
# bash completion for ipmitool
have ipmitool && {
_ipmitool_singleline_help()
{
COMPREPLY=( $( compgen -W "$( $1 $2 2>&1 | \
sed -ne 's/[,\r]//g' -e 's/^.*[Cc]ommands://p' )" -- "$cur" ) )
}
_ipmitool()
{
local cur prev
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in
-h|-V|-p|-U|-e|-k|-y|-P|-m|-b|-t|-B|-T|-l)
return 0
;;
-d)
COMPREPLY=( $( compgen -W "$( \
command ls -d /dev/ipmi* /dev/ipmi/* /dev/ipmidev/* \
2>/dev/null | sed -ne 's/^[^0-9]*\([0-9]\{1,\}\)/\1/p' )" \
-- "$cur" ) )
return 0
;;
-I)
COMPREPLY=( $( compgen -W "$( $1 -h 2>&1 | \
sed -e '/^Interfaces:/,/^[[:space:]]*$/!d' \
-ne 's/^[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*/\1/p' )" \
-- "$cur" ) )
return 0
;;
-H)
_known_hosts_real "$cur"
return 0
;;
-f|-S|-O)
_filedir
return 0
;;
-C)
COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9 10 11 12 13 14' \
-- "$cur" ) )
return 0
;;
-L)
COMPREPLY=( $( compgen -W 'CALLBACK USER OPERATOR ADMINISTRATOR' \
-- "$cur" ) )
return 0
;;
-A)
COMPREPLY=( $( compgen -W 'NONE PASSWORD MD2 MD5 OEM' -- "$cur" ) )
return 0
;;
-o)
COMPREPLY=( $( compgen -W "$( $1 -o list 2>&1 | \
awk '/^[ \t]+/ { print $1 }' ) list" -- "$cur" ) )
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-h -V -v -c -d -I -H -p -U -f -S -a \
-e -C -k -y -L -A -P -E -K -m -b -t -B -T -l -o -O' -- "$cur" ) )
return 0
fi
# Find out command and subcommand
local cmds=( raw i2c spd lan chassis power event mc sdr sensor fru gendev
sel pef sol tsol isol user channel session sunoem kontronoem picmg fwum
firewall shell exec set hpm ekanalyzer)
local i c cmd subcmd
for (( i=1; i < ${#COMP_WORDS[@]}-1; i++ )); do
[[ -n $cmd ]] && subcmd=${COMP_WORDS[i]} && break
for c in ${cmds[@]}; do
[ ${COMP_WORDS[i]} = $c ] && cmd=$c && break
done
done
if [ -z "$cmd" ]; then
COMPREPLY=( $( compgen -W '${cmds[@]}' -- "$cur" ) )
return 0
fi
# Command/subcommand completions
case $cmd in
shell)
;;
exec)
_filedir
;;
chassis|power|kontronoem|fwum)
_ipmitool_singleline_help $1 $cmd
;;
lan)
case $subcmd in
print|set)
;;
alert)
[ "$prev" = alert ] && \
COMPREPLY=( $( compgen -W 'print set' -- "$cur" ) )
;;
stats)
[ "$prev" = stats ] && \
COMPREPLY=( $( compgen -W 'print set' -- "$cur" ) )
;;
*)
COMPREPLY=( $( compgen -W 'print set alert stats' \
-- "$cur" ) )
;;
esac
;;
sdr)
case $subcmd in
get|info|type|list|entity)
;;
elist)
COMPREPLY=( $( compgen -W 'all full compact event mclog fru
generic' -- "$cur" ) )
;;
dump)
_filedir
;;
fill)
case $prev in
fill)
COMPREPLY=( $( compgen -W 'sensors file' \
-- "$cur" ) )
;;
file)
_filedir
;;
esac
;;
*)
COMPREPLY=( $( compgen -W 'get info type list elist entity
dump fill' -- "$cur" ) )
;;
esac
;;
sensor)
case $subcmd in
list|get|thresh)
;;
*)
COMPREPLY=( $( compgen -W 'list get thresh' -- "$cur" ) )
;;
esac
;;
sel)
case $subcmd in
info|clear|list|elist|delete)
;;
add|save|writeraw|readraw)
_filedir
;;
time)
[ "$prev" = time ] && \
COMPREPLY=( $( compgen -W 'get set' -- "$cur" ) )
;;
*)
COMPREPLY=( $( compgen -W 'info clear list elist delete add
get save writeraw readraw time' -- "$cur" ) )
;;
esac
;;
user)
case $subcmd in
summary|list|disable|enable|priv|test)
;;
set)
[ "$prev" = set ] && \
COMPREPLY=( $( compgen -W 'name password' -- "$cur" ) )
;;
*)
COMPREPLY=( $( compgen -W 'summary list set disable enable
priv test' -- "$cur" ) )
;;
esac
;;
set)
[ "$prev" = set ] && \
COMPREPLY=( $( compgen -W 'hostname username password privlvl
authtype localaddr targetaddr port csv verbose' \
-- "$cur" ) )
;;
esac
}
} &&
complete -F _ipmitool ipmitool
# 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

285
completions/iproute2 Normal file
View File

@ -0,0 +1,285 @@
# iproute2 tools completion
have ip &&
_ip()
{
COMPREPLY=()
local cur prev words cword
_get_comp_words_by_ref cur prev words cword
case $prev in
-V|-Version|-rc|-rcvbuf)
return 0
;;
-f|-family)
COMPREPLY=( $( compgen -W 'inet inet6 ipx dnet link' -- "$cur" ) )
return 0
;;
-b|-batch)
_filedir
return 0
;;
-force)
COMPREPLY=( $( compgen -W '-batch' -- "$cur" ) )
return 0
;;
esac
local subcword cmd subcmd
for (( subcword=1; subcword < ${#words[@]}-1; subcword++ )); do
[[ ${words[subcword]} == -b?(atch) ]] && return 0
[[ -n $cmd ]] && subcmd=${words[subcword]} && break
[[ ${words[subcword]} != -* && \
${words[subcword-1]} != -@(f?(amily)|rc?(vbuf)) ]] && \
cmd=${words[subcword]}
done
if [[ -z $cmd ]]; then
case $cur in
-*)
local c="-Version -statistics -details -resolve -family
-oneline -timestamp -batch -rcvbuf"
[[ $cword -eq 1 ]] && c="$c -force"
COMPREPLY=( $( compgen -W "$c" -- "$cur" ) )
return 0
;;
*)
COMPREPLY=( $( compgen -W "help $( ip help 2>&1 | \
sed -e '/OBJECT := /,/}/!d' \
-e 's/.*{//' -e 's/}.*//' -e 's/|//g' )" -- "$cur" ) )
return 0
;;
esac
fi
[[ $subcmd == help ]] && return 0
case $cmd in
link)
case $subcmd in
add)
# TODO
;;
delete)
case $(($cword-$subcword)) in
1)
_available_interfaces
;;
2)
COMPREPLY=( $( compgen -W 'type' -- "$cur" ) )
;;
3)
[[ $prev == type ]] && \
COMPREPLY=( $( compgen -W 'vlan veth vcan dummy
ifb macvlan can' -- "$cur" ) )
;;
esac
;;
set)
if [[ $cword-$subcword -eq 1 ]]; then
_available_interfaces
else
case $prev in
arp|dynamic|multicast|allmulticast|promisc|\
trailers)
COMPREPLY=( $( compgen -W 'on off' \
-- "$cur" ) )
;;
txqueuelen|name|address|broadcast|mtu|netns|alias)
;;
*)
local c="arp dynamic multicast allmulticast
promisc trailers txqueuelen name address
broadcast mtu netns alias"
[[ $prev != @(up|down) ]] && c="$c up down"
COMPREPLY=( $( compgen -W "$c" -- "$cur" ) )
;;
esac
fi
;;
show)
[[ $cword -eq $subcword+1 ]] && _available_interfaces
;;
*)
[[ $cword -eq $subcword ]] && \
COMPREPLY=( $( compgen -W 'help add delete set show' \
-- "$cur" ) )
;;
esac
;;
addr)
case $subcmd in
add|change|replace)
# TODO
;;
del)
# TODO
;;
show|flush)
# TODO
;;
*)
[[ $cword -eq $subcword ]] && \
COMPREPLY=( $( compgen -W 'help add change replace del
show flush' -- "$cur" ) )
;;
esac
;;
addrlabel)
case $subcmd in
list|add|del|flush)
# TODO
;;
*)
[[ $cword -eq $subcword ]] && \
COMPREPLY=( $( compgen -W 'help list add del flush' \
-- "$cur" ) )
;;
esac
;;
route)
case $subcmd in
list|flush)
# TODO
;;
get)
# TODO
;;
add|del|change|append|replace|monitor)
# TODO
;;
*)
[[ $cword -eq $subcword ]] && \
COMPREPLY=( $( compgen -W 'help list flush get add del
change append replace monitor' -- "$cur" ) )
;;
esac
;;
rule)
case $subcmd in
list|add|del|flush)
# TODO
;;
*)
[[ $cword -eq $subcword ]] && \
COMPREPLY=( $( compgen -W 'help list add del flush' \
-- "$cur" ) )
;;
esac
;;
neigh)
case $subcmd in
add|del|change|replace)
# TODO
;;
show|flush)
# TODO
;;
*)
[[ $cword -eq $subcword ]] && \
COMPREPLY=( $( compgen -W 'help add del change replace
show flush' -- "$cur" ) )
;;
esac
;;
ntable)
case $subcmd in
change)
# TODO
;;
show)
# TODO
;;
*)
[[ $cword -eq $subcword ]] && \
COMPREPLY=( $( compgen -W 'help change show' \
-- "$cur" ) )
;;
esac
;;
tunnel)
case $subcmd in
add|change|del|show|prl|6rd)
# TODO
;;
*)
[[ $cword -eq $subcword ]] && \
COMPREPLY=( $( compgen -W 'help add change del show prl
6rd' -- "$cur" ) )
;;
esac
;;
maddr)
case $subcmd in
add|del)
# TODO
;;
show)
if [[ $cword -eq $subcword+1 || $prev == dev ]]; then
_available_interfaces
[[ $prev != dev ]] && \
COMPREPLY=( $( compgen -W '${COMPREPLY[@]} dev' \
-- "$cur" ) )
fi
;;
*)
[[ $cword -eq $subcword ]] && \
COMPREPLY=( $( compgen -W 'help add del show' \
-- "$cur" ) )
;;
esac
;;
mroute)
case $subcmd in
show)
# TODO
;;
*)
[[ $cword -eq $subcword ]] && \
COMPREPLY=( $( compgen -W 'help show' -- "$cur" ) )
;;
esac
;;
monitor)
case $subcmd in
all) ;;
*)
[[ $cword -eq $subcword ]] && \
COMPREPLY=( $( compgen -W 'help all' -- "$cur" ) )
;;
esac
;;
xfrm)
case $subcmd in
state|policy|monitor)
# TODO
;;
*)
[[ $cword -eq $subcword ]] && \
COMPREPLY=( $( compgen -W 'state policy monitor' \
-- "$cur" ) )
;;
esac
;;
esac
} &&
complete -F _ip ip
# 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

@ -46,7 +46,7 @@ _ipv6calc()
return 0
} &&
complete -F _ipv6calc -o filenames ipv6calc
complete -F _ipv6calc ipv6calc
# Local variables:
# mode: shell-script

View File

@ -18,14 +18,14 @@ _jar()
_filedir
;;
*f)
_filedir '?([ejw]ar|zip|[EJW]AR|ZIP)'
_filedir '@([ejw]ar|zip|apk)'
;;
*)
_filedir
;;
esac
} &&
complete -F _jar -o filenames jar
complete -F _jar jar
# Local variables:
# mode: shell-script

View File

@ -118,13 +118,13 @@ _java_packages()
#
_java()
{
local cur prev i
local cur prev words cword i
COMPREPLY=()
_get_comp_words_by_ref cur prev
_get_comp_words_by_ref -n : cur prev words cword
for ((i=1; i < $COMP_CWORD; i++)); do
case ${COMP_WORDS[$i]} in
for ((i=1; i < $cword; i++)); do
case ${words[$i]} in
-cp|-classpath)
((i++)) # skip the classpath string.
;;
@ -139,6 +139,70 @@ _java()
esac
done
case $cur in
# standard option completions
-verbose:*)
COMPREPLY=( $( compgen -W 'class gc jni' -- "${cur#*:}" ) )
return 0
;;
-javaagent:*)
cur=${cur#*:}
_filedir '@(jar|zip)'
return 0
;;
-agentpath:*)
cur=${cur#*:}
_filedir so
return 0
;;
# various non-standard option completions
-splash:*)
cur=${cur#*:}
_filedir '@(gif|jp?(e)g|png)'
return 0
;;
-Xbootclasspath*:*)
_java_path
return 0
;;
-Xcheck:*)
COMPREPLY=( $( compgen -W 'jni' -- "${cur#*:}" ) )
return 0
;;
-Xgc:*)
COMPREPLY=( $( compgen -W 'singlecon gencon singlepar genpar' \
-- "${cur#*:}" ) )
return 0
;;
-Xgcprio:*)
COMPREPLY=( $( compgen -W 'throughput pausetime deterministic' \
-- "${cur#*:}" ) )
return 0
;;
-Xloggc:*|-Xverboselog:*)
cur=${cur#*:}
_filedir
return 0
;;
-Xshare:*)
COMPREPLY=( $( compgen -W 'auto off on' -- "${cur#*:}" ) )
return 0
;;
-Xverbose:*)
COMPREPLY=( $( compgen -W 'memory load jni cpuinfo codegen opt
gcpause gcreport' -- "${cur#*:}" ) )
return 0
;;
-Xverify:*)
COMPREPLY=( $( compgen -W 'all none remote' -- "${cur#*:}" ) )
return 0
;;
# the rest that we have no completions for
-D*|-*:*)
return 0
;;
esac
case $prev in
-cp|-classpath)
_java_path
@ -147,13 +211,11 @@ _java()
esac
if [[ "$cur" == -* ]]; then
# relevant options completion
COMPREPLY=( $( compgen -W '-client -hotspot -server -classic \
-classpath -D -verbose -verbose:class \
-verbose:gc -version:jni -version \
-showversion -help -X -jar \
-enableassertions -disableassertions \
-enablesystemassertions -disablesystemassertions ' -- "$cur" ) )
# standard options
COMPREPLY=( $( compgen -W '-client -server -agentlib: -agentpath:
-classpath -D -d32 -d64 -enableassertions -disableassertions
-enablesystemassertions -disablesystemassertions -jar -javaagent:
-verbose -verbose -version -showversion -help -X' -- "$cur" ) )
else
if [[ "$prev" == -jar ]]; then
# jar file completion
@ -163,8 +225,13 @@ _java()
_java_classes
fi
fi
[[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} == -*[:=] ]] && \
type compopt &>/dev/null && compopt -o nospace
__ltrim_colon_completions "$cur"
}
complete -F _java -o filenames java
complete -F _java java
}
have javadoc &&
@ -176,11 +243,16 @@ _javadoc()
_get_comp_words_by_ref cur prev
case $prev in
-overview|-helpfile|-stylesheetfile)
_filedir
-overview|-helpfile)
_filedir '?(x)htm?(l)'
return 0
;;
-d)
-stylesheetfile)
_filedir css
return 0
;;
-d|-link|-linkoffline)
# TODO: -linkoffline takes two arguments
_filedir -d
return 0
;;
@ -212,7 +284,7 @@ _javadoc()
_java_packages
fi
} &&
complete -F _javadoc -o filenames javadoc
complete -F _javadoc javadoc
have javac &&
_javac()
@ -244,7 +316,7 @@ _javac()
_filedir java
fi
} &&
complete -F _javac -o filenames javac
complete -F _javac javac
have pack200 &&
_pack200()
@ -413,7 +485,7 @@ _jarsigner()
_filedir jar
fi
} &&
complete -F _jarsigner -o filenames jarsigner
complete -F _jarsigner jarsigner
# Local variables:
# mode: shell-script

View File

@ -44,7 +44,7 @@ _k3b()
_filedir
fi
} &&
complete -F _k3b -o filenames k3b
complete -F _k3b k3b
# Local variables:
# mode: shell-script

View File

@ -11,13 +11,14 @@ _kldload()
[ -d $moddir ] || moddir=/boot/kernel/
_get_comp_words_by_ref cur
_compopt_o_filenames
COMPREPLY=( $( compgen -f "$moddir$cur" ) )
COMPREPLY=( ${COMPREPLY[@]#$moddir} )
COMPREPLY=( ${COMPREPLY[@]%.ko} )
return 0
}
complete -F _kldload -o filenames kldload
complete -F _kldload kldload
_kldunload()
{
@ -26,7 +27,7 @@ _kldunload()
COMPREPLY=( $( kldstat | \
sed -ne "s/^.*[ \t]\{1,\}\($cur[a-z_]\{1,\}\).ko$/\1/p" ) )
}
complete -F _kldunload -o filenames kldunload
complete -F _kldunload kldunload
}

View File

@ -28,7 +28,8 @@ _lftp()
'$( cut -f 1 -s ~/.lftp/bookmarks 2>/dev/null )' -- "$cur" ) )
_known_hosts_real "$cur"
} &&
complete -F _lftp -o filenames lftp
complete -F _lftp lftp
have lftpget &&
_lftpget()
{

View File

@ -32,7 +32,7 @@ _links()
return 0
} &&
complete -F _links -o filenames links
complete -F _links links
# Local variables:
# mode: shell-script

View File

@ -181,6 +181,6 @@ _lintian_info() {
return 0
}
complete -F _lintian -o filenames lintian
complete -F _lintian_info -o filenames lintian-info
complete -F _lintian lintian
complete -F _lintian_info lintian-info
}

64
completions/lrzip Normal file
View File

@ -0,0 +1,64 @@
# 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=$'\n'
_compopt_o_filenames
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) )
} &&
complete -F _lrzip 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

64
completions/lsof Normal file
View File

@ -0,0 +1,64 @@
# lsof(8) completion
have lsof &&
_lsof()
{
COMPREPLY=()
local cur prev
_get_comp_words_by_ref cur prev
case $prev in
-'?'|-h|+c|-c|-d|-F|-i|+r|-r|-s|-S|-T)
return 0
;;
-A|-k|-m|+m|-o)
_filedir
return 0
;;
+d|+D)
_filedir -d
return 0
;;
-D)
COMPREPLY=( $( compgen -W '? b i r u' -- "$cur" ) )
return 0
;;
-f)
COMPREPLY=( $( compgen -W 'c f g G n' -- "$cur" ) )
return 0
;;
-g)
# TODO: handle ^foo exclusions, comma separated lists
_pgids
return 0
;;
-p)
# TODO: handle ^foo exclusions, comma separated lists
_pids
return 0
;;
-u)
# TODO: handle ^foo exclusions, comma separated lists
COMPREPLY=( $( compgen -u -- "$cur" ) )
return 0
;;
esac
if [[ "$cur" == [-+]* ]]; then
COMPREPLY=( $( compgen -W '-h -a -A -b -c +c -C +d -d +D -D +f -f -F -g
-i -k -l +L -L +m -m +M -M -n -N -o -O -p -P +r -r -R -s -S -T -t
-u -U -v -V +w -w -x -X -z -Z' -- "$cur" ) )
return 0
fi
_filedir
} &&
complete -F _lsof lsof
# 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

@ -16,7 +16,7 @@ _lzma()
return 0
fi
local IFS=$'\t\n'
local IFS=$'\n'
xspec="*.@(lzma|tlz)"
if [[ "$prev" == --* ]]; then
@ -31,10 +31,11 @@ _lzma()
_expand || return 0
_compopt_o_filenames
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) )
} &&
complete -F _lzma -o filenames lzma
complete -F _lzma lzma
# Local variables:
# mode: shell-script

View File

@ -53,11 +53,12 @@ _lzop()
_expand || return 0
local IFS=$'\t\n'
local IFS=$'\n'
_compopt_o_filenames
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) )
} &&
complete -F _lzop -o filenames lzop
complete -F _lzop lzop
# Local variables:
# mode: shell-script

View File

@ -368,7 +368,7 @@ _config_list()
fi
} &&
complete -F _config_list -o filenames config_list
complete -F _config_list config_list
# Try to detect whether this is the mailman "arch" to avoid installing
# it for the coreutils/util-linux-ng one.
@ -416,7 +416,7 @@ _arch()
fi
} &&
complete -F _arch -o filenames arch
complete -F _arch arch
have cleanarch &&
_cleanarch()
@ -460,7 +460,7 @@ _inject()
fi
} &&
complete -F _inject -o filenames inject
complete -F _inject inject
have dumpdb &&
_dumpdb()
@ -478,7 +478,7 @@ _dumpdb()
fi
} &&
complete -F _dumpdb -o filenames dumpdb
complete -F _dumpdb dumpdb
have check_db &&
_check_db()

View File

@ -67,7 +67,7 @@ _make()
fi
} &&
complete -F _make -o filenames make gmake gnumake pmake
complete -F _make make gmake gnumake pmake
# Local variables:
# mode: shell-script

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