[Bash-completion-commits] [SCM] bash-completion branch, master, updated. b3f8e617ac7569a4c6bd3f3f6e6e3bc51d61d3f4
Guillaume Rousse
guillomovitch at zarb.org
Fri May 29 07:57:28 UTC 2009
The following commit has been merged in the master branch:
commit b3f8e617ac7569a4c6bd3f3f6e6e3bc51d61d3f4
Merge: 82e0b04591986db41a0edef290c69656a6bd5879 90387f2355ae83968ab12aa32ba3b73fac152fd4
Author: Guillaume Rousse <guillomovitch at zarb.org>
Date: Fri May 29 09:56:57 2009 +0200
fix conflict
diff --combined Makefile.am
index 6cf11d2,5cf540a..0644d7a
--- a/Makefile.am
+++ b/Makefile.am
@@@ -4,7 -4,6 +4,7 @@@ sysconf_DATA = bash_completio
bashcompdir = $(sysconfdir)/bash_completion.d
bashcomp_DATA = contrib/ant \
contrib/apache2ctl \
+ contrib/aspell \
contrib/bind-utils \
contrib/bitkeeper \
contrib/bittorrent \
@@@ -17,7 -16,6 +17,7 @@@
contrib/cowsay \
contrib/cpan2dist \
contrib/cpio \
+ contrib/dcop \
contrib/dd \
contrib/dhclient \
contrib/dsniff \
@@@ -28,22 -26,18 +28,23 @@@
contrib/genisoimage \
contrib/getent \
contrib/gkrellm \
+ contrib/gpg \
contrib/gnatmake \
contrib/gpg2 \
contrib/gzip \
contrib/harbour \
contrib/heimdal \
contrib/imagemagick \
+ contrib/info \
+ contrib/iptables \
contrib/isql \
+ contrib/java \
contrib/larch \
contrib/ldapvi \
contrib/lftp \
+ contrib/lilo \
contrib/lilypond \
+ contrib/links \
contrib/lisp \
contrib/lzma \
contrib/lvm \
@@@ -67,22 -61,19 +68,23 @@@
contrib/openldap \
contrib/openssl \
contrib/p4 \
+ contrib/perl \
contrib/pkg-config \
contrib/postgresql \
contrib/postfix \
contrib/povray \
+ contrib/python \
contrib/qdbus \
contrib/qemu \
contrib/quota-tools \
contrib/rdesktop \
contrib/repomanage \
+ contrib/reportbug \
contrib/ri \
+ contrib/rcs \
contrib/rpcdebug \
contrib/rpmcheck \
+ contrib/rrdtool \
contrib/rsync \
contrib/samba \
contrib/sbcl \
@@@ -95,19 -86,14 +97,19 @@@
contrib/strace \
contrib/_subversion \
contrib/svk \
+ contrib/sysctl \
contrib/tar \
+ contrib/tcpdump \
contrib/unace \
contrib/unrar \
+ contrib/update-alternatives \
contrib/vncviewer \
contrib/wodim \
+ contrib/wvdial \
contrib/xhost \
contrib/xm \
contrib/xmllint \
+ contrib/xrandr \
contrib/yum
EXTRA_DIST = $(sysconf_DATA) $(bashcomp_DATA) to_review
diff --combined bash_completion
index cc67fae,2cd6b6e..28cb85f
--- a/bash_completion
+++ b/bash_completion
@@@ -1008,7 -1008,7 +1008,7 @@@ complete -F _insmod $filenames insmod m
-o $UNAME = OpenBSD ] &&
_man()
{
- local cur prev sect manpath manext mansect UNAME
+ local cur prev sect manpath manext mansect uname
manext="@([0-9lnp]|[0-9][px]|man)?(.@(gz|bz2|lzma))"
mansect="@([0-9lnp]|[0-9][px])"
@@@ -1030,11 -1030,8 +1030,8 @@@
return 0
fi
- UNAME=$( uname -s )
- # strip OS type and version under Cygwin
- UNAME=${UNAME/CYGWIN_*/Cygwin}
- if [ $USERLAND = GNU -o $UNAME = FreeBSD \
- -o $UNAME = Cygwin ]; then
+ uname=$( uname -s )
+ if [[ $uname == @(Linux|GNU|GNU/*|FreeBSD|Cygwin|CYGWIN_*) ]]; then
manpath=$( manpath 2>/dev/null || command man --path )
else
manpath=$MANPATH
@@@ -2610,6 -2607,101 +2607,6 @@@ _jar(
} &&
complete -F _jar $filenames jar
-# Linux iptables(8) completion
-#
-have iptables &&
-_iptables()
-{
- local cur prev table chain
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
- chain='s/^Chain \([^ ]\+\).*$/\1/p'
-
- if [[ $COMP_LINE == *-t\ *filter* ]]; then
- table="-t filter"
- elif [[ $COMP_LINE == *-t\ *nat* ]]; then
- table="-t nat"
- elif [[ $COMP_LINE == *-t\ *mangle* ]]; then
- table="-t mangle"
- fi
-
- _split_longopt
-
- case "$prev" in
- -*[AIDRPFXLZ])
- COMPREPLY=( $( compgen -W '`iptables $table -nL | \
- sed -ne "s/^Chain \([^ ]\+\).*$/\1/p"`' -- $cur ) )
- ;;
- -*t)
- COMPREPLY=( $( compgen -W 'nat filter mangle' -- $cur ) )
- ;;
- -j)
- if [ "$table" = "-t filter" -o "$table" = "" ]; then
- COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \
- `iptables $table -nL | sed -ne "$chain" \
- -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \
- $cur ) )
- elif [ "$table" = "-t nat" ]; then
- COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \
- MIRROR SNAT DNAT MASQUERADE `iptables $table -nL | \
- sed -ne "$chain" -e "s/OUTPUT|PREROUTING|POSTROUTING//"`' \
- -- $cur ) )
- elif [ "$table" = "-t mangle" ]; then
- COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \
- MARK TOS `iptables $table -nL | sed -ne "$chain" \
- -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \
- $cur ) )
- fi
- ;;
- *)
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-i -o -s -d -p -f -m --append \
- --delete --insert --replace --list --flush --zero --new \
- --delete-chain --policy --rename-chain --proto --source \
- --destination --in-interface --jump --match --numeric \
- --out-interface --table --verbose --line-numbers --exact \
- --fragment --modprobe --set-counters --version' -- "$cur") )
- fi
- ;;
- esac
-
-} &&
-complete -F _iptables iptables
-
-# tcpdump(8) completion
-#
-have tcpdump &&
-_tcpdump()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(r|w|F))
- _filedir
- return 0
- ;;
- -i)
- _available_interfaces -a
- return 0
- ;;
- esac
-
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-a -d -e -f -l -n -N -O -p \
- -q -R -S -t -u -v -x -C -F -i -m -r -s -T -w \
- -E' -- $cur ) )
- fi
-
-} &&
-complete -F _tcpdump tcpdump
-
# autorpm(8) completion
#
have autorpm &&
@@@ -3201,6 -3293,265 +3198,6 @@@ _dselect(
} &&
complete -F _dselect $filenames dselect
-# Java completion
-#
-
-# available path elements completion
-have java && {
-_java_path()
-{
- cur=${cur##*:}
- _filedir '@(jar|zip)'
-}
-
-# exact classpath determination
-_java_find_classpath()
-{
- local i
-
- # search first in current options
- for (( i=1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == -@(cp|classpath) ]]; then
- classpath=${COMP_WORDS[i+1]}
- break
- fi
- done
-
- # default to environment
- [ -z "$classpath" ] && classpath=$CLASSPATH
-
- # default to current directory
- [ -z "$classpath" ] && classpath=.
-}
-
-# exact sourcepath determination
-_java_find_sourcepath()
-{
- local i
-
- # search first in current options
- for (( i=1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == -sourcepath ]]; then
- sourcepath=${COMP_WORDS[i+1]}
- break
- fi
- done
-
- # default to classpath
- if [ -z "$sourcepath" ]; then
- _java_find_classpath
- sourcepath=$classpath
- fi
-}
-
-# available classes completion
-_java_classes()
-{
- local classpath i
-
- # find which classpath to use
- _java_find_classpath
-
- # convert package syntax to path syntax
- cur=${cur//.//}
- # parse each classpath element for classes
- for i in ${classpath//:/ }; do
- if [ -r $i ] && [[ "$i" == *.@(jar|zip) ]]; then
- if type zipinfo &>/dev/null; then
- COMPREPLY=( "${COMPREPLY[@]}" $( zipinfo -1 \
- "$i" "$cur*" 2>/dev/null | \
- grep '^[^$]*\.class$' ) )
- else
- COMPREPLY=( "${COMPREPLY[@]}" $( jar tf "$i" \
- "$cur" | grep '^[^$]*\.class$' ) )
- fi
-
- elif [ -d $i ]; then
- i=${i%/}
-
- # See Debian bug #496828
- COMPREPLY=( "${COMPREPLY[@]}" $( find "$i" -type f \
- -maxdepth 1 -path "$i/$cur*.class" 2>/dev/null | \
- grep -v "\\$" | sed -e "s|^$i/||" ) )
-
- # FIXME: if we have foo.class and foo/, the completion
- # returns "foo/"... how to give precedence to files
- # over directories?
- fi
- done
-
- # remove class extension
- COMPREPLY=( ${COMPREPLY[@]%.class} )
- # convert path syntax to package syntax
- COMPREPLY=( ${COMPREPLY[@]//\//.} )
-}
-
-# available packages completion
-_java_packages()
-{
- local sourcepath i
-
- # find which sourcepath to use
- _java_find_sourcepath
-
- # convert package syntax to path syntax
- cur=${cur//.//}
- # parse each sourcepath element for packages
- for i in ${sourcepath//:/ }; do
- if [ -d $i ]; then
- COMPREPLY=( "${COMPREPLY[@]}" $( command ls -F -d \
- $i/$cur* 2>/dev/null | sed -e 's|^'$i'/||' ) )
- fi
- done
- # keep only packages
- COMPREPLY=( $( echo "${COMPREPLY[@]}" | tr " " "\n" | grep "/$" ) )
- # remove packages extension
- COMPREPLY=( ${COMPREPLY[@]%/} )
- # convert path syntax to package syntax
- cur=${COMPREPLY[@]//\//.}
-}
-
-# java completion
-#
-_java()
-{
- local cur prev i
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- for ((i=1; i < $COMP_CWORD; i++)); do
- case ${COMP_WORDS[$i]} in
- -cp|-classpath)
- ((i++)) # skip the classpath string.
- ;;
- -*)
- # this is an option, not a class/jarfile name.
- ;;
- *)
- # once we've seen a class, just do filename completion
- _filedir
- return 0
- ;;
- esac
- done
-
- case $prev in
- -@(cp|classpath))
- _java_path
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- # relevant options completion
- COMPREPLY=( $( compgen -W '-client -hotspot -server -classic \
- -cp -classpath -D -verbose -verbose:class \
- -verbose:gc -version:jni -version \
- -showversion -? -help -X -jar \
- -ea -enableassertions -da -disableassertions \
- -esa -enablesystemassertions \
- -dsa -disablesystemassertions ' -- $cur ) )
- else
- if [[ "$prev" == -jar ]]; then
- # jar file completion
- _filedir jar
- else
- # classes completion
- _java_classes
- fi
- fi
-}
-complete -F _java $filenames java
-}
-
-# javadoc completion
-#
-have javadoc &&
-_javadoc()
-{
- COMPREPLY=()
- local cur prev
-
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case $prev in
- -@(overview|helpfile|stylesheetfile))
- _filedir
- return 0
- ;;
- -d)
- _filedir -d
- return 0
- ;;
- -@(classpath|bootclasspath|docletpath|sourcepath|extdirs))
- _java_path
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- # relevant options completion
- COMPREPLY=( $( compgen -W '-overview -public -protected \
- -package -private -help -doclet -docletpath \
- -sourcepath -classpath -exclude -subpackages \
- -breakiterator -bootclasspath -source -extdirs \
- -verbose -locale -encoding -J -d -use -version \
- -author -docfilessubdirs -splitindex \
- -windowtitle -doctitle -header -footer -bottom \
- -link -linkoffline -excludedocfilessubdir \
- -group -nocomment -nodeprecated -noqualifier \
- -nosince -nodeprecatedlist -notree -noindex \
- -nohelp -nonavbar -quiet -serialwarn -tag \
- -taglet -tagletpath -charset -helpfile \
- -linksource -stylesheetfile -docencoding' -- \
- $cur ) )
- else
- # source files completion
- _filedir java
- # packages completion
- _java_packages
- fi
-} &&
-complete -F _javadoc $filenames javadoc
-
-# javac completion
-#
-have javac &&
-_javac()
-{
- COMPREPLY=()
- local cur prev
-
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case $prev in
- -d)
- _filedir -d
- return 0
- ;;
- -@(classpath|bootclasspath|sourcepath|extdirs))
- _java_path
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- # relevant options completion
- COMPREPLY=( $( compgen -W '-g -g:none -g:lines -g:vars\
- -g:source -O -nowarn -verbose -deprecation -classpath\
- -sourcepath -bootclasspath -extdirs -d -encoding -source\
- -target -help' -- $cur ) )
- else
- # source files completion
- _filedir java
- fi
-} &&
-complete -F _javac $filenames javac
-
# PINE address-book completion
#
have pine &&
@@@ -3376,181 -3727,340 +3373,6 @@@ _configure_func(
}
complete -F _configure_func $default configure
- # Debian reportbug(1) completion
- #
- have reportbug &&
- _reportbug()
- {
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -f|--filename|-i|--include|--mta|-o|--output)
- _filedir
- return 0
- ;;
- -B|--bts)
- COMPREPLY=( $( compgen -W "debian guug kde mandrake help" -- \
- $cur ))
- return 0
- ;;
- -e|--editor|--mua)
- COMP_WORDS=(COMP_WORDS[0] $cur)
- COMP_CWORD=1
- _command
- return 0
- ;;
- --mode)
- COMPREPLY=( $( compgen -W "novice standard expert" -- $cur ) )
- return 0
- ;;
- -S|--severity)
- COMPREPLY=( $( compgen -W "grave serious important normal \
- minor wishlist" -- $cur ) )
- return 0
- ;;
- -u|--ui|--interface)
- COMPREPLY=( $( compgen -W "newt text gnome" -- $cur ) )
- return 0
- ;;
- -t|--type)
- COMPREPLY=( $( compgen -W "gnats debbugs" -- $cur ) )
- return 0
- ;;
- -T|--tags)
- COMPREPLY=( $( compgen -W "none \
- woody potato sarge sarge-ignore etch etch-ignore \
- lenny lenny-ignore sid experimental confirmed \
- d-i fixed fixed-in-experimental fixed-upstream \
- help l10n moreinfo patch pending security \
- unreproducible upstream wontfix ipv6 lfs" -- $cur ))
- return 0
- ;;
- *)
- ;;
- esac
-
- COMPREPLY=($( compgen -W '-h --help -v --version -a --af -b \
- --no-query-bts --query-bts -B --bts -c --configure \
- --no-config-files --check-available -d --debug \
- --no-check-available -e --editor --email -f \
- --filename -g --gnupg -H --header -i --include -j \
- --justification -l --ldap --no-ldap -L --list-cc -m \
- --maintonly --mode --mua --mta --mutt -n --mh --nmh \
- -o --output -p --print -P --pgp --proxy --http_proxy\
- -q --quiet -Q --query-only --realname --report-quiet \
- --reply-to --replyto -s --subject -S --severity \
- --smtphost -t --type -T --tags --template -V -x \
- --no-cc --package-version -z --no-compress \
- --ui --interface -u \
- wnpp boot-floppies kernel bugs.debian.org \
- cdimage.debian.org general installation-reports \
- listarchives lists.debian.org mirrors nm.debian.org \
- press project qa.debian.org release-notes \
- security.debian.org tech-ctte upgrade-reports \
- www.debian.org' -- $cur ) \
- $( apt-cache pkgnames -- $cur 2> /dev/null) )
- _filedir
- return 0
- } &&
- complete -F _reportbug $filenames reportbug
-
- # Debian querybts(1) completion
- #
- have querybts &&
- _querybts()
- {
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -B|--bts)
- COMPREPLY=( $( compgen -W "debian guug kde mandrake help" -- \
- $cur ))
- return 0
- ;;
- -u|--ui|--interface)
- COMPREPLY=($( compgen -W "newt text gnome" -- $cur ))
- return 0
- ;;
- *)
- ;;
- esac
-
- COMPREPLY=($( compgen -W '-h --help -v --version -A --archive \
- -B --bts -l --ldap --no-ldap --proxy= --http_proxy= \
- -s --source -w --web -u --ui --interface \
- wnpp boot-floppies kernel bugs.debian.org \
- cdimage.debian.org general installation-reports \
- listarchives lists.debian.org mirrors nm.debian.org \
- press project qa.debian.org release-notes \
- security.debian.org tech-ctte upgrade-reports \
- www.debian.org' -- $cur ) \
- $( apt-cache pkgnames -- $cur 2> /dev/null) )
- } &&
- complete -F _querybts $filenames querybts
-
- # lilo(8) completion
- #
- have lilo && {
- _lilo_labels()
- {
- COMPREPLY=( $( awk -F'=' '/label/ {print $2}' \
- /etc/lilo.conf | sed -e 's/"//g' | grep "^$cur" ) )
- }
-
- _lilo()
- {
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case $prev in
- -@(C|i|m|s|S))
- _filedir
- return 0
- ;;
- -r)
- _filedir -d
- return 0
- ;;
- -@(I|D|R))
- # label completion
- _lilo_labels
- return 0
- ;;
- -@(A|b|M|u|U))
- # device completion
- cur=${cur:=/dev/}
- _filedir
- return 0
- ;;
- -T)
- # topic completion
- COMPREPLY=( $( compgen -W 'help ChRul EBDA geom geom= \
- table= video' -- $cur ) )
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- # relevant options completion
- COMPREPLY=( $( compgen -W '-A -b -c -C -d -f -g -i -I -l -L -m \
- -M -p -P -q -r -R -s -S -t -T -u -U -v -V -w -x -z' -- \
- $cur ) )
- fi
- }
- complete -F _lilo lilo
- }
-
-# update-alternatives completion
-#
-have update-alternatives && {
-_installed_alternatives()
-{
- local admindir
- # find the admin dir
- for i in alternatives dpkg/alternatives rpm/alternatives; do
- [ -d /var/lib/$i ] && admindir=/var/lib/$i && break
- done
- for (( i=1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == --admindir ]]; then
- admindir=${COMP_WORDS[i+1]}
- break
- fi
- done
- COMPREPLY=( $( compgen -W '$( command ls $admindir )' -- $cur ) )
-}
-
-_update_alternatives()
-{
- local cur prev mode args i
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- --@(altdir|admindir))
- _filedir -d
- return 0
- ;;
- --@(help|version))
- return 0
- ;;
- esac
-
- # find which mode to use and how many real args used so far
- for (( i=1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == --@(install|remove|auto|display|config|remove-all) ]]; then
- mode=${COMP_WORDS[i]}
- args=$(($COMP_CWORD - i))
- break
- fi
- done
-
- case $mode in
- --install)
- case $args in
- 1)
- _filedir
- ;;
- 2)
- _installed_alternatives
- ;;
- 3)
- _filedir
- ;;
- esac
- ;;
- --remove)
- case $args in
- 1)
- _installed_alternatives
- ;;
- 2)
- _filedir
- ;;
- esac
- ;;
- --auto)
- _installed_alternatives
- ;;
- --remove-all)
- _installed_alternatives
- ;;
- --display)
- _installed_alternatives
- ;;
- --config)
- _installed_alternatives
- ;;
- *)
- COMPREPLY=( $( compgen -W '--verbose --quiet --help --version \
- --altdir --admindir' -- $cur ) \
- $( compgen -W '--install --remove --auto --display \
- --config' -- $cur ) )
- esac
-}
-complete -F _update_alternatives update-alternatives alternatives
-}
-
-# Python completion
-#
-have python &&
-_python()
-{
- local prev cur
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]##*/}
-
- case "$prev" in
- -Q)
- COMPREPLY=( $( compgen -W "old new warn warnall" -- $cur ) )
- return 0
- ;;
- -W)
- COMPREPLY=( $( compgen -W "ignore default all module once error" -- $cur ) )
- return 0
- ;;
- -c)
- _filedir '@(py|pyc|pyo)'
- return 0
- ;;
- !(python|-?))
- [[ ${COMP_WORDS[COMP_CWORD-2]} != -@(Q|W) ]] && _filedir
- ;;
- esac
-
-
- # if '-c' is already given, complete all kind of files.
- for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
- if [[ ${COMP_WORDS[i]} == -c ]]; then
- _filedir
- fi
- done
-
-
- if [[ "$cur" != -* ]]; then
- _filedir '@(py|pyc|pyo)'
- else
- COMPREPLY=( $( compgen -W "- -d -E -h -i -O -Q -S -t -u \
- -U -v -V -W -x -c" -- $cur ) )
- fi
-
-
-
- return 0
-} &&
-complete -F _python $filenames python
-
-# Perl completion
-#
-have perl &&
-{
-_perlmodules()
-{
- COMPREPLY=( $( compgen -P "$prefix" -W "$( perl -e 'sub mods { my ($base,$dir)=@_; return if $base !~ /^\Q$ENV{cur}/; chdir($dir) or return; for (glob(q[*.pm])) {s/\.pm$//; print qq[$base$_\n]}; mods(/^(?:[.\d]+|$Config{archname}-$Config{osname}|auto)$/ ? undef : qq[${base}${_}\\\\:\\\\:],qq[$dir/$_]) for grep {-d} glob(q[*]); } mods(undef,$_) for @INC;' )" -- $cur ) )
-}
-
-_perl()
-{
- local cur prev prefix temp
- local optPrefix optSuffix
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
- prefix=""
-
- # If option not followed by whitespace, reassign prev and cur
- if [[ "$cur" == -?* ]]; then
- temp=$cur
- prev=${temp:0:2}
- cur=${temp:2}
- optPrefix=-P$prev
- optSuffix=-S/
- prefix=$prev
- fi
-
- # only handle module completion for now
- case "$prev" in
- -I|-x)
- local IFS=$'\t\n'
- COMPREPLY=( $( compgen -d $optPrefix $optSuffix -- "$cur" ) )
- return 0
- ;;
- -m|-M)
- _perlmodules
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-C -s -T -u -U -W -X -h -v -V -c -w -d \
- -D -p -n -a -F -l -0 -I -m -M -P -S -x -i -e ' -- $cur ) )
- else
- _filedir
- fi
-}
-complete -F _perl $nospace $filenames perl
-
-_perldoc()
-{
- local cur prev prefix temp
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
- prefix=""
-
- # completing an option (may or may not be separated by a space)
- if [[ "$cur" == -?* ]]; then
- temp=$cur
- prev=${temp:0:2}
- cur=${temp:2}
- prefix=$prev
- fi
-
- # complete builtin perl functions
- case $prev in
- -f)
- COMPREPLY=( $( compgen -W 'chomp chop chr crypt hex index lc \
- lcfirst length oct ord pack q qq reverse rindex sprintf \
- substr tr uc ucfirst y m pos quotemeta s split study qr abs \
- atan2 cos exp hex int log oct rand sin sqrt srand pop push \
- shift splice unshift grep join map qw reverse sort unpack \
- delete each exists keys values binmode close closedir \
- dbmclose dbmopen die eof fileno flock format getc print \
- printf read readdir rewinddir seek seekdir select syscall \
- sysread sysseek syswrite tell telldir truncate warn write \
- pack read syscall sysread syswrite unpack vec -X chdir chmod \
- chown chroot fcntl glob ioctl link lstat mkdir open opendir \
- readlink rename rmdir stat symlink umask unlink utime caller \
- continue do dump eval exit goto last next redo return \
- sub wantarray caller import local my our package use defined \
- formline reset scalar undef \
- alarm exec fork getpgrp getppid getpriority kill pipe qx \
- setpgrp setpriority sleep system times wait waitpid \
- import no package require use bless dbmclose dbmopen package \
- ref tie tied untie use accept bind connect getpeername \
- getsockname getsockopt listen recv send setsockopt shutdown \
- socket socketpair msgctl msgget msgrcv msgsnd semctl semget \
- semop shmctl shmget shmread shmwrite endgrent endhostent \
- endnetent endpwent getgrent getgrgid getgrnam getlogin \
- getpwent getpwnam getpwuid setgrent setpwent endprotoent \
- endservent gethostbyaddr gethostbyname gethostent \
- getnetbyaddr getnetbyname getnetent getprotobyname \
- getprotobynumber getprotoent getservbyname getservbyport \
- getservent sethostent setnetent setprotoent setservent \
- gmtime localtime time times' -- $cur ) )
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-h -v -t -u -m -l -F -X -f -q' -- $cur ))
- else
- # return available modules (unless it is clearly a file)
- if [[ "$cur" != */* ]]; then
- _perlmodules
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W '$( PAGER=/bin/cat man perl | sed -ne "/perl.*Perl overview/,/perlwin32/p" | awk "\$NF=2 { print \$1}" | grep perl )' -- $cur ) )
- fi
- fi
-}
-complete -F _perldoc $default perldoc
-}
-
-# rcs(1) completion
-#
-have rcs &&
-_rcs()
-{
- local cur prev file dir i
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- file=${cur##*/}
- dir=${cur%/*}
-
- # deal with relative directory
- [ "$file" = "$dir" ] && dir=.
-
- COMPREPLY=( $( compgen -f "$dir/RCS/$file" ) )
-
- for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
- file=${COMPREPLY[$i]##*/}
- dir=${COMPREPLY[$i]%RCS/*}
- COMPREPLY[$i]=$dir$file
- done
-
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -G "$dir/$file*,v" ) )
-
- for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
- COMPREPLY[$i]=${COMPREPLY[$i]%,v}
- done
-
- # default to files if nothing returned and we're checking in.
- # otherwise, default to directories
- [ ${#COMPREPLY[@]} -eq 0 -a $1 = ci ] && _filedir || _filedir -d
-} &&
-complete -F _rcs $filenames ci co rlog rcs rcsdiff
-
-# links completion
-#
-have links &&
-_links()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- case "$cur" in
- --*)
- COMPREPLY=( $( compgen -W '--help' -- $cur ) )
- ;;
- -*)
- COMPREPLY=( $( compgen -W '-async-dns -max-connections \
- -max-connections-to-host -retries \
- -receive-timeout -unrestartable-receive-timeout\
- -format-cache-size -memory-cache-size \
- -http-proxy -ftp-proxy -download-dir \
- -assume-codepage -anonymous -dump -no-connect \
- -source -version -help' -- $cur ) )
- ;;
- *)
- if [ -r ~/.links/links.his ]; then
- COMPREPLY=( $( compgen -W '$( < ~/.links/links.his )' \
- -- $cur ) )
- fi
- _filedir '@(htm|html)'
- return 0
- ;;
- esac
-
- return 0
-} &&
-complete -F _links $filenames links
-
[ $UNAME = FreeBSD ] && {
# FreeBSD package management tool completion
#
@@@ -3708,6 -4218,157 +3530,6 @@@ _ypmatch(
} &&
complete -F _ypmatch ypmatch ypcat
-#xrandr(1) completion
-#
-have xrandr &&
-_xrandr()
-{
- local cur prev output modes
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- --output)
- local outputs=$(xrandr|grep 'connected'|awk '{print $1}')
- COMPREPLY=( $(compgen -W "$outputs" -- $cur))
- return 0
- ;;
- --mode)
- for(( i = 1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == "--output" ]]; then
- output=${COMP_WORDS[i+1]}
- break
- fi
- done
- modes=$(xrandr|sed -e "1,/$output/ d" \
- -e "/connected/,$ d"|awk '{print $1}')
- COMPREPLY=( $( compgen -W "$modes" -- $cur))
- return 0
- ;;
- esac
-
- case "$cur" in
- *)
- COMPREPLY=( $(compgen -W '-d -display -help -o \
- --orientation -q --query -s --size\
- -r --rate -v --version -x -y --screen \
- --verbose --dryrun --prop --fb --fbmm --dpi \
- --output --auto --mode --preferred --pos \
- --reflect --rotate --left-of --right-of \
- --above --below --same-as --set --off --crtc \
- --newmode --rmmode --addmode --delmode' -- $cur))
- return 0
- ;;
- esac
-
- return 0
-} &&
-complete -F _xrandr xrandr
-
-# KDE dcop completion
-#
-have dcop &&
-_dcop()
-{
- local cur compstr
-
- COMPREPLY=()
- cur=`_get_cword`
- if [ -z $cur ]; then
- compstr=${COMP_WORDS[*]}
- else
- compstr=$( command echo ${COMP_WORDS[*]} | sed "s/ $cur$//" )
- fi
- COMPREPLY=( $( compgen -W '$( command $compstr | sed s/\(.*\)// )' -- $cur ) )
-} &&
-complete -F _dcop dcop
-
-# wvdial(1) completion
-#
-have wvdial &&
-_wvdial()
-{
- local cur prev config i IFS=$'\t\n'
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case $prev in
- --config)
- _filedir
- return 0
- ;;
- esac
-
- case $cur in
- -*)
- COMPREPLY=( $( compgen -W '--config --chat \
- --remotename --help --version --no-syslog' \
- -- $cur ) )
- ;;
- *)
- # start with global and personal config files
- config="/etc/wvdial.conf"$'\t'"$HOME/.wvdialrc"
- # replace with command line config file if present
- for (( i=1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == "--config" ]]; then
- config=${COMP_WORDS[i+1]}
- break
- fi
- done
- # parse config files for sections and
- # remove default section
- COMPREPLY=( $( sed -ne \
- "s|^\[Dialer \($cur.*\)\]$|\1|p" \
- $config 2>/dev/null |grep -v '^Defaults$'))
- # escape spaces
- COMPREPLY=${COMPREPLY// /\\ }
- ;;
- esac
-
-} &&
-complete -F _wvdial wvdial
-
-# gpg(1) completion
-#
-have gpg &&
-_gpg()
-{
- local cur prev
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- case "$prev" in
- -@(s|-sign|-clearsign|-decrypt-files|-load-extension))
- _filedir
- return 0
- ;;
- --@(export|@(?(l|nr|nrl)sign|edit)-key))
- # return list of public keys
- COMPREPLY=( $( compgen -W "$( gpg --list-keys 2>/dev/null | sed -ne 's@^pub.*/\([^ ]*\).*$@\1 at p;s@^.*\(<\([^>]*\)>\).*$@\2 at p')" -- "$cur" ))
- return 0
- ;;
- -@(r|-recipient))
- COMPREPLY=( $( compgen -W "$( gpg --list-keys 2>/dev/null | sed -ne 's@^.*<\([^>]*\)>.*$@\1 at p')" -- "$cur" ))
- if [ -e ~/.gnupg/gpg.conf ]; then
- COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$( sed -ne 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1 at p' ~/.gnupg/gpg.conf )" -- "$cur") )
- fi
- return 0
- ;;
- esac
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-s -b -e -f -c -d -a -r -u -Z -o -v\
- -q -n -N $(gpg --dump-options)' -- $cur ) )
- fi
-
-} &&
-complete -F _gpg $default gpg
-
# iconv(1) completion
#
have iconv &&
@@@ -3821,6 -4482,148 +3643,6 @@@ _cancel(
} &&
complete -F _cancel $filenames cancel
-# aspell(1) completion
-#
-have aspell && {
-_aspell_dictionary()
-{
- local datadir
- datadir=$( aspell config data-dir 2>/dev/null || echo /usr/lib/aspell )
- # First, get aliases (dicts dump does not list them)
- COMPREPLY=( $( command ls $datadir/*.alias 2>/dev/null ) )
- COMPREPLY=( ${COMPREPLY[@]%.alias} )
- COMPREPLY=( ${COMPREPLY[@]#$datadir/} )
- # Then, add the canonical dicts
- COMPREPLY=( "${COMPREPLY[@]}" $( aspell dicts 2>/dev/null ) )
- COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- $cur ) )
-}
-
-_aspell()
-{
- local cur prev split=false
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- _split_longopt && split=true
-
- case "$prev" in
- -c|-p|check|--@(conf|personal|repl|per-conf))
- _filedir
- return 0
- ;;
- --@(conf-dir|data-dir|dict-dir|home-dir|local-data-dir|prefix))
- _filedir -d
- return 0
- ;;
- dump|create|merge)
- COMPREPLY=( $( compgen -W 'master personal repl' -- $cur ) )
- return 0
- ;;
- --mode)
- COMPREPLY=( $( compgen -W 'none url email sgml tex' -- $cur ) )
- return 0
- ;;
- --sug-mode)
- COMPREPLY=( $( compgen -W 'ultra fast normal bad-speller' -- $cur ) )
- return 0
- ;;
- --keymapping)
- COMPREPLY=( $( compgen -W 'aspell ispell' -- $cur ) )
- return 0
- ;;
- -d|--master)
- _aspell_dictionary
- return 0
- ;;
- esac
-
- $split && return 0
-
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--conf --conf-dir --data-dir --dict-dir \
- --encoding --add-filter --rem-filter --mode -e \
- -H -t --add-extra-dicts --rem-extra-dicts \
- --home-dir -W --ignore --ignore-accents \
- --dont-ignore-accents --ignore-case --dont-ignore-case \
- --ignore-repl --dont-ignore-repl --jargon --keyboard \
- --lang --language-tag --local-data-dir -d --master \
- --module --add-module-search-order \
- --rem-module-search-order --per-conf -p --personal \
- --prefix --repl -C -B --run-together --dont-run-together \
- --run-together-limit --run-together-min --save-repl \
- --dont-save-repl --set-prefix --dont-set-prefix --size \
- --spelling --strip-accents --dont-strip-accents \
- --sug-mode --add-word-list-path --rem-word-list-path \
- -b -x --backup -b|-x --dont-backup --reverse --dont-reverse \
- --time --dont-time --keymapping --add-email-quote \
- --rem-email-quote --email-margin --add-tex-command \
- --rem-tex-command --tex-check-comments \
- --dont-tex-check-comments --add-tex-extension \
- --rem-tex-extension --add-sgml-check --rem-sgml-check \
- --add-sgml-extension --rem-sgml-extension' -- $cur ) )
- else
- COMPREPLY=( $( compgen -W '-? help -c check -a pipe -l list \
- config config soundslike filter -v version dump \
- create merge' -- $cur ) )
- fi
-
-}
-complete -F _aspell $filenames aspell
-}
-
-# info(1) completion
-#
-have info &&
-_info()
-{
- local cur infopath
-
- COMPREPLY=()
- cur=`_get_cword`
-
- _expand || return 0
-
- # default completion if parameter contains /
- if [[ "$cur" == */* ]]; then
- _filedir
- return 0
- fi
-
- infopath='/usr/share/info'
-
- if [ "${INFOPATH: -1:1}" == ':' ]; then
- infopath=${INFOPATH}${infopath}
- elif [ ${INFOPATH:+set} ]; then
- infopath=$INFOPATH
- fi
-
- infopath=$infopath:
- if [ -n "$cur" ]; then
- infopath="${infopath//://$cur* }"
- else
- infopath="${infopath//:// }"
- fi
-
- # redirect stderr for when path doesn't exist
- COMPREPLY=( $( eval command ls "$infopath" 2>/dev/null ) )
- # weed out directory path names and paths to info pages
- COMPREPLY=( ${COMPREPLY[@]##*/?(:)} )
- # weed out info dir file
- for (( i=0 ; i < ${#COMPREPLY[@]} ; ++i )); do
- if [ "${COMPREPLY[$i]}" == 'dir' ]; then
- unset COMPREPLY[$i];
- fi;
- done
- # strip suffix from info pages
- COMPREPLY=( ${COMPREPLY[@]%.@(gz|bz2|lzma)} )
- COMPREPLY=( $( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" ) )
-
- return 0
-} &&
-complete -F _info $filenames info
-
# id(1) completion
#
have id &&
@@@ -3840,6 -4643,22 +3662,6 @@@ _id(
} &&
complete -F _id id
-# sysctl(8) completion
-#
-have sysctl &&
-_sysctl()
-{
- local cur
-
- COMPREPLY=()
- cur=`_get_cword`
-
- COMPREPLY=( $( compgen -W "$(sysctl -N -a 2>/dev/null)" -- $cur ) )
-
- return 0
-} &&
-complete -F _sysctl sysctl
-
# update-rc.d(8) completion
#
# Copyright (C) 2004 Servilio Afre Puentes <servilio at gmail.com>
@@@ -3947,6 -4766,16 +3769,6 @@@ _invoke_rc_d(
} &&
complete -F _invoke_rc_d invoke-rc.d
-have rrdtool &&
-_rrdtool ()
-{
- cur=`_get_cword`
- COMPREPLY=( $( compgen -W 'create update updatev graph dump \
- restore last lastupdate first info \
- fetch tune resize xport' -- $cur ) )
-} &&
-complete -F _rrdtool rrdtool
-
_filedir_xspec()
{
local IFS cur xspec
@@@ -4032,7 -4861,7 +3854,7 @@@ unset
[ $BASH_COMPLETION != ~/.bash_completion -a -r ~/.bash_completion ] \
&& . ~/.bash_completion
unset -f have
- unset UNAME default dirnames filenames have nospace bashdefault plusdirs
+ unset UNAME USERLAND default dirnames filenames have nospace bashdefault plusdirs
set $BASH_COMPLETION_ORIGINAL_V_VALUE
unset BASH_COMPLETION_ORIGINAL_V_VALUE
--
bash-completion
More information about the Bash-completion-commits
mailing list