1 # bash_completion - programmable completion functions for bash 3.x
2 # (backwards compatible with bash 2.05b)
4 # $Id: bash_completion,v 1.872 2006/03/01 16:20:18 ianmacd Exp $
6 # Copyright (C) Ian Macdonald <ian@caliban.org>
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2, or (at your option)
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software Foundation,
20 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 # The latest version of this software can be obtained here:
24 # http://www.caliban.org/bash/index.shtml#completion
28 if [[ $- == *v* ]]; then
29 BASH_COMPLETION_ORIGINAL_V_VALUE="-v"
31 BASH_COMPLETION_ORIGINAL_V_VALUE="+v"
34 if [[ -n $BASH_COMPLETION_DEBUG ]]; then
40 # Alter the following to reflect the location of this file.
42 [ -n "$BASH_COMPLETION" ] || BASH_COMPLETION=/etc/bash_completion
43 [ -n "$BASH_COMPLETION_DIR" ] || BASH_COMPLETION_DIR=/etc/bash_completion.d
44 readonly BASH_COMPLETION BASH_COMPLETION_DIR
46 # Set a couple of useful vars
49 # strip OS type and version under Cygwin (e.g. CYGWIN_NT-5.1 => Cygwin)
50 UNAME=${UNAME/CYGWIN_*/Cygwin}
53 # features supported by bash 2.05 and higher
54 if [ ${BASH_VERSINFO[0]} -eq 2 ] && [[ ${BASH_VERSINFO[1]} > 04 ]] ||
55 [ ${BASH_VERSINFO[0]} -gt 2 ]; then
56 declare -r bash205=$BASH_VERSION 2>/dev/null || :
58 dirnames="-o dirnames"
59 filenames="-o filenames"
61 # features supported by bash 2.05b and higher
62 if [ ${BASH_VERSINFO[0]} -eq 2 ] && [[ ${BASH_VERSINFO[1]} = "05b" ]] ||
63 [ ${BASH_VERSINFO[0]} -gt 2 ]; then
64 declare -r bash205b=$BASH_VERSION 2>/dev/null || :
67 # features supported by bash 3.0 and higher
68 if [ ${BASH_VERSINFO[0]} -gt 2 ]; then
69 declare -r bash3=$BASH_VERSION 2>/dev/null || :
70 bashdefault="-o bashdefault"
71 plusdirs="-o plusdirs"
74 # Turn on extended globbing and programmable completion
75 shopt -s extglob progcomp
77 # A lot of the following one-liners were taken directly from the
78 # completion examples provided with the bash 2.04 source distribution
80 # Make directory commands see only directories
83 # The following section lists completions that are redefined later
84 # Do NOT break these over multiple lines.
86 # START exclude -- do NOT remove this line
87 complete -f -X '!*.?(t)bz?(2)' bunzip2 bzcat bzcmp bzdiff bzegrep bzfgrep bzgrep
88 complete -f -X '!*.@(zip|ZIP|jar|JAR|exe|EXE|pk3|war|wsz|ear|zargo|xpi|sxw|ott)' unzip zipinfo
89 complete -f -X '*.Z' compress znew
90 complete -f -X '!*.@(Z|gz|tgz|Gz|dz)' gunzip zcmp zdiff zcat zegrep zfgrep zgrep zless zmore
91 complete -f -X '!*.Z' uncompress
92 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 display
93 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
94 complete -f -X '!*.@(@(?(e)ps|?(E)PS|pdf|PDF)?(.gz|.GZ|.bz2|.BZ2|.Z))' gv ggv kghostview
95 complete -f -X '!*.@(dvi|DVI)?(.@(gz|Z|bz2))' xdvi
96 complete -f -X '!*.@(dvi|DVI)?(.@(gz|bz2))' kdvi
97 complete -f -X '!*.@(dvi|DVI)' dvips dviselect dvitype dvipdf advi dvipdfm dvipdfmx
98 complete -f -X '!*.@(pdf|PDF)' acroread gpdf xpdf
99 complete -f -X '!*.@(?(e)ps|?(E)PS|pdf|PDF)' kpdf
100 complete -f -X '!*.@(@(?(e)ps|?(E)PS|pdf|PDF)?(.gz|.GZ)|cb(r|z)|CB(R|Z)|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)' evince
101 complete -f -X '!*.@(?(e)ps|?(E)PS)' ps2pdf
102 complete -f -X '!*.texi*' makeinfo texi2html
103 complete -f -X '!*.@(?(la)tex|?(LA)TEX|texi|TEXI|dtx|DTX|ins|INS)' tex latex slitex jadetex pdfjadetex pdftex pdflatex texi2dvi
104 complete -f -X '!*.@(mp3|MP3)' mpg123 mpg321 madplay
105 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|viv|rm|ram|yuv|mov|MOV|qt|QT|wmv|mp3|MP3|m4v|M4V|ogg|OGG|ogm|OGM|mp4|MP4|wav|WAV|asx|ASX|mng|MNG|srt)' xine aaxine fbxine kaffeine
106 complete -f -X '!*.@(avi|asf|wmv)' aviplay
107 complete -f -X '!*.@(rm?(j)|ra?(m)|smi?(l))' realplay
108 complete -f -X '!*.@(mpg|mpeg|avi|mov|qt)' xanim
109 complete -f -X '!*.@(ogg|OGG|m3u|flac|spx)' ogg123
110 complete -f -X '!*.@(mp3|MP3|ogg|OGG|pls|m3u)' gqmpeg freeamp
111 complete -f -X '!*.fig' xfig
112 complete -f -X '!*.@(mid?(i)|MID?(I))' playmidi
113 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)' timidity
114 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
115 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)' emacs
116 complete -f -X '!*.@(exe|EXE|com|COM|scr|SCR|exe.so)' wine
117 complete -f -X '!*.@(zip|ZIP|z|Z|gz|GZ|tgz|TGZ)' bzme
118 complete -f -X '!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))' netscape mozilla lynx opera galeon curl dillo elinks amaya
119 complete -f -X '!*.@(sxw|stw|sxg|sgl|doc|dot|rtf|txt|htm|html|odt|ott|odm)' oowriter
120 complete -f -X '!*.@(sxi|sti|pps|ppt|pot|odp|otp)' ooimpress
121 complete -f -X '!*.@(sxc|stc|xls|xlw|xlt|csv|ods|ots)' oocalc
122 complete -f -X '!*.@(sxd|std|sda|sdd|odg|otg)' oodraw
123 complete -f -X '!*.@(sxm|smf|mml|odf)' oomath
124 complete -f -X '!*.odb' oobase
125 complete -f -X '!*.rpm' rpm2cpio
126 # FINISH exclude -- do not remove this line
128 # start of section containing compspecs that can be handled within bash
130 # user commands see only users
131 complete -u su usermod userdel passwd chage write chfn groups slay w sux
133 # group commands see only groups
134 [ -n "$bash205" ] && complete -g groupmod groupdel newgrp 2>/dev/null
136 # bg completes with stopped jobs
137 complete -A stopped -P '%' bg
140 complete -j -P '%' fg jobs disown
142 # readonly and unset complete with shell variables
143 complete -v readonly unset
145 # set completes with set options
146 complete -A setopt set
148 # shopt completes with shopt options
149 complete -A shopt shopt
152 complete -A helptopic help
154 # unalias completes with aliases
157 # bind completes with readline bindings (make this more intelligent)
158 complete -A binding bind
160 # type and which complete on commands
161 complete -c command type which
163 # builtin completes on builtins
166 # start of section containing completion functions called by other functions
168 # This function checks whether we have a given program on the system.
169 # No need for bulky functions in memory if we don't.
174 PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin type $1 &>/dev/null &&
178 # use GNU sed if we have it, since its extensions are still used in our code
180 [ $UNAME != Linux ] && have gsed && alias sed=gsed
182 # This function checks whether a given readline variable
187 [[ "$( bind -v )" = *$1+([[:space:]])on* ]]
190 # This function shell-quotes the argument
193 echo \'${1//\'/\'\\\'\'}\' #'# Help vim syntax highlighting
196 # This function quotes the argument in a way so that readline dequoting
197 # results in the original argument
200 local t="${1//\\/\\\\}"
201 echo \'${t//\'/\'\\\'\'}\' #'# Help vim syntax highlighting
204 # This function shell-dequotes the argument
211 # Get the word to complete
212 # This is nicer than ${COMP_WORDS[$COMP_CWORD]}, since it handles cases
213 # where the user is completing in the middle of a word.
214 # (For example, if the line is "ls foobar",
215 # and the cursor is here --------> ^
216 # it will complete just "foo", not "foobar", which is what the user wants.)
219 if [[ "${#COMP_WORDS[COMP_CWORD]}" -eq 0 ]] || [[ "$COMP_POINT" == "${#COMP_LINE}" ]]; then
220 echo "${COMP_WORDS[COMP_CWORD]}"
223 local cur="$COMP_LINE"
224 local index="$COMP_POINT"
225 for (( i = 0; i <= COMP_CWORD; ++i )); do
226 while [[ "${#cur}" -ge ${#COMP_WORDS[i]} ]] && [[ "${cur:0:${#COMP_WORDS[i]}}" != "${COMP_WORDS[i]}" ]]; do
228 index="$(( index - 1 ))"
230 if [[ "$i" -lt "$COMP_CWORD" ]]; then
231 local old_size="${#cur}"
232 cur="${cur#${COMP_WORDS[i]}}"
233 local new_size="${#cur}"
234 index="$(( index - old_size + new_size ))"
238 if [[ "${COMP_WORDS[COMP_CWORD]:0:${#cur}}" != "$cur" ]]; then
239 # We messed up! At least return the whole word so things keep working
240 echo "${COMP_WORDS[COMP_CWORD]}"
242 echo "${cur:0:$index}"
248 # This function performs file and directory completion. It's better than
249 # simply using 'compgen -f', because it honours spaces in filenames.
250 # If passed -d, it completes only on directories. If passed anything else,
251 # it's assumed to be a file glob to complete on.
255 local IFS=$'\t\n' xspec
260 while read -r tmp; do
261 [[ -n $tmp ]] && toks[${#toks[@]}]=$tmp
262 done < <( compgen -d -- "$(quote_readline "$cur")" )
264 if [[ "$1" != -d ]]; then
266 while read -r tmp; do
267 [[ -n $tmp ]] && toks[${#toks[@]}]=$tmp
268 done < <( compgen -f -X "$xspec" -- "$(quote_readline "$cur")" )
271 COMPREPLY=( "${COMPREPLY[@]}" "${toks[@]}" )
274 # This function completes on signal names
280 # standard signal completion is rather braindead, so we need
281 # to hack around to get what we want here, which is to
282 # complete on a dash, followed by the signal name minus
284 COMPREPLY=( $( compgen -A signal SIG${cur#-} ))
285 for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
286 COMPREPLY[i]=-${COMPREPLY[i]#SIG}
290 # This function completes on configured network interfaces
292 _configured_interfaces()
294 if [ -f /etc/debian_version ]; then
296 COMPREPLY=( $( sed -ne 's|^iface \([^ ]\+\).*$|\1|p' \
297 /etc/network/interfaces ) )
298 elif [ -f /etc/SuSE-release ]; then
300 COMPREPLY=( $( command ls \
301 /etc/sysconfig/network/ifcfg-* | \
302 sed -ne 's|.*ifcfg-\('$cur'.*\)|\1|p' ) )
303 elif [ -f /etc/pld-release ]; then
305 COMPREPLY=( $( command ls -B \
306 /etc/sysconfig/interfaces | \
307 sed -ne 's|.*ifcfg-\('$cur'.*\)|\1|p' ) )
310 COMPREPLY=( $( command ls \
311 /etc/sysconfig/network-scripts/ifcfg-* | \
312 sed -ne 's|.*ifcfg-\('$cur'.*\)|\1|p' ) )
316 # This function completes on all available network interfaces
317 # -a: restrict to active interfaces only
318 # -w: restrict to wireless interfaces only
320 _available_interfaces()
324 if [ "${1:-}" = -w ]; then
326 elif [ "${1:-}" = -a ]; then
332 COMPREPLY=( $( eval $cmd 2>/dev/null | \
333 sed -ne 's|^\('$cur'[^[:space:][:punct:]]\{1,\}\).*$|\1|p') )
336 # This function expands tildes in pathnames
340 # FIXME: Why was this here?
341 # [ "$cur" != "${cur%\\}" ] && cur="$cur\\"
343 # expand ~username type directory specifications
344 if [[ "$cur" == \~*/* ]]; then
346 elif [[ "$cur" == \~* ]]; then
348 COMPREPLY=( $( compgen -P '~' -u $cur ) )
349 return ${#COMPREPLY[@]}
353 # This function completes on process IDs.
354 # AIX and Solaris ps prefers X/Open syntax.
355 [ $UNAME = SunOS -o $UNAME = AIX ] &&
358 COMPREPLY=( $( compgen -W '$( command ps -efo pid | sed 1d )' -- $cur ))
362 COMPREPLY=( $( compgen -W '$( command ps axo pid | sed 1d )' -- $cur ) )
365 # This function completes on process group IDs.
366 # AIX and SunOS prefer X/Open, all else should be BSD.
367 [ $UNAME = SunOS -o $UNAME = AIX ] &&
370 COMPREPLY=( $( compgen -W '$( command ps -efo pgid | sed 1d )' -- $cur ))
374 COMPREPLY=( $( compgen -W '$( command ps axo pgid | sed 1d )' -- $cur ))
377 # This function completes on user IDs
381 if type getent &>/dev/null; then
382 COMPREPLY=( $( getent passwd | \
383 awk -F: '{if ($3 ~ /^'$cur'/) print $3}' ) )
384 elif type perl &>/dev/null; then
385 COMPREPLY=( $( compgen -W '$( perl -e '"'"'while (($uid) = (getpwent)[2]) { print $uid . "\n" }'"'"' )' -- $cur ) )
387 # make do with /etc/passwd
388 COMPREPLY=( $( awk 'BEGIN {FS=":"} {if ($3 ~ /^'$cur'/) print $3}'\
393 # This function completes on group IDs
397 if type getent &>/dev/null; then
398 COMPREPLY=( $( getent group | \
399 awk -F: '{if ($3 ~ /^'$cur'/) print $3}' ) )
400 elif type perl &>/dev/null; then
401 COMPREPLY=( $( compgen -W '$( perl -e '"'"'while (($gid) = (getgrent)[2]) { print $gid . "\n" }'"'"' )' -- $cur ) )
403 # make do with /etc/group
404 COMPREPLY=( $( awk 'BEGIN {FS=":"} {if ($3 ~ /^'$cur'/) print $3}'\
409 # This function completes on services
414 [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d
416 COMPREPLY=( $( builtin echo $sysvdir/!(*.rpmsave|*.rpmorig|*~|functions)) )
418 if [ -d $famdir ]; then
419 COMPREPLY=( "${COMPREPLY[@]}" $( builtin echo $famdir/!(*.rpmsave|*.rpmorig|*~)) )
422 COMPREPLY=( $( compgen -W '${COMPREPLY[@]#@($sysvdir|$famdir)/}' -- $cur ) )
425 # This function complete on modules
430 modpath=/lib/modules/$1
431 COMPREPLY=( $( command ls -R $modpath | \
432 sed -ne 's/^\('$cur'.*\)\.k\?o\(\|.gz\)$/\1/p') )
435 # this function complete on user:group format
441 if [[ $cur = *@(\\:|.)* ]] && [ -n "$bash205" ]; then
442 user=${cur%%*([^:.])}
443 COMPREPLY=( $(compgen -P ${user/\\\\} -g -- ${cur##*[.:]}) )
444 elif [[ $cur = *:* ]] && [ -n "$bash205" ]; then
445 COMPREPLY=( $( compgen -g -- ${cur##*[.:]} ) )
447 COMPREPLY=( $( compgen -S : -u -- $cur ) )
451 # this function count the number of mandatory args
456 for (( i=1; i < COMP_CWORD; i++ )); do
457 if [[ "${COMP_WORDS[i]}" != -* ]]; then
463 # start of section containing completion functions for bash built-ins
465 # bash alias completion
472 cur=${COMP_WORDS[$COMP_CWORD]}
476 COMPREPLY=( $( compgen -A alias -S '=' -- $cur ) )
479 COMPREPLY=( "$( alias ${cur%=} 2>/dev/null | \
480 sed -e 's|^alias '$cur'\(.*\)$|\1|' )" )
484 complete -F _alias $nospace alias
486 # bash export completion
493 cur=${COMP_WORDS[$COMP_CWORD]}
497 COMPREPLY=( $( compgen -v -P '$' -- ${cur#*=\$} ) )
500 COMPREPLY=( $( compgen -v -S '=' -- $cur ) )
503 COMPREPLY=( "$( eval echo -n \"$`echo ${cur%=}`\" |
505 sed -e 's/'\''/'\''\\\'\'''\''/g'
510 complete -F _export $default $nospace export
512 # bash shell function completion
520 prev=${COMP_WORDS[COMP_CWORD-1]}
522 if [[ $1 == @(declare|typeset) ]]; then
523 if [ "$prev" = -f ]; then
524 COMPREPLY=( $( compgen -A function -- $cur ) )
525 elif [[ "$cur" == -* ]]; then
526 COMPREPLY=( $( compgen -W '-a -f -F -i -r -x -p' -- \
529 elif [ $COMP_CWORD -eq 1 ]; then
530 COMPREPLY=( $( compgen -A function -- $cur ) )
532 COMPREPLY=( "() $( type -- ${COMP_WORDS[1]} | sed -e 1,2d )" )
535 complete -F _function function declare typeset
537 # bash complete completion
541 local cur prev options
545 prev=${COMP_WORDS[COMP_CWORD-1]}
549 options="default dirnames filenames"
550 [ -n "$bash205b" ] && options="$options nospace"
551 [ -n "$bash3" ] && options="$options bashdefault plusdirs"
552 COMPREPLY=( $( compgen -W "$options" -- $cur ) )
557 COMPREPLY=( $( compgen -W 'alias arrayvar binding \
558 builtin command directory disabled enabled \
559 export file function group helptopic hostname \
560 job keyword running service setopt shopt \
561 signal stopped user variable' -- $cur ) )
566 COMPREPLY=( $( compgen -A command -- $cur ) )
570 COMPREPLY=( $( compgen -A function -- $cur ) )
574 COMPREPLY=( $( complete -p | sed -e 's|.* ||' | \
581 if [[ "$cur" == -* ]]; then
582 # relevant options completion
583 options="-a -b -c -d -e -f -g -j -k -s -v -u -A -G -W -P -S -X -F -C"
584 [ -n "$bash205" ] && options="$options -o"
585 COMPREPLY=( $( compgen -W "$options" -- $cur ) )
587 COMPREPLY=( $( compgen -A command -- $cur ) )
590 complete -F _complete complete
592 # start of section containing completion functions for external programs
594 # a little help for FreeBSD ports users
595 [ $UNAME = FreeBSD ] && complete -W 'index search fetch fetch-list \
596 extract patch configure build install reinstall \
597 deinstall clean clean-depends kernel buildworld' make
599 # This completes on a list of all available service scripts for the
600 # 'service' command and/or the SysV init.d directory, followed by
601 # that script's available commands
603 { have service || [ -d /etc/init.d/ ]; } &&
609 prev=${COMP_WORDS[COMP_CWORD-1]}
612 # don't complete for things like killall, ssh and mysql if it's
613 # the standalone command, rather than the init script
614 [[ ${COMP_WORDS[0]} != @(*init.d/!(functions|~)|service) ]] && return 0
616 # don't complete past 2nd token
617 [ $COMP_CWORD -gt 2 ] && return 0
619 [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \
620 || sysvdir=/etc/init.d
622 if [[ $COMP_CWORD -eq 1 ]] && [[ $prev == "service" ]]; then
625 COMPREPLY=( $( compgen -W '`sed -ne "y/|/ /; \
626 s/^.*Usage.*{\(.*\)}.*$/\1/p" \
627 $sysvdir/${prev##*/} 2>/dev/null`' -- $cur ) )
632 complete -F _service service
633 [ -d /etc/init.d/ ] && complete -F _service $default \
634 $(for i in /etc/init.d/*; do echo ${i##*/}; done)
636 # chown(1) completion
644 if [[ "$cur" == -* ]]; then
645 COMPREPLY=( $( compgen -W '-c -h -f -R -v --changes \
646 --dereference --no-dereference --from= --silent --quiet \
647 --reference= --recursive --verbose --help --version' -- $cur ) )
661 complete -F _chown $filenames chown
663 # chgrp(1) completion
672 prev=${COMP_WORDS[COMP_CWORD-1]}
675 if [[ "$cur" == -* ]]; then
676 COMPREPLY=( $( compgen -W '-c -h -f -R -v --changes \
677 --dereference --no-dereference --silent --quiet \
678 --reference= --recursive --verbose --help --version' -- $cur ) )
682 # first parameter on line or first since an option?
683 if [ $COMP_CWORD -eq 1 ] && [[ "$cur" != -* ]] || \
684 [[ "$prev" == -* ]] && [ -n "$bash205" ]; then
686 COMPREPLY=( $( compgen -g $cur 2>/dev/null ) )
693 complete -F _chgrp $filenames chgrp
695 # umount(8) completion. This relies on the mount point being the third
696 # space-delimited field in the output of mount(8)
707 COMPREPLY=( $( compgen -W '$( mount | cut -d" " -f 3 )' -- $cur ) )
712 complete -F _umount $dirnames umount
714 # mount(8) completion. This will pull a list of possible mounts out of
715 # /etc/{,v}fstab, unless the word being completed contains a ':', which
716 # would indicate the specification of an NFS server. In that case, we
717 # query the server for a list of all available exports and complete on
721 { local cur i sm host
725 [[ "$cur" == \\ ]] && cur="/"
727 for i in {,/usr}/{,s}bin/showmount; do [ -x $i ] && sm=$i && break; done
729 if [ -n "$sm" ] && [[ "$cur" == *:* ]]; then
730 COMPREPLY=( $( $sm -e ${cur%%:*} | sed 1d | \
731 grep ^${cur#*:} | awk '{print $1}' ) )
732 elif [[ "$cur" == //* ]]; then
735 if [ -n "$host" ]; then
736 COMPREPLY=( $( compgen -W "$( echo $( smbclient -d 0 -NL $host 2>/dev/null|
737 sed -ne '/^['"$'\t '"']*Sharename/,/^$/p' |
738 sed -ne '3,$s|^[^A-Za-z]*\([^'"$'\t '"']*\).*$|//'$host'/\1|p' ) )" -- "$cur" ) )
740 elif [ -r /etc/vfstab ]; then
742 COMPREPLY=( $( awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' \
743 /etc/vfstab | grep "^$cur" ) )
744 elif [ ! -e /etc/fstab ]; then
746 COMPREPLY=( $( mount | awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' \
750 COMPREPLY=( $( awk '! /^[ \t]*#/ {if ($2 ~ /\//) print $2}' \
751 /etc/fstab | grep "^$cur" ) )
756 complete -F _mount $default $filenames mount
758 # Linux rmmod(8) completion. This completes on a list of all currently
759 # installed kernel modules.
769 COMPREPLY=( $( /sbin/lsmod | \
770 awk '{if (NR != 1 && $1 ~ /^'$cur'/) print $1}' 2>/dev/null ))
773 complete -F _rmmod rmmod
775 # Linux insmod(8), modprobe(8) and modinfo(8) completion. This completes on a
776 # list of all available modules for the version of the kernel currently
781 local cur prev modpath
785 prev=${COMP_WORDS[COMP_CWORD-1]}
787 # behave like lsmod for modprobe -r
788 if [ $1 = "modprobe" ] &&
789 [ "${COMP_WORDS[1]}" = "-r" ]; then
790 COMPREPLY=( $( /sbin/lsmod | \
791 awk '{if (NR != 1 && $1 ~ /^'$cur'/) print $1}' ) )
795 # do filename completion if we're giving a path to a module
796 if [[ "$cur" == */* ]]; then
797 _filedir '@(?(k)o?(.gz))'
801 if [ $COMP_CWORD -gt 1 ] &&
802 [[ "${COMP_WORDS[COMP_CWORD-1]}" != -* ]]; then
803 # do module parameter completion
804 COMPREPLY=( $( /sbin/modinfo -p ${COMP_WORDS[1]} 2>/dev/null | \
805 awk '{if ($1 ~ /^parm:/ && $2 ~ /^'$cur'/) { print $2 } \
806 else if ($1 !~ /:/ && $1 ~ /^'$cur'/) { print $1 }}' ) )
813 complete -F _insmod $filenames insmod modprobe modinfo
818 [ $UNAME = GNU -o $UNAME = Linux -o $UNAME = Darwin \
819 -o $UNAME = FreeBSD -o $UNAME = SunOS -o $UNAME = Cygwin \
820 -o $UNAME = OpenBSD ] &&
823 local cur prev sect manpath UNAME
827 prev=${COMP_WORDS[COMP_CWORD-1]}
831 # default completion if parameter contains /
832 if [[ "$cur" == */* ]]; then
838 # strip OS type and version under Cygwin
839 UNAME=${UNAME/CYGWIN_*/Cygwin}
840 if [ $UNAME = GNU -o $UNAME = Linux -o $UNAME = FreeBSD \
841 -o $UNAME = Cygwin ]; then
842 manpath=$( manpath 2>/dev/null || command man --path )
847 if [ -z "$manpath" ]; then
848 COMPREPLY=( $( compgen -c -- $cur ) )
852 # determine manual section to search
853 [[ "$prev" == [0-9ln] ]] && sect=$prev || sect='*'
856 if [ -n "$cur" ]; then
857 manpath="${manpath//://*man$sect/$cur* } ${manpath//://*cat$sect/$cur* }"
859 manpath="${manpath//://*man$sect/ } ${manpath//://*cat$sect/ }"
862 # redirect stderr for when path doesn't exist
863 COMPREPLY=( $( eval command ls "$manpath" 2>/dev/null ) )
864 # weed out directory path names and paths to man pages
865 COMPREPLY=( ${COMPREPLY[@]##*/?(:)} )
866 # strip suffix from man pages
867 COMPREPLY=( ${COMPREPLY[@]%.@(gz|bz2)} )
868 COMPREPLY=( $( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" ) )
870 [[ "$prev" != [0-9ln] ]] && _filedir '[0-9ln]'
874 [ $UNAME = GNU -o $UNAME = Linux -o $UNAME = Darwin \
875 -o $UNAME = FreeBSD -o $UNAME = SunOS -o $UNAME = Cygwin \
876 -o $UNAME = OpenBSD ] && \
877 complete -F _man $filenames man apropos whatis
879 # renice(8) completion
883 local command cur curopt i
890 # walk back through command line and find last option
891 while [ $i -le $COMP_CWORD -a ${#COMPREPLY[@]} -eq 0 ]; do
892 curopt=${COMP_WORDS[COMP_CWORD-$i]}
895 COMPREPLY=( $( compgen -u -- $cur ) )
907 complete -F _renice renice
918 if [ $COMP_CWORD -eq 1 ] && [[ "$cur" == -* ]]; then
919 # return list of available signals
922 # return list of available PIDs
926 complete -F _kill kill
928 # Linux and FreeBSD killall(1) completion.
930 [ $UNAME = Linux -o $UNAME = FreeBSD ] &&
938 if [ $COMP_CWORD -eq 1 ] && [[ "$cur" == -* ]]; then
941 COMPREPLY=( $( compgen -W '$( command ps axo command | \
942 sed -ne "1d; s/^\[\?\([^-][^] ]*\).*$/\1/p" | \
943 sed -e "s/.*\///" )' -- $cur ) )
948 [ $UNAME = Linux -o $UNAME = FreeBSD ] && complete -F _killall killall pkill
950 # Linux and FreeBSD pgrep(1) completion.
952 [ $UNAME = Linux -o $UNAME = FreeBSD ] &&
960 COMPREPLY=( $( compgen -W '$( command ps axo command | \
961 sed -ne "1d; s/^\[\?\([^-][^] ]*\).*$/\1/p" | \
962 sed -e "s/.*\///" )' -- $cur ) )
966 [ $UNAME = Linux -o $UNAME = FreeBSD ] && complete -F _pgrep pgrep
967 # Linux pidof(8) completion.
968 [ $UNAME = Linux ] && complete -F _pgrep pidof
970 # GNU find(1) completion. This makes heavy use of ksh style extended
971 # globs and contains Linux specific code for completing the parameter
972 # to the -fstype option.
976 local cur prev i exprfound onlyonce
980 prev=${COMP_WORDS[COMP_CWORD-1]}
984 COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9' -- $cur ) )
987 -?(a|c)newer|-fls|-fprint?(0|f)|-?(i)?(l)name|-?(i)wholename)
992 # this is highly non-portable
993 [ -e /proc/filesystems ] &&
994 COMPREPLY=( $( cut -d$'\t' -f 2 /proc/filesystems | \
1003 if [ -n "$bash205" ]; then
1004 COMPREPLY=( $( compgen -g -- $cur 2>/dev/null) )
1009 COMPREPLY=( $( compgen -W 'b c d p f l s' -- $cur ) )
1017 COMPREPLY=( $( compgen -u -- $cur ) )
1021 COMP_WORDS=(COMP_WORDS[0] $cur)
1026 -[acm]min|-[acm]time|-?(i)?(l)name|-inum|-?(i)path|-?(i)regex| \
1027 -links|-perm|-size|-used|-printf)
1028 # do nothing, just wait for a parameter to be given
1035 # set exprfound to 1 if there is already an expression present
1036 for i in ${COMP_WORDS[@]}; do
1037 [[ "$i" = [-\(\),\!]* ]] && exprfound=1 && break
1040 # handle case where first parameter is not a dash option
1041 if [ "$exprfound" != 1 ] && [[ "$cur" != [-\(\),\!]* ]]; then
1046 # complete using basic options
1047 COMPREPLY=( $( compgen -W '-daystart -depth -follow -help -maxdepth \
1048 -mindepth -mount -noleaf -version -xdev -amin -anewer \
1049 -atime -cmin -cnewer -ctime -empty -false -fstype \
1050 -gid -group -ilname -iname -inum -ipath -iregex \
1052 -links -lname -mmin -mtime -name -newer -nouser \
1053 -nogroup -perm -regex -size -true -type -uid -used \
1054 -user -xtype -exec -fls -fprint -fprint0 -fprintf -ok \
1055 -print -print0 -printf -prune -ls' -- $cur ) )
1057 # this removes any options from the list of completions that have
1058 # already been specified somewhere on the command line, as long as
1059 # these options can only be used once (in a word, "options", in
1060 # opposition to "tests" and "actions", as in the find(1) manpage).
1061 onlyonce=' -daystart -depth -follow -help -maxdepth -mindepth -mount \
1062 -noleaf -version -xdev '
1063 COMPREPLY=( $( echo "${COMP_WORDS[@]}" | \
1064 (while read -d ' ' i; do
1066 [ "${onlyonce/ ${i%% *} / }" == "$onlyonce" ] &&
1068 # flatten array with spaces on either side,
1069 # otherwise we cannot grep on word boundaries of
1070 # first and last word
1071 COMPREPLY=" ${COMPREPLY[@]} "
1072 # remove word from list of completions
1073 COMPREPLY=( ${COMPREPLY/ ${i%% *} / } )
1075 echo "${COMPREPLY[@]}")
1082 complete -F _find $filenames find
1084 # Linux iwconfig(8) completion
1086 [ $UNAME = Linux ] && have iwconfig &&
1093 prev=${COMP_WORDS[COMP_CWORD-1]}
1097 COMPREPLY=( $( compgen -W 'managed ad-hoc master \
1098 repeater secondary monitor' -- $cur ) )
1102 COMPREPLY=( $( compgen -W 'on off any' -- $cur ) )
1103 if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
1104 COMPREPLY=( "${COMPREPLY[@]}" \
1105 $( iwlist ${COMP_WORDS[1]} scan | \
1106 awk -F '"' '/ESSID/ {print $2}' | \
1112 COMPREPLY=( $( compgen -W 'on off' -- $cur ) )
1116 COMPREPLY=( $( iwlist ${COMP_WORDS[1]} channel | \
1117 awk '/^[[:space:]]*Channel/ {print $2}' | \
1123 COMPREPLY=( $( iwlist ${COMP_WORDS[1]} channel | \
1124 awk '/^[[:space:]]*Channel/ {print $4"G"}' | \
1129 COMPREPLY=( $( compgen -W 'on off any' -- $cur ) )
1130 if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
1131 COMPREPLY=( "${COMPREPLY[@]}" \
1132 $( iwlist ${COMP_WORDS[1]} scan | \
1133 awk -F ': ' '/Address/ {print $2}' | \
1139 COMPREPLY=( $( compgen -W 'auto fixed' -- $cur ) )
1140 COMPREPLY=( "${COMPREPLY[@]}" \
1141 $( iwlist ${COMP_WORDS[1]} rate | \
1142 awk '/^[[:space:]]*[0-9]/ {print $1"M"}' | \
1147 COMPREPLY=( $( compgen -W 'auto fixed off' -- $cur ) )
1151 COMPREPLY=( $( compgen -W 'auto fixed off' -- $cur ) )
1155 COMPREPLY=( $( compgen -W 'off on open restricted' -- $cur ) )
1159 COMPREPLY=( $( compgen -W 'off on open restricted' -- $cur ) )
1163 COMPREPLY=( $( compgen -W 'period timeout off on' -- $cur ) )
1167 COMPREPLY=( $( compgen -W 'off on auto' -- $cur ) )
1171 COMPREPLY=( $( compgen -W 'limit lifetime' -- $cur ) )
1176 if [ $COMP_CWORD -eq 1 ]; then
1177 if [[ "$cur" == -* ]]; then
1178 COMPREPLY=( $( compgen -W '--help --version' -- $cur ) )
1180 _available_interfaces -w
1183 COMPREPLY=( $( compgen -W 'essid nwid mode freq channel sens mode \
1184 ap nick rate rts frag enc key power txpower commit' -- $cur ) )
1188 complete -F _iwconfig iwconfig
1190 # Linux iwlist(8) completion
1192 [ $UNAME = Linux ] && have iwlist &&
1199 prev=${COMP_WORDS[COMP_CWORD-1]}
1201 if [ $COMP_CWORD -eq 1 ]; then
1202 if [[ "$cur" == -* ]]; then
1203 COMPREPLY=( $( compgen -W '--help --version' -- $cur ) )
1205 _available_interfaces -w
1208 COMPREPLY=( $( compgen -W 'scan scanning freq frequency \
1209 channel rate bit bitrate key enc encryption power \
1210 txpower retry ap accesspoint peers event' -- $cur ) )
1213 complete -F _iwlist iwlist
1215 # Linux iwspy(8) completion
1217 [ $UNAME = Linux ] && have iwspy &&
1225 if [ $COMP_CWORD -eq 1 ]; then
1226 if [[ "$cur" == -* ]]; then
1227 COMPREPLY=( $( compgen -W '--help --version' -- $cur ) )
1229 _available_interfaces -w
1232 COMPREPLY=( $( compgen -W 'setthr getthr off' -- $cur ) )
1235 complete -F _iwspy iwspy
1237 # Linux iwpriv(8) completion
1239 [ $UNAME = Linux ] && have iwpriv &&
1246 prev=${COMP_WORDS[COMP_CWORD-1]}
1250 COMPREPLY=( $( compgen -W 'on off' -- $cur ) )
1254 COMPREPLY=( $( compgen -W 'ad-hoc managed' -- $cur ) )
1259 if [ $COMP_CWORD -eq 1 ]; then
1260 if [[ "$cur" == -* ]]; then
1261 COMPREPLY=( $( compgen -W '--help --version' -- $cur ) )
1263 _available_interfaces -w
1266 COMPREPLY=( $( compgen -W '--all roam port' -- $cur ) )
1269 complete -F _iwpriv iwpriv
1271 # RedHat & Debian GNU/Linux if{up,down} completion
1273 [ $UNAME = Linux ] && { have ifup || have ifdown; } &&
1281 if [ $COMP_CWORD -eq 1 ]; then
1282 _configured_interfaces
1283 COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- "$cur") )
1288 complete -F _ifupdown ifup ifdown
1289 [ $UNAME = Linux ] && have ifstatus && complete -F _ifupdown ifstatus
1291 # Linux ipsec(8) completion (for FreeS/WAN)
1293 [ $UNAME = Linux ] && have ipsec &&
1302 if [ $COMP_CWORD -eq 1 ]; then
1303 COMPREPLY=( $( compgen -W 'auto barf eroute klipsdebug look \
1304 manual pluto ranbits rsasigkey \
1305 setup showdefaults showhostkey spi \
1306 spigrp tncfg whack' -- $cur ) )
1310 case ${COMP_WORDS[1]} in
1312 COMPREPLY=( $( compgen -W '--asynchronous --up --add --delete \
1313 --replace --down --route --unroute \
1314 --ready --status --rereadsecrets' \
1318 COMPREPLY=( $( compgen -W '--up --down --route --unroute \
1319 --union' -- $cur ) )
1322 COMPREPLY=( $( compgen -W '--quick --continuous --bytes' \
1326 COMPREPLY=( $( compgen -W '--start --stop --restart' -- $cur ) )
1335 complete -F _ipsec ipsec
1337 # Postfix completion.
1347 prev=${COMP_WORDS[COMP_CWORD-1]}
1349 if [[ $cur == '-' ]]; then
1350 COMPREPLY=(-c -D -v)
1353 if [[ $prev == '-c' ]]; then
1357 if [[ $prev == '-D' ]]; then
1358 COMPREPLY=( $( compgen -W 'start' -- "`get_cword`" ) )
1361 COMPREPLY=( $( compgen -W 'start stop reload abort flush check' -- \
1364 complete -F _postfix postfix
1366 # postalias(1) and postmap(1)
1370 local cur prev len idx
1373 prev=${COMP_WORDS[COMP_CWORD-1]}
1375 if [[ $cur == '-' ]]; then
1376 COMPREPLY=(-N -f -i -n -o -p -r -v -w -c -d -q)
1379 if [[ $prev == '-c' ]]; then
1383 if [[ $prev == -[dq] ]]; then
1387 if [[ "$cur" == *:* ]]; then
1388 COMPREPLY=( $( compgen -f -- ${cur#*:} ) )
1392 for pval in $( /usr/sbin/postconf -m ); do
1393 if [[ "$cur" == "${pval:0:$len}" ]]; then
1394 COMPREPLY[$idx]="$pval:"
1398 if [[ $idx -eq 0 ]]; then
1399 COMPREPLY=( $( compgen -f -- "$cur" ) )
1404 complete -F _postmap postmap postalias
1410 local cur prev pval len idx qfile
1413 prev=${COMP_WORDS[COMP_CWORD-1]}
1415 if [[ $cur == '-' ]]; then
1416 COMPREPLY=(-c -q -v)
1419 if [[ $prev == '-c' ]]; then
1425 for idx in "${COMP_WORDS[@]}"; do
1426 [[ "$idx" = -q ]] && qfile=1 && break
1428 if [[ $qfile == 1 ]]; then
1431 for pval in $( mailq | \
1432 sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* !].*$//' ); do
1433 if [[ "$cur" == "${pval:0:$len}" ]]; then
1434 COMPREPLY[$idx]=$pval
1444 complete -F _postcat postcat
1450 local cur prev pval len idx eqext
1453 prev=${COMP_WORDS[COMP_CWORD-1]}
1454 if [[ $cur == '-' ]]; then
1455 COMPREPLY=(-c -d -e -h -m -l -n -v)
1458 if [[ $prev == '-c' ]]; then
1462 if [[ $prev == '-e' ]]; then
1468 for pval in $( /usr/sbin/postconf | cut -d ' ' -f 1 ); do
1469 if [[ "$cur" == "${pval:0:$len}" ]]; then
1470 COMPREPLY[$idx]="$pval$eqext"
1476 complete -F _postconf postconf
1482 local cur prev pval len idx
1485 prev=${COMP_WORDS[COMP_CWORD-1]}
1487 if [[ $cur == '-' ]]; then
1488 COMPREPLY=(-c -d -h -H -p -r -s -v)
1495 for pval in $( echo ALL; mailq | \
1496 sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* !].*$//' ); do
1497 if [[ "$cur" == "${pval:0:$len}" ]]; then
1498 COMPREPLY[$idx]=$pval
1507 for pval in $( echo ALL; mailq | \
1508 sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* ].*$//; /!$/d' ); do
1509 if [[ "$cur" == "${pval:0:$len}" ]]; then
1510 COMPREPLY[$idx]=$pval
1519 for pval in $( echo ALL; mailq | \
1520 sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; /^[0-9A-Z]*[* ]/d; s/!.*$//' ); do
1521 if [[ "$cur" == "${pval:0:$len}" ]]; then
1522 COMPREPLY[$idx]=$pval
1529 COMPREPLY=( $( compgen -W 'hold incoming active deferred' -- $cur ) )
1532 complete -F _postsuper postsuper
1540 [ -z ${prefix:-} ] || prefix=${cur%/*}/
1541 [ -r ${prefix:-}CVS/Entries ] || prefix=""
1547 [ -r ${prefix:-}CVS/Entries ] && \
1548 entries=$(cut -d/ -f2 -s ${prefix:-}CVS/Entries)
1553 if [ -n "$prefix" ]; then
1554 COMPREPLY=( $( command ls -d ${cvsroot}/${prefix}/!(CVSROOT) ) )
1556 COMPREPLY=( $( command ls -d ${cvsroot}/!(CVSROOT) ) )
1562 local cur count mode i cvsroot cvsroots pwd
1563 local -a flags miss files entries changed newremoved
1569 for i in "${COMP_WORDS[@]}"; do
1570 [ $count -eq $COMP_CWORD ] && break
1571 # Last parameter was the CVSROOT, now go back to mode selection
1572 if [ "${COMP_WORDS[((count))]}" == "$cvsroot" -a "$mode" == "cvsroot" ]; then
1575 if [ -z "$mode" ]; then
1579 cvsroot=${COMP_WORDS[((count+1))]}
1620 @(remove|rm|delete))
1638 elif [[ "$i" = -* ]]; then
1639 flags=( "${flags[@]}" $i )
1646 if [[ "$cur" != -* ]]; then
1648 if [ $COMP_CWORD -gt 1 -a -r ${prefix:-}CVS/Entries ]; then
1651 files=$( command ls -Ad !(CVS) ) || \
1652 files=$( command ls -d ${cur}* 2>/dev/null )
1653 for i in "${entries[@]}"; do
1654 files=( ${files[@]/#$i//} )
1656 COMPREPLY=( $( compgen -W '${files[@]}' -- \
1660 COMPREPLY=( $( compgen -W '-k -m' -- $cur ) )
1664 if [[ "$cur" = -* ]]; then
1665 COMPREPLY=( $( compgen -W '-i -a -A -e -b -c -k -l -u \
1666 -L -U -m -M -n -N -o -q -I \
1667 -s -t -t- -T -V -x -z' -- \
1672 if [[ "$cur" = -* ]]; then
1673 COMPREPLY=( $( compgen -W '-D -F -f -l -R -r' -- $cur ) )
1676 COMPREPLY=( $( compgen -W '${entries[@]}' -- $cur ) )
1680 if [[ "$cur" != -* ]]; then
1681 [ -z "$cvsroot" ] && cvsroot=$CVSROOT
1682 COMPREPLY=( $( cvs -d "$cvsroot" co -c 2> /dev/null | \
1683 awk '{print $1}' ) )
1684 COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- $cur ) )
1686 COMPREPLY=( $( compgen -W '-A -N -P -R -c -f -l -n -p \
1687 -s -r -D -d -k -j' -- $cur ) )
1693 if [[ "$cur" != -* ]] && [ -r ${prefix:-}CVS/Entries ]; then
1694 # if $COMP_CVS_REMOTE is not null, 'cvs commit' will
1695 # complete on remotely checked-out files (requires
1696 # passwordless access to the remote repository
1697 if [ -n "${COMP_CVS_REMOTE:-}" ]; then
1698 # this is the least computationally intensive
1699 # way found so far, but other changes
1700 # (something other than changed/removed/new)
1702 changed=( $( cvs -q diff --brief 2>&1 | \
1703 sed -ne 's/^Files [^ ]* and \([^ ]*\) differ$/\1/p' ) )
1704 newremoved=( $( cvs -q diff --brief 2>&1 | \
1705 sed -ne 's/^cvs diff: \([^ ]*\) .*, no comparison available$/\1/p' ) )
1706 COMPREPLY=( $( compgen -W '${changed[@]:-} \
1707 ${newremoved[@]:-}' -- $cur ) )
1712 COMPREPLY=( $( compgen -W '-n -R -l -f -F -m -r' -- \
1717 if [ -r ~/.cvspass ]; then
1718 # Ugly escaping because of bash treating ':' specially
1719 cvsroots=$( sed 's/^[^ ]* //; s/:/\\:/g' ~/.cvspass )
1720 COMPREPLY=( $( compgen -W '$cvsroots' -- $cur ) )
1724 if [[ "$cur" != -* ]]; then
1725 [ -z "$cvsroot" ] && cvsroot=$CVSROOT
1726 COMPREPLY=( $( cvs -d "$cvsroot" co -c | awk '{print $1}' ) )
1727 COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- $cur ) )
1729 COMPREPLY=( $( compgen -W '-N -f -l -R -n \
1730 -r -D -d -k' -- $cur ) )
1734 if [[ "$cur" == -* ]]; then
1738 COMPREPLY=( $( compgen -W '${entries[@]:-}' -- $cur ) )
1742 if [[ "$cur" != -* ]]; then
1744 if [ $COMP_CWORD -gt 1 -a -r ${prefix:-}CVS/Entries ]; then
1746 # find out what files are missing
1747 for i in "${entries[@]}"; do
1748 [ ! -r "$i" ] && miss=( "${miss[@]}" $i )
1750 COMPREPLY=( $(compgen -W '${miss[@]:-}' -- $cur) )
1753 COMPREPLY=( $( compgen -W '-f -l -R' -- $cur ) )
1757 if [[ "$cur" != -* ]]; then
1758 # starts with same algorithm as checkout
1759 [ -z "$cvsroot" ] && cvsroot=$CVSROOT
1761 if [ -r ${cvsroot}/${prefix} ]; then
1763 COMPREPLY=( ${COMPREPLY[@]#$cvsroot} )
1764 COMPREPLY=( ${COMPREPLY[@]#\/} )
1768 COMPREPLY=( $( compgen -W '${COMPREPLY[@]} $pwd' -- \
1771 COMPREPLY=( $( compgen -W '-d -k -I -b -m -W' -- $cur ))
1775 if [[ "$cur" = -* ]]; then
1776 COMPREPLY=( $( compgen -W '-A -P -C -d -f -l -R -p \
1777 -k -r -D -j -I -W' -- \
1782 COMPREPLY=( $( compgen -W 'add admin annotate checkout ci co \
1783 commit diff delete edit export \
1784 freeze get history import log new \
1785 patch rcs rdiff release remove \
1786 rfreeze rlog rm rtag stat status \
1787 tag unedit up update -H -Q -q -b \
1788 -d -e -f -l -n -t -r -v -w -x -z \
1789 --help --version' -- $cur ) )
1797 complete -F _cvs $default cvs
1801 # helper functions for rpm completion
1803 _rpm_installed_packages()
1805 local ver nodig nosig
1807 if [ -r /var/log/rpmpkgs -a \
1808 /var/log/rpmpkgs -nt /var/lib/rpm/Packages ]; then
1809 # using RHL 7.2 or later - this is quicker than querying the DB
1810 COMPREPLY=( $( sed -ne \
1811 's|^\('$cur'.*\)-[0-9a-zA-Z._]\+-[0-9a-z.@]\+.*\.rpm$|\1|p' \
1812 /var/log/rpmpkgs ) )
1816 ver=$(rpm --version)
1819 if [[ "$ver" > "4.0.4" ]]; then
1822 if [[ "$ver" > "4.0.99" ]]; then
1823 nosig="--nosignature"
1826 COMPREPLY=( $( rpm -qa $nodig $nosig | sed -ne \
1827 's|^\('$cur'.*\)-[0-9a-zA-Z._]\+-[0-9a-z.@]\+$|\1|p' ) )
1834 # remove trailing backslash, or grep will complain
1836 COMPREPLY=( $( rpm -qa $nodig $nosig --queryformat '%{group}\n' | \
1838 # backslash escape spaces and translate newlines to tabs
1839 COMPREPLY=( $( echo "${COMPREPLY[@]}" | sed 's/ /\\ /g' | tr '\n' '\t' ) )
1846 local cur prev ver nodig nosig
1850 prev=${COMP_WORDS[COMP_CWORD-1]}
1853 ver=$(rpm --version); ver=${ver##* }
1855 if [[ "$ver" > "4.0.4" ]]; then
1858 if [[ "$ver" > "4.0.99" ]]; then
1859 nosig="--nosignature"
1862 if [ $COMP_CWORD -eq 1 ]; then
1863 # first parameter on line
1866 COMPREPLY=( $( compgen -W '-ba -bb -bc -bi -bl -bp -bs'\
1870 COMPREPLY=( $( compgen -W '-ta -tb -tc -ti -tl -tp -ts'\
1874 COMPREPLY=( $( compgen -W '--help --version --initdb \
1875 --checksig --recompile --rebuild --resign --addsign \
1876 --rebuilddb --showrc --setperms --setugids --tarbuild \
1877 --eval --install --upgrade --query --freshen --erase \
1878 --verify --querytags --rmsource --rmspec --clean \
1879 --import' -- $cur ) )
1882 COMPREPLY=( $( compgen -W '-b -e -F -i -q -t -U -V' \
1891 --@(@(db|exclude)path|prefix|relocate|root))
1896 # get a list of macros
1897 COMPREPLY=( $( sed -ne 's|^\(%'${cur#\%}'[^ '$'\t'']*\).*$|\1|p' \
1898 /usr/lib/rpm/macros ) )
1902 COMPREPLY=( $( compgen -c -- $cur ) )
1910 # complete on .spec files
1915 if [[ "$cur" == */* ]]; then
1918 # complete on capabilities
1919 COMPREPLY=( $( rpm -qa $nodig $nosig --queryformat \
1920 '%{providename}\n' | grep "^$cur" ) )
1925 # complete on capabilities
1926 COMPREPLY=( $( rpm -qa $nodig $nosig --queryformat \
1927 '%{requirename}\n' | grep "^$cur" ) )
1932 case "${COMP_WORDS[1]}" in
1933 -@([iFU]*|-install|-freshen|-upgrade))
1934 if [[ "$cur" == -* ]]; then
1935 COMPREPLY=( $( compgen -W '--percent --force --test \
1936 --replacepkgs --replacefiles --root --excludedocs \
1937 --includedocs --noscripts --rcfile --ignorearch \
1938 --dbpath --prefix --ignoreos --nodeps --allfiles \
1939 --ftpproxy --ftpport --justdb --httpproxy --httpport \
1940 --noorder --relocate --badreloc --notriggers \
1941 --excludepath --ignoresize --oldpackage --define \
1942 --eval --pipe --queryformat --repackage --nosuggests \
1943 --nodigest --nosignature' -- $cur ) )
1949 if [[ "$cur" == -* ]]; then
1950 COMPREPLY=( $( compgen -W '--allmatches --noscripts \
1951 --notriggers --nodeps --test --repackage' -- $cur ) )
1953 _rpm_installed_packages
1957 # check whether we're doing file completion
1958 if [ "${COMP_LINE#* -*([^ -])f}" != "$COMP_LINE" ]; then
1959 if [[ "$cur" == -* ]]; then
1960 COMPREPLY=( $( compgen -W '--scripts --root \
1961 --rcfile --requires --ftpport --ftpproxy \
1962 --httpproxy --httpport --provides --triggers \
1963 --dump --changelog --dbpath \
1964 --last --filesbypkg \
1965 --info --list --state \
1966 --docfiles --configfiles --queryformat \
1967 --conflicts --obsoletes \
1968 --nodigest --nosignature \
1969 --triggerscripts' -- $cur ) )
1973 elif [ "${COMP_LINE#* -*([^ -])g}" != "$COMP_LINE" ]; then
1975 elif [ "${COMP_LINE#* -*([^ -])p}" != "$COMP_LINE" ]; then
1976 # uninstalled package completion
1977 if [[ "$cur" == -* ]]; then
1978 COMPREPLY=( $( compgen -W '--scripts --root \
1979 --rcfile --whatprovides --whatrequires \
1980 --requires --triggeredby --ftpport --ftpproxy \
1981 --httpproxy --httpport --provides --triggers \
1982 --dump --changelog --dbpath --filesbypkg \
1983 --define --eval --pipe --showrc --info --list \
1984 --state --docfiles --configfiles --queryformat\
1985 --conflicts --obsoletes --nodigest \
1986 --nosignature' -- $cur ) )
1991 # installed package completion
1992 if [[ "$cur" == -* ]]; then
1993 COMPREPLY=( $( compgen -W '--scripts --root \
1994 --rcfile --whatprovides --whatrequires \
1995 --requires --triggeredby --ftpport --ftpproxy \
1996 --httpproxy --httpport --provides --triggers \
1997 --dump --changelog --dbpath --specfile \
1998 --querybynumber --last --filesbypkg --define \
1999 --eval --pipe --showrc --info --list --state \
2000 --docfiles --configfiles --queryformat \
2001 --conflicts --obsoletes --pkgid --hdrid \
2002 --fileid --tid --nodigest --nosignature \
2003 --triggerscripts' -- $cur ) )
2004 elif [ "${COMP_LINE#* -*([^ -])a}" == "$COMP_LINE" ]; then
2005 _rpm_installed_packages
2010 if [[ "$cur" == -* ]]; then
2011 COMPREPLY=( $( compgen -W '--nopgp --nogpg --nomd5 \
2012 --nodigest --nosignature' -- $cur ) )
2018 if [[ "$cur" == -* ]]; then
2019 COMPREPLY=( $( compgen -W '--root --rcfile --dbpath \
2020 --nodeps --nogroup --nolinkto --nomode --nomtime \
2021 --nordev --nouser --nofiles --noscripts --nomd5 \
2022 --querytags --specfile --whatrequires --whatprovides \
2023 --nodigest --nosignature' -- $cur ) )
2024 # check whether we're doing file completion
2025 elif [ "${COMP_LINE#* -*([^ -])f}" != "$COMP_LINE" ]; then
2027 elif [ "${COMP_LINE#* -*([^ -])g}" != "$COMP_LINE" ]; then
2029 elif [ "${COMP_LINE#* -*([^ -])p}" != "$COMP_LINE" ]; then
2032 _rpm_installed_packages
2036 if [[ "$cur" == -* ]]; then
2037 COMPREPLY=( $( compgen -W '--short-circuit --timecheck \
2038 --clean --rmsource --rmspec --test --sign --buildroot \
2039 --target -- buildarch --buildos --nobuild --nodeps \
2040 --nodirtokens' -- $cur ) )
2041 elif [[ ${COMP_WORDS[1]} == -b* ]]; then
2044 _filedir '@(tgz|tar.@(gz|bz2))'
2047 --re@(build|compile))
2048 if [[ "$cur" == -* ]]; then
2049 COMPREPLY=( $( compgen -W '--nodeps --rmsource \
2050 --rmspec --sign --nodirtokens --target' -- $cur ) )
2052 _filedir '?(no)src.rpm'
2056 _filedir '@(tgz|tar.@(gz|bz2))'
2062 _rpm_installed_packages
2064 --@(clean|rms@(ource|pec)))
2065 if [[ "$cur" == -* ]]; then
2066 COMPREPLY=( $( compgen -W '--clean --rmsource \
2067 --rmspec' -- $cur ) )
2072 --@(import|dbpath|root))
2073 if [[ "$cur" == -* ]]; then
2074 COMPREPLY=( $( compgen -W '--import --dbpath --root' \
2084 complete -F _rpm $filenames rpm rpmbuild
2087 # Debian apt-get(8) completion.
2092 local cur prev special i
2096 prev=${COMP_WORDS[COMP_CWORD-1]}
2098 for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
2099 if [[ ${COMP_WORDS[i]} == @(install|remove|purge|source|build-dep) ]]; then
2100 special=${COMP_WORDS[i]}
2104 if [ -n "$special" ]; then
2107 if [ -f /etc/debian_version ]; then
2109 COMPREPLY=( $( _comp_dpkg_installed_packages \
2113 _rpm_installed_packages
2118 COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) )
2131 -@(t|-target-release|-default-release))
2132 COMPREPLY=( $( apt-cache policy | \
2133 grep "release.o=Debian,a=$cur" | \
2134 sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null) )
2140 if [[ "$cur" == -* ]]; then
2142 COMPREPLY=( $( compgen -W '-d -f -h -v -m -q -s -y \
2143 -u -t -b -c -o --download-only --fix-broken \
2144 --help --version --ignore-missing \
2145 --fix-missing --no-download --quiet --simulate \
2146 --just-print --dry-run --recon --no-act --yes \
2147 --assume-yes --show-upgraded --only-source \
2148 --compile --build --ignore-hold \
2149 --target-release --no-upgrade --force-yes \
2150 --print-uris --purge --reinstall \
2151 --list-cleanup --default-release \
2152 --trivial-only --no-remove --diff-only \
2153 --tar-only --config-file --option --auto-remove' -- $cur ) )
2156 COMPREPLY=( $( compgen -W 'update upgrade dselect-upgrade \
2157 dist-upgrade install remove purge source \
2158 build-dep check clean autoclean autoremove' \
2166 complete -F _apt_get $filenames apt-get
2168 # Debian apt-cache(8) completion.
2173 local cur prev special i
2177 prev=${COMP_WORDS[COMP_CWORD-1]}
2180 if [ "$cur" != show ]; then
2181 for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
2182 if [[ ${COMP_WORDS[i]} == @(add|depends|dotty|policy|rdepends|madison|show?(pkg|src|)) ]]; then
2183 special=${COMP_WORDS[i]}
2189 if [ -n "$special" ]; then
2197 COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) )
2206 -@(c|p|s|-config-file|-@(pkg|src)-cache))
2211 if [[ "$cur" != -* ]]; then
2217 if [[ "$cur" == -* ]]; then
2219 COMPREPLY=( $( compgen -W '-h -v -p -s -q -i -f -a -g -c \
2220 -o --help --version --pkg-cache --src-cache \
2221 --quiet --important --full --all-versions \
2222 --no-all-versions --generate --no-generate \
2223 --names-only --all-names --recurse \
2224 --config-file --option' -- $cur ) )
2227 COMPREPLY=( $( compgen -W 'add gencaches show showpkg showsrc \
2228 stats dump dumpavail unmet search search \
2229 depends rdepends pkgnames dotty xvcg \
2230 policy madison' -- $cur ) )
2237 complete -F _apt_cache $filenames apt-cache
2240 # Debian aptitude(1) completion
2243 have grep-status && {
2244 _comp_dpkg_hold_packages()
2246 grep-status -P -e "^$1" -a -FStatus 'hold' -n -s Package
2249 _comp_dpkg_hold_packages()
2251 grep -B 2 'hold' /var/lib/dpkg/status | grep "Package: $1" \
2258 local cur dashoptions prev special i
2262 prev=${COMP_WORDS[COMP_CWORD-1]}
2265 dashoptions='-S -u -i -h --help --version -s --simulate -d \
2266 --download-only -P --prompt -y --assume-yes -F \
2267 --display-format -O --sort -w --width -f -r -g \
2268 --with-recommends --with-suggests -R -G \
2269 --without-recommends --without-suggests -t \
2270 --target-release -V --show-versions -D --show-deps\
2271 -Z -v --verbose --purge-unused'
2273 for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
2274 if [[ ${COMP_WORDS[i]} == @(install|reinstall|hold|unhold|markauto|unmarkauto|dist-upgrade|full-upgrade|download|show|forbid-version|purge|remove|changelog|why|why-not|keep|keep-all) ]]; then
2275 special=${COMP_WORDS[i]}
2277 #exclude some mutually exclusive options
2278 [[ ${COMP_WORDS[i]} == '-u' ]] && dashoptions=${dashoptions/-i}
2279 [[ ${COMP_WORDS[i]} == '-i' ]] && dashoptions=${dashoptions/-u}
2282 if [[ -n "$special" ]]; then
2284 @(install|hold|markauto|unmarkauto|dist-upgrade|full-upgrade|download|show|changelog|why|why-not))
2285 COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) )
2288 @(purge|remove|reinstall|forbid-version))
2289 COMPREPLY=( $( _comp_dpkg_installed_packages $cur ) )
2293 COMPREPLY=( $( _comp_dpkg_hold_packages $cur ) )
2301 # don't complete anything if these options are found
2302 @(autoclean|clean|forget-new|search|upgrade|safe-upgrade|update|keep-all))
2311 -@(t|-target-release|-default-release))
2312 COMPREPLY=( $( apt-cache policy | \
2313 grep "release.o=Debian,a=$cur" | \
2314 sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null ) )
2320 if [[ "$cur" == -* ]]; then
2321 COMPREPLY=( $( compgen -W "$dashoptions" -- $cur ) )
2323 COMPREPLY=( $( compgen -W 'update upgrade safe-upgrade forget-new clean \
2324 autoclean install reinstall remove \
2325 hold unhold purge markauto unmarkauto why why-not \
2326 dist-upgrade full-upgrade download search show \
2327 forbid-version changelog keep-all' -- $cur ) )
2333 complete -F _aptitude $default aptitude
2336 # Debian apt-build(1) completion.
2341 local cur prev special i
2345 prev=${COMP_WORDS[COMP_CWORD-1]}
2347 for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
2348 if [[ ${COMP_WORDS[i]} == @(install|remove|source|info|clean) ]]; then
2349 special=${COMP_WORDS[i]}
2353 if [ -n "$special" ]; then
2355 @(install|source|info))
2356 COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) )
2360 COMPREPLY=( $( _comp_dpkg_installed_packages \
2372 --@(patch|build-dir|repository-dir))
2383 if [[ "$cur" == -* ]]; then
2384 COMPREPLY=( $( compgen -W '--help --show-upgraded -u --build-dir \
2385 --repository-dir --build-only \
2386 --build-command --reinstall --rebuild \
2387 --remove-builddep --no-wrapper --purge \
2388 --patch --patch-strip -p --yes -y \
2389 --version -v --no-source' -- $cur ) )
2392 COMPREPLY=( $( compgen -W 'update upgrade install remove \
2393 source dist-upgrade world clean info \
2394 clean-build update-repository ' -- $cur ) )
2400 complete -F _apt_build $filenames apt-build
2402 # chsh(1) completion
2410 prev=${COMP_WORDS[COMP_CWORD-1]}
2412 if [ "$prev" = "-s" ]; then
2413 if [ -f /etc/debian_version ]; then
2414 COMPREPLY=( $( </etc/shells ) )
2416 COMPREPLY=( $( chsh -l | grep "^$cur" ) )
2419 COMPREPLY=( $( compgen -u -- $cur ) )
2424 complete -F _chsh chsh
2426 # chkconfig(8) completion
2435 prev=${COMP_WORDS[COMP_CWORD-1]}
2438 @([1-6]|--@(list|add|del)))
2443 COMPREPLY=( $( compgen -W '1 2 3 4 5 6' -- $cur ) )
2448 if [[ "$cur" == -* ]]; then
2449 COMPREPLY=( $( compgen -W '--list --add --del --level' -- $cur ) )
2451 if [ $COMP_CWORD -eq 2 -o $COMP_CWORD -eq 4 ]; then
2452 COMPREPLY=( $( compgen -W 'on off reset' -- $cur ) )
2458 complete -F _chkconfig chkconfig
2460 # This function provides simple user@host completion
2468 if [[ $cur == *@* ]]; then
2471 COMPREPLY=( $( compgen -u -- "$cur" ) )
2476 shopt -u hostcomplete && complete -F _user_at_host $nospace talk ytalk finger
2478 # This function performs host completion based on ssh's known_hosts files,
2479 # defaulting to standard host completion if they don't exist.
2483 local cur curd ocur user suffix aliases global_kh user_kh hosts i host
2484 local -a kh khd config
2490 [ "$1" = -a ] || [ "$2" = -a ] && aliases='yes'
2491 [ "$1" = -c ] || [ "$2" = -c ] && suffix=':'
2492 [[ $cur == *@* ]] && user=${cur%@*}@ && cur=${cur#*@}
2496 [ -r /etc/ssh/ssh_config ] &&
2497 config=( "${config[@]}" "/etc/ssh/ssh_config" )
2498 [ -r "${HOME}/.ssh/config" ] &&
2499 config=( "${config[@]}" "${HOME}/.ssh/config" )
2500 [ -r "${HOME}/.ssh2/config" ] &&
2501 config=( "${config[@]}" "${HOME}/.ssh2/config" )
2503 if [ ${#config[@]} -gt 0 ]; then
2504 # expand path (if present) to global known hosts file
2505 global_kh=$( eval echo $( sed -ne 's/^[ \t]*[Gg][Ll][Oo][Bb][Aa][Ll][Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee]['"$'\t '"']*\(.*\)$/\1/p' "${config[@]}" ) )
2506 # expand path (if present) to user known hosts file
2507 user_kh=$( eval echo $( sed -ne 's/^[ \t]*[Uu][Ss][Ee][Rr][Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee]['"$'\t '"']*\(.*\)$/\1/p' "${config[@]}" ) )
2510 # Global known_hosts files
2511 [ -r "$global_kh" ] &&
2512 kh=( "${kh[@]}" "$global_kh" )
2513 [ -r /etc/ssh/ssh_known_hosts ] &&
2514 kh=( "${kh[@]}" /etc/ssh/ssh_known_hosts )
2515 [ -r /etc/ssh/ssh_known_hosts2 ] &&
2516 kh=( "${kh[@]}" /etc/ssh/ssh_known_hosts2 )
2517 [ -r /etc/known_hosts ] &&
2518 kh=( "${kh[@]}" /etc/known_hosts )
2519 [ -r /etc/known_hosts2 ] &&
2520 kh=( "${kh[@]}" /etc/known_hosts2 )
2521 [ -d /etc/ssh2/knownhosts ] &&
2522 khd=( "${khd[@]}" /etc/ssh2/knownhosts/*pub )
2524 # User known_hosts files
2525 [ -r "$user_kh" ] &&
2526 kh=( "${kh[@]}" "$user_kh" )
2527 [ -r ~/.ssh/known_hosts ] &&
2528 kh=( "${kh[@]}" ~/.ssh/known_hosts )
2529 [ -r ~/.ssh/known_hosts2 ] &&
2530 kh=( "${kh[@]}" ~/.ssh/known_hosts2 )
2531 [ -d ~/.ssh2/hostkeys ] &&
2532 khd=( "${khd[@]}" ~/.ssh2/hostkeys/*pub )
2534 # If we have known_hosts files to use
2535 if [ ${#kh[@]} -gt 0 -o ${#khd[@]} -gt 0 ]; then
2536 # Escape slashes and dots in paths for awk
2541 if [[ "$cur" == [0-9]*.* ]]; then
2542 # Digits followed by a dot - just search for that
2544 elif [[ "$cur" == [0-9]* ]]; then
2545 # Digits followed by no dot - search for digits followed
2548 elif [ -z "$cur" ]; then
2549 # A blank - search for a dot or an alpha character
2555 if [ ${#kh[@]} -gt 0 ]; then
2557 # FS needs to look for a comma separated list
2558 COMPREPLY=( $( awk 'BEGIN {FS=","}
2559 /^[^|]/ {for (i=1; i<=2; ++i) { \
2560 gsub(" .*$", "", $i); \
2561 if ($i ~ /'$cur'/) {print $i} \
2562 }}' "${kh[@]}" 2>/dev/null ) )
2564 if [ ${#khd[@]} -gt 0 ]; then
2565 # Needs to look for files called
2566 # .../.ssh2/key_22_<hostname>.pub
2567 # dont fork any processes, because in a cluster environment,
2568 # there can be hundreds of hostkeys
2569 for i in "${khd[@]}" ; do
2570 if [[ "$i" == *key_22_$curd*.pub ]] && [ -r "$i" ] ; then
2571 host=${i/#*key_22_/}
2573 COMPREPLY=( "${COMPREPLY[@]}" $host )
2578 # append any available aliases from config files
2579 if [ ${#config[@]} -gt 0 ] && [ -n "$aliases" ]; then
2580 local host_aliases=$( sed -ne 's/^[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\?['"$'\t '"']\+\([^*?]*\)$/\2/p' "${config[@]}" )
2581 hosts=$( compgen -W "$host_aliases" -- $ocur )
2582 COMPREPLY=( "${COMPREPLY[@]}" $hosts )
2585 # Now add results of normal hostname completion
2586 COMPREPLY=( "${COMPREPLY[@]}" $( compgen -A hostname -- $ocur ) )
2589 for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
2590 COMPREPLY[i]=$user${COMPREPLY[i]}$suffix
2593 # Just do normal hostname completion
2594 COMPREPLY=( $( compgen -A hostname -S "$suffix" -- $cur ) )
2599 complete -F _known_hosts traceroute traceroute6 tracepath tracepath6 \
2600 ping ping6 fping fping6 telnet host nslookup rsh rlogin ftp dig ssh-installkeys mtr
2612 prev=${COMP_WORDS[COMP_CWORD-1]}
2616 COMPREPLY=( $( compgen -W 'blowfish 3des 3des-cbc blowfish-cbc \
2617 arcfour cast128-cbc' -- $cur ) )
2623 COMPREPLY=( $( compgen -u -- $cur ) )
2628 [ $COMP_CWORD -eq 1 ] || \
2629 COMPREPLY=( "${COMPREPLY[@]}" $( compgen -c -- $cur ) )
2634 shopt -u hostcomplete && complete -F _ssh ssh slogin sftp xhost autossh
2640 local cur userhost path
2647 if [[ "$cur" == *:* ]]; then
2649 # remove backslash escape from :
2651 userhost=${cur%%?(\\):*}
2654 path=${path//\\\\\\\\ / }
2655 if [ -z "$path" ]; then
2656 # default to home dir of specified user on remote host
2657 path=$(ssh -o 'Batchmode yes' $userhost pwd 2>/dev/null)
2659 # escape spaces; remove executables, aliases, pipes and sockets;
2660 # add space at end of file names
2661 COMPREPLY=( $( ssh -o 'Batchmode yes' $userhost \
2662 command ls -aF1d "$path*" 2>/dev/null | \
2663 sed -e "s/[][(){}<>\",:;^&!$&=?\`|\\ ']/\\\\\\\\\\\\&/g" \
2664 -e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' ) )
2668 [[ "$cur" == */* ]] || _known_hosts -c -a
2670 COMPREPLY=( "${COMPREPLY[@]}" $( command ls -aF1d $cur* \
2672 -e "s/[][(){}<>\",:;^&!$&=?\`|\\ ']/\\\\&/g" \
2673 -e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' ) )
2676 complete -F _scp $nospace scp
2679 # rsync(1) completion
2684 local cur prev shell i userhost path
2688 prev=${COMP_WORDS[COMP_CWORD-1]}
2693 --@(config|password-file|include-from|exclude-from))
2697 -@(T|-temp-dir|-compare-dest))
2702 COMPREPLY=( $( compgen -W 'rsh ssh' -- $cur ) )
2709 COMPREPLY=( $( compgen -W '-v -q -c -a -r -R -b -u -l -L -H \
2710 -p -o -g -D -t -S -n -W -x -B -e -C -I -T -P \
2711 -z -h -4 -6 --verbose --quiet --checksum \
2712 --archive --recursive --relative --backup \
2713 --backup-dir --suffix= --update --links \
2714 --copy-links --copy-unsafe-links --safe-links \
2715 --hard-links --perms --owner --group --devices\
2716 --times --sparse --dry-run --whole-file \
2717 --no-whole-file --one-file-system \
2718 --block-size= --rsh= --rsync-path= \
2719 --cvs-exclude --existing --ignore-existing \
2720 --delete --delete-excluded --delete-after \
2721 --ignore-errors --max-delete= --partial \
2722 --force --numeric-ids --timeout= \
2723 --ignore-times --size-only --modify-window= \
2724 --temp-dir= --compare-dest= --compress \
2725 --exclude= --exclude-from= --include= \
2726 --include-from= --version --daemon --no-detach\
2727 --address= --config= --port= --blocking-io \
2728 --no-blocking-io --stats --progress \
2729 --log-format= --password-file= --bwlimit= \
2730 --write-batch= --read-batch= --help' -- $cur ))
2733 # find which remote shell is used
2735 for (( i=1; i < COMP_CWORD; i++ )); do
2736 if [[ "${COMP_WORDS[i]}" == -@(e|-rsh) ]]; then
2737 shell=${COMP_WORDS[i+1]}
2741 if [[ "$shell" == ssh ]]; then
2742 # remove backslash escape from :
2744 userhost=${cur%%?(\\):*}
2747 path=${path//\\\\\\\\ / }
2748 if [ -z "$path" ]; then
2749 # default to home dir of specified
2750 # user on remote host
2751 path=$(ssh -o 'Batchmode yes' \
2752 $userhost pwd 2>/dev/null)
2754 # escape spaces; remove executables, aliases, pipes
2755 # and sockets; add space at end of file names
2756 COMPREPLY=( $( ssh -o 'Batchmode yes' $userhost \
2757 command ls -aF1d "$path*" 2>/dev/null | \
2758 sed -e 's/ /\\\\\\\ /g' -e 's/[*@|=]$//g' \
2759 -e 's/[^\/]$/& /g' ) )
2770 complete -F _rsync $nospace $filenames rsync
2772 # Linux route(8) completion
2774 [ $UNAME = Linux ] &&
2781 prev=${COMP_WORDS[COMP_CWORD-1]}
2783 if [ "$prev" = dev ]; then
2784 COMPREPLY=( $( ifconfig -a | sed -ne 's|^\('$cur'[^ ]*\).*$|\1|p' ))
2788 COMPREPLY=( $( compgen -W 'add del -host -net netmask metric mss \
2789 window irtt reject mod dyn reinstate dev \
2790 default gw' -- $cur ) )
2792 COMPREPLY=( $( echo " ${COMP_WORDS[@]}" | \
2793 (while read -d ' ' i; do
2794 [ "$i" == "" ] && continue
2795 # flatten array with spaces on either side,
2796 # otherwise we cannot grep on word
2797 # boundaries of first and last word
2798 COMPREPLY=" ${COMPREPLY[@]} "
2799 # remove word from list of completions
2800 COMPREPLY=( ${COMPREPLY/ $i / } )
2802 echo "${COMPREPLY[@]}")
2806 [ $UNAME = Linux ] && complete -F _route route
2808 # GNU make(1) completion
2810 have make || have gmake || have gnumake || have pmake &&
2813 local file makef makef_dir="." makef_inc cur prev i
2817 prev=${COMP_WORDS[COMP_CWORD-1]}
2819 # --name value style option
2831 # --name=value style option
2832 if [[ "$cur" == *=* ]]; then
2840 --@(directory|include-dir))
2847 if [[ "$cur" == -* ]]; then
2848 COMPREPLY=( $( compgen -W '-b -m -B -C -d -e -f -h -i -I\
2849 -j -l -k -n -o -p -q -r -R - s -S -t -v -w -W \
2850 --always-make --directory= --debug \
2851 --environment-overrides --file= --makefile= --help \
2852 --ignore-errors --include-dir= --jobs --load-average \
2853 --max-load --keep-going --just-print --dry-run \
2854 --recon --old-file= --assume-old= --print-data-base \
2855 --question --no-builtin-rules --no-builtin-variables \
2856 --silent --quiet --no-keep-goind --stop --touch \
2857 --version --print-directory --no-print-directory \
2858 --what-if= --new-file= --assume-new= \
2859 --warn-undefined-variables' -- $cur ) )
2861 # before we check for makefiles, see if a path was specified
2863 for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do
2864 if [[ ${COMP_WORDS[i]} == -C ]]; then
2865 # eval for tilde expansion
2866 eval makef_dir=${COMP_WORDS[i+1]}
2871 # make reads `GNUmakefile', then `makefile', then `Makefile'
2872 if [ -f ${makef_dir}/GNUmakefile ]; then
2873 makef=${makef_dir}/GNUmakefile
2874 elif [ -f ${makef_dir}/makefile ]; then
2875 makef=${makef_dir}/makefile
2876 elif [ -f ${makef_dir}/Makefile ]; then
2877 makef=${makef_dir}/Makefile
2879 makef=${makef_dir}/*.mk # local convention
2882 # before we scan for targets, see if a Makefile name was
2884 for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do
2885 if [[ ${COMP_WORDS[i]} == -f ]]; then
2886 # eval for tilde expansion
2887 eval makef=${COMP_WORDS[i+1]}
2892 [ ! -f $makef ] && return 0
2894 # deal with included Makefiles
2895 makef_inc=$( grep -E '^-?include' $makef | sed -e "s,^.* ,"$makef_dir"/," )
2897 for file in $makef_inc; do
2898 [ -f $file ] && makef="$makef $file"
2901 COMPREPLY=( $( awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ \
2902 {split($1,A,/ /);for(i in A)print A[i]}' \
2903 $makef 2>/dev/null | command grep "^$cur" ))
2906 complete -f -F _make $filenames make gmake gnumake pmake
2908 # GNU tar(1) completion
2912 local cur ext regex tar untar
2917 if [ $COMP_CWORD -eq 1 ]; then
2918 COMPREPLY=( $( compgen -W 'c t x u r d A' -- $cur ) )
2922 case "${COMP_WORDS[1]}" in
2928 ext='t@(ar?(.@(Z|gz|bz?(2)))|gz|bz?(2))'
2929 regex='t\(ar\(\.\(Z\|gz\|bz2\?\)\)\?\|gz\|bz2\?\)'
2932 ext='t?(ar.)@(gz|Z)'
2933 regex='t\(ar\.\)\?\(gz\|Z\)'
2937 regex='t\(ar\.\)\?bz2\?'
2946 if [[ "$COMP_LINE" == *$ext' ' ]]; then
2947 # complete on files in tar file
2949 # get name of tar file from command line
2950 tar=$( echo "$COMP_LINE" | \
2951 sed -e 's/^.* \([^ ]*'$regex'\) .*$/\1/' )
2952 # devise how to untar and list it
2953 untar=t${COMP_WORDS[1]//[^Izjyf]/}
2955 COMPREPLY=( $( compgen -W "$( echo $( tar $untar $tar \
2956 2>/dev/null ) )" -- "$cur" ) )
2960 # file completion on relevant files
2965 [ -n "${COMP_TAR_INTERNAL_PATHS:-}" ] && complete -F _tar $dirnames tar ||
2966 complete -F _tar $filenames tar
2978 if [ $COMP_CWORD = 1 ]; then
2979 COMPREPLY=( $( compgen -W 'c t x u' -- $cur ) )
2983 case "${COMP_WORDS[1]}" in
2988 _filedir '?(e|j|w)ar'
2995 complete -F _jar $filenames jar
2997 # Linux iptables(8) completion
3002 local cur prev table chain
3006 prev=${COMP_WORDS[COMP_CWORD-1]}
3007 chain='s/^Chain \([^ ]\+\).*$/\1/p'
3009 if [[ $COMP_LINE == *-t\ *filter* ]]; then
3011 elif [[ $COMP_LINE == *-t\ *nat* ]]; then
3013 elif [[ $COMP_LINE == *-t\ *mangle* ]]; then
3019 COMPREPLY=( $( compgen -W '`iptables $table -nL | \
3020 sed -ne "s/^Chain \([^ ]\+\).*$/\1/p"`' -- $cur ) )
3023 COMPREPLY=( $( compgen -W 'nat filter mangle' -- $cur ) )
3026 if [ "$table" = "-t filter" -o "$table" = "" ]; then
3027 COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \
3028 `iptables $table -nL | sed -ne "$chain" \
3029 -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \
3031 elif [ "$table" = "-t nat" ]; then
3032 COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \
3033 MIRROR SNAT DNAT MASQUERADE `iptables $table -nL | \
3034 sed -ne "$chain" -e "s/OUTPUT|PREROUTING|POSTROUTING//"`' \
3036 elif [ "$table" = "-t mangle" ]; then
3037 COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \
3038 MARK TOS `iptables $table -nL | sed -ne "$chain" \
3039 -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \
3044 if [[ "$cur" == -* ]]; then
3045 COMPREPLY=( $( compgen -W '-i -o -s -d -p -f -m --append \
3046 --delete --insert --replace --list --flush --zero --new \
3047 --delete-chain --policy --rename-chain --proto --source \
3048 --destination --in-interface --jump --match --numeric \
3049 --out-interface --table --verbose --line-numbers --exact \
3050 --fragment --modprobe= --set-counters --version' -- "$cur") )
3056 complete -F _iptables iptables
3058 # tcpdump(8) completion
3067 prev=${COMP_WORDS[COMP_CWORD-1]}
3075 _available_interfaces -a
3081 if [[ "$cur" == -* ]]; then
3082 COMPREPLY=( $( compgen -W '-a -d -e -f -l -n -N -O -p \
3083 -q -R -S -t -u -v -x -C -F -i -m -r -s -T -w \
3088 complete -F _tcpdump tcpdump
3090 # autorpm(8) completion
3100 COMPREPLY=( $( compgen -W '--notty --debug --help --version \
3101 auto add fullinfo info help install list \
3102 remove set' -- $cur ) )
3105 complete -F _autorpm autorpm
3107 # This meta-cd function observes the CDPATH variable, so that cd additionally
3108 # completes on directories under those specified in CDPATH.
3112 local IFS=$'\t\n' cur=`_get_cword` i j k
3114 # try to allow variable completion
3115 if [[ "$cur" == ?(\\)\$* ]]; then
3116 COMPREPLY=( $( compgen -v -P '$' -- "${cur#?(\\)$}" ) )
3120 # Use standard dir completion if no CDPATH or parameter starts with /,
3122 if [ -z "${CDPATH:-}" ] || [[ "$cur" == ?(.)?(.)/* ]]; then
3127 local -r mark_dirs=$(_rl_enabled mark-directories && echo y)
3128 local -r mark_symdirs=$(_rl_enabled mark-symlinked-directories && echo y)
3130 # we have a CDPATH, so loop on its contents
3131 for i in ${CDPATH//:/$'\t'}; do
3132 # create an array of matched subdirs
3133 k="${#COMPREPLY[@]}"
3134 for j in $( compgen -d $i/$cur ); do
3135 if [[ ( $mark_symdirs && -h $j || $mark_dirs && ! -h $j ) && ! -d ${j#$i/} ]]; then
3138 COMPREPLY[k++]=${j#$i/}
3144 if [[ ${#COMPREPLY[@]} -eq 1 ]]; then
3146 if [ "$i" == "$cur" ] && [[ $i != "*/" ]]; then
3147 COMPREPLY[0]="${i}/"
3153 if shopt -q cdable_vars; then
3154 complete -v -F _cd $nospace $filenames cd
3156 complete -F _cd $nospace $filenames cd
3161 if [[ COMP_CWORD -eq 0 ]]; then
3163 elif [[ ${#COMP_WORDS[@]} -ge 2 ]]; then
3164 local old_cw0="${COMP_WORDS[0]}"
3165 local new_cw0="${COMP_WORDS[1]}"
3166 local old_length="${#COMP_LINE}"
3167 COMP_LINE=${COMP_LINE#${old_cw0}}
3168 local head=${COMP_LINE:0:${#new_cw0}}
3170 while [[ $head != $new_cw0 ]]; do
3171 COMP_LINE=${COMP_LINE:1}
3172 head=${COMP_LINE:0:${#new_cw0}}
3173 if (( ++i > 10 )); then
3177 local new_length="${#COMP_LINE}"
3178 COMP_POINT=$(( COMP_POINT + new_length - old_length))
3180 COMP_CWORD=$(( COMP_CWORD - 1 ))
3181 for (( i=0; i < ${#COMP_WORDS[@]} - 1; ++i )); do
3182 COMP_WORDS[i]="${COMP_WORDS[i+1]}"
3184 unset COMP_WORDS[${#COMP_WORDS[@]}-1]
3190 # A meta-command completion function for commands like sudo(8), which need to
3191 # first complete on a command, then complete according to that command's own
3192 # completion definition - currently not quite foolproof (e.g. mount and umount
3193 # don't work properly), but still quite useful.
3197 local cur func cline cspec noglob cmd done i \
3198 _COMMAND_FUNC _COMMAND_FUNC_ARGS
3203 # If the the first arguments following our meta-command-invoker are
3204 # switches, get rid of them. Most definitely not foolproof.
3206 while [ -z $done ] ; do
3207 cmd=${COMP_WORDS[0]}
3208 if [[ "$cmd" == -* ]] && [ $COMP_CWORD -ge 1 ]; then
3210 elif [[ "$cmd" == -* ]] && [[ $COMP_CWORD -eq 0 ]]; then
3217 if [ $COMP_CWORD -eq 0 ]; then
3218 COMPREPLY=( $( compgen -c -- $cur ) )
3219 elif complete -p $cmd &>/dev/null; then
3220 cspec=$( complete -p $cmd )
3221 if [ "${cspec#* -F }" != "$cspec" ]; then
3222 # COMP_CWORD and COMP_WORDS() are not read-only,
3223 # so we can set them before handing off to regular
3224 # completion routine
3230 if [[ ${#COMP_WORDS[@]} -ge 2 ]]; then
3231 $func $cmd "${COMP_WORDS[${#COMP_WORDS[@]}-1]}" "${COMP_WORDS[${#COMP_WORDS[@]}-2]}"
3233 $func $cmd "${COMP_WORDS[${#COMP_WORDS[@]}-1]}"
3236 # remove any \: generated by a command that doesn't
3237 # default to filenames or dirnames (e.g. sudo chown)
3238 # FIXME: I'm pretty sure this does not work!
3239 if [ "${cspec#*-o }" != "$cspec" ]; then
3242 if [[ "$cspec" != @(dir|file)names ]]; then
3243 COMPREPLY=("${COMPREPLY[@]//\\\\:/:}")
3246 elif [ -n "$cspec" ]; then
3247 cspec=${cspec#complete};
3248 cspec=${cspec%%$cmd};
3249 COMPREPLY=( $( eval compgen "$cspec" -- "$cur" ) );
3253 [ ${#COMPREPLY[@]} -eq 0 ] && _filedir
3255 complete -F _command $filenames nohup exec nice eval strace time ltrace then \
3256 else do vsound command xargs
3260 PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin _command $1 $2 $3
3262 complete -F _root_command $filenames sudo fakeroot really
3269 local cur prev buildfile i
3273 prev=${COMP_WORDS[COMP_CWORD-1]}
3286 if [[ "$cur" == -* ]]; then
3287 # relevant options completion
3288 COMPREPLY=( $( compgen -W '-help -projecthelp -version -quiet \
3289 -verbose -debug -emacs -logfile -logger \
3290 -listener -buildfile -f -D -find' -- $cur ) )
3292 # available targets completion
3293 # find which buildfile to use
3295 for (( i=1; i < COMP_CWORD; i++ )); do
3296 if [[ "${COMP_WORDS[i]}" == -buildfile ]]; then
3297 buildfile=${COMP_WORDS[i+1]}
3301 [ ! -f $buildfile ] && return 0
3303 # parse buildfile for targets
3304 COMPREPLY=( $( awk -F'"' '/<target name="/ {print $2}' \
3305 $buildfile | grep "^$cur" )
3306 $( awk -F"'" "/<target name='/ "'{print $2}' \
3307 $buildfile | grep "^$cur" )
3308 $( awk -F'"' '/<target [^n]/ {if ($1 ~ /name=/) { print $2 } else if ($3 ~ /name=/) {print $4} else if ($5 ~ /name=/) {print $6}}' \
3309 $buildfile | grep "^$cur" ) )
3312 have complete-ant-cmd.pl && \
3313 complete -C complete-ant-cmd.pl -F _ant $filenames ant || \
3314 complete -F _ant $filenames ant
3323 cur=${COMP_WORDS[COMP_CWORD]#-}
3325 COMPREPLY=( $( compgen -P '-' -W 'all class= debug d2 domain= \
3326 srchlist= defname search port= querytype= \
3327 type= recurse retry root timeout vc \
3328 ignoretc' -- $cur ) )
3330 complete -F _nslookup nslookup
3332 # mysqladmin(1) completion
3341 prev=${COMP_WORDS[COMP_CWORD-1]}
3345 COMPREPLY=( $( compgen -u -- $cur ) )
3352 COMPREPLY=( $( compgen -W '-# -f -? -C -h -p -P -i -r -E -s -S -t -u \
3353 -v -V -w' -- $cur ) )
3355 COMPREPLY=( "${COMPREPLY[@]}" \
3356 $( compgen -W 'create drop extended-status flush-hosts \
3357 flush-logs flush-status flush-tables \
3358 flush-threads flush-privileges kill \
3359 password ping processlist reload refresh \
3360 shutdown status variables version' \
3363 complete -F _mysqladmin mysqladmin
3365 # gzip(1) completion
3370 local cur prev xspec IFS=$'\t\n'
3374 prev=${COMP_WORDS[COMP_CWORD-1]}
3376 if [[ "$cur" == -* ]]; then
3377 COMPREPLY=( $( compgen -W '-c -d -f \
3378 -h -l -L -n -N -q -r -S -t -v -V \
3379 -1 -2 -3 -4 -5 -6 -7 -8 -9 \
3380 --stdout --decompress --force --help --list \
3381 --license --no-name --name --quiet --recursive \
3382 --suffix --test --verbose --version --fast \
3388 if [[ "$prev" == --* ]]; then
3389 [[ "$prev" == --decompress || \
3390 "$prev" == --list || \
3391 "$prev" == --test ]] && xspec="!"$xspec
3392 [[ "$prev" == --force ]] && xspec=
3393 elif [[ "$prev" == -* ]]; then
3394 [[ "$prev" == -*[dlt]* ]] && xspec="!"$xspec
3395 [[ "$prev" == -*f* ]] && xspec=
3396 elif [ "$prev" = '>' ]; then
3398 elif [ "$prev" = '<' ]; then
3404 COMPREPLY=( $( compgen -f -X "$xspec" -- $cur ) \
3405 $( compgen -d -- $cur ) )
3407 complete -F _gzip $filenames gzip
3409 # bzip2(1) completion
3414 local cur prev xspec IFS=$'\t\n'
3418 prev=${COMP_WORDS[COMP_CWORD-1]}
3420 if [[ "$cur" == -* ]]; then
3421 COMPREPLY=( $( compgen -W '-c -d -f -h -k -L -q -s \
3422 -t -v -V -z -1 -2 -3 -4 -5 -6 -7 -8 -9 \
3423 --help --decompress --compress --keep --force \
3424 --test --stdout --quiet --verbose --license \
3425 --version --small --fast --best' -- $cur ) )
3430 if [[ "$prev" == --* ]]; then
3431 [[ "$prev" == --decompress || \
3432 "$prev" == --list || \
3433 "$prev" == --test ]] && xspec="!"$xspec
3434 [[ "$prev" == --compress ]] && xspec=
3435 elif [[ "$prev" == -* ]]; then
3436 [[ "$prev" == -*[dt]* ]] && xspec="!"$xspec
3437 [[ "$prev" == -*z* ]] && xspec=
3442 COMPREPLY=( $( compgen -f -X "$xspec" -- $cur ) \
3443 $( compgen -d -- $cur ) )
3445 complete -F _bzip2 $filenames bzip2
3447 # openssl(1) completion
3454 config=/etc/ssl/openssl.cnf
3455 [ ! -f $config ] && config=/usr/share/ssl/openssl.cnf
3456 for (( i=2; i < COMP_CWORD; i++ )); do
3457 if [[ "${COMP_WORDS[i]}" == -config ]]; then
3458 config=${COMP_WORDS[i+1]}
3462 [ ! -f $config ] && return 0
3464 COMPREPLY=( $( awk '/\[.*\]/ {print $2} ' $config | grep "^$cur" ) )
3474 if [ $COMP_CWORD -eq 1 ]; then
3475 COMPREPLY=( $( compgen -W 'asn1parse ca ciphers crl crl2pkcs7 \
3476 dgst dh dhparam dsa dsaparam enc errstr gendh gendsa \
3477 genrsa nseq passwd pkcs12 pkcs7 pkcs8 rand req rsa \
3478 rsautl s_client s_server s_time sess_id smime speed \
3479 spkac verify version x509 md2 md4 md5 mdc2 rmd160 sha \
3480 sha1 base64 bf bf-cbc bf-cfb bf-ecb bf-ofb cast \
3481 cast-cbc cast5-cbc cast5-cfb cast5-ecb cast5-ofb des \
3482 des-cbc des-cfb des-ecb des-ede des-ede-cbc \
3483 des-ede-cfb des-ede-ofb des-ede3 des-ede3-cbc \
3484 des-ede3-cfb des-ede3-ofb des-ofb des3 desx rc2 \
3485 rc2-40-cbc rc2-64-cbc rc2-cbc rc2-cfb rc2-ecb rc2-ofb \
3486 rc4 rc4-40' -- $cur ) )
3488 prev=${COMP_WORDS[COMP_CWORD-1]}
3489 case ${COMP_WORDS[1]} in
3493 COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
3502 if [[ "$cur" == -* ]]; then
3503 COMPREPLY=( $( compgen -W '-inform -in -out -noout -offset \
3504 -length -i -oid -strparse' -- $cur ) )
3509 -@(config|revoke|cert|in|out|spkac|ss_cert))
3517 -@(name|crlexts|extensions))
3523 if [[ "$cur" == -* ]]; then
3524 COMPREPLY=( $( compgen -W '-verbose -config -name \
3525 -gencrl -revoke -crldays -crlhours -crlexts \
3526 -startdate -enddate -days -md -policy -keyfile \
3527 -key -passin -cert -in -out -notext -outdir \
3528 -infiles -spkac -ss_cert -preserveDN -batch \
3529 -msie_hack -extensions' -- $cur ) )
3533 if [[ "$cur" == -* ]]; then
3534 COMPREPLY=( $( compgen -W '-v -ssl2 -ssl3 -tls1' -- $cur ) )
3540 COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
3553 if [[ "$cur" == -* ]]; then
3554 COMPREPLY=( $( compgen -W '-inform -outform -text -in -out -noout \
3555 -hash -issuer -lastupdate -nextupdate -CAfile -CApath' -- $cur ) )
3561 COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
3570 if [[ "$cur" == -* ]]; then
3571 COMPREPLY=( $( compgen -W '-inform -outform -in -out -print_certs' -- $cur ) )
3576 -@(out|sign|verify|prvrify|signature))
3582 if [[ "$cur" == -* ]]; then
3583 COMPREPLY=( $( compgen -W '-md5 -md4 -md2 -sha1 -sha -mdc2 -ripemd160 -dss1 \
3584 -c -d -hex -binary -out -sign -verify -prverify -signature' -- $cur ) )
3592 COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
3601 if [[ "$cur" == -* ]]; then
3602 COMPREPLY=( $( compgen -W '-inform -outform -in -passin -out -passout -des -des3 -idea -text -noout \
3603 -modulus -pubin -pubout' -- $cur ) )
3609 COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
3618 if [[ "$cur" == -* ]]; then
3619 COMPREPLY=( $( compgen -W '-inform -outform -in -out -noout \
3620 -text -C -rand -genkey' -- $cur ) )
3631 if [[ "$cur" == -* ]]; then
3632 COMPREPLY=( $( compgen -W '-ciphername -in -out -pass \
3633 -e -d -a -A -k -kfile -S -K -iv -p -P -bufsize -debug' -- $cur ) )
3639 COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
3648 if [[ "$cur" == -* ]]; then
3649 COMPREPLY=( $( compgen -W '-inform -outform -in -out -dsaparam -noout \
3650 -text -C -2 -5 -rand' -- $cur ) )
3661 if [[ "$cur" == -* ]]; then
3662 COMPREPLY=( $( compgen -W '-out -des -des3 -idea -rand' -- $cur ) )
3675 if [[ "$cur" == -* ]]; then
3676 COMPREPLY=( $( compgen -W '-out -passout -des -des3 -idea -f4 -3 -rand' -- $cur ) )
3682 COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
3691 if [[ "$cur" == -* ]]; then
3692 COMPREPLY=( $( compgen -W '-inform -outform -in -out -print_certs -text -noout' -- $cur ) )
3703 if [[ "$cur" == -* ]]; then
3704 COMPREPLY=( $( compgen -W '-out -rand -base64' -- $cur ) )
3710 COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
3714 -@(in|out|rand|key|keyout|config))
3724 if [[ "$cur" == -* ]]; then
3725 COMPREPLY=( $( compgen -W '-inform -outform -in \
3726 -passin -out -passout -text -noout -verify \
3727 -modulus -new -rand -newkey -newkey -nodes \
3728 -key -keyform -keyout -md5 -sha1 -md2 -mdc2 \
3729 -config -x509 -days -asn1-kludge -newhdr \
3730 -extensions -reqexts section' -- $cur ) )
3736 COMPREPLY=( $( compgen -W 'DER NET PEM' -- $cur ) )
3745 if [[ "$cur" == -* ]]; then
3746 COMPREPLY=( $( compgen -W '-inform -outform -in -passin -out -passout \
3747 -sgckey -des -des3 -idea -text -noout -modulus -check -pubin \
3748 -pubout -engine' -- $cur ) )
3759 if [[ "$cur" == -* ]]; then
3760 COMPREPLY=( $( compgen -W '-in -out -inkey -pubin -certin -sign -verify \
3761 -encrypt -decrypt -pkcs -ssl -raw -hexdump -asn1parse' -- $cur ) )
3770 -@(cert|key|CAfile|rand))
3780 if [[ "$cur" == -* ]]; then
3781 COMPREPLY=( $( compgen -W '-connect -verify -cert -key -CApath -CAfile \
3782 -reconnect -pause -showcerts -debug -msg -nbio_test -state -nbio \
3783 -crlf -ign_eof -quiet -ssl2 -ssl3 -tls1 -no_ssl2 -no_ssl3 -no_tls1 \
3784 -bugs -cipher -starttls -engine -rand' -- $cur ) )
3789 -@(cert|key|dcert|dkey|dhparam|CAfile|rand))
3799 if [[ "$cur" == -* ]]; then
3800 COMPREPLY=( $( compgen -W '-accept -context -verify -Verify -cert -key \
3801 -dcert -dkey -dhparam -nbio -nbio_test -crlf -debug -msg -state -CApath \
3802 -CAfile -nocert -cipher -quiet -no_tmp_rsa -ssl2 -ssl3 -tls1 -no_ssl2 \
3803 -no_ssl3 -no_tls1 -no_dhe -bugs -hack -www -WWW -HTTP -engine -id_prefix \
3813 -@(cert|key|CAfile))
3823 if [[ "$cur" == -* ]]; then
3824 COMPREPLY=( $( compgen -W '-connect -www -cert -key -CApath -CAfile -reuse \
3825 -new -verify -nbio -time -ssl2 -ssl3 -bugs -cipher' -- $cur ) )
3832 COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
3842 if [[ "$cur" == -* ]]; then
3843 COMPREPLY=( $( compgen -W '-inform -outform -in -out -text -noout \
3844 -context ID' -- $cur ) )
3850 COMPREPLY=( $( compgen -W 'SMIME DER PEM' -- $cur ) )
3853 -@(in|out|certfile|signer|recip|inkey|content|rand))
3859 if [[ "$cur" == -* ]]; then
3860 COMPREPLY=( $( compgen -W '-encrypt -decrypt -sign -verify -pk7out -des -des3 \
3861 -rc2-40 -rc2-64 -rc2-128 -aes128 -aes192 -aes256 -in -certfile -signer \
3862 -recip -inform -passin -inkey -out -outform -content -to -from -subject \
3863 -text -rand' -- $cur ) )
3869 if [[ "$cur" == -* ]]; then
3870 COMPREPLY=( $( compgen -W '-engine' -- $cur ) )
3872 COMPREPLY=( $( compgen -W 'md2 mdc2 md5 hmac sha1 rmd160 idea-cbc \
3873 rc2-cbc rc5-cbc bf-cbc des-cbc des-ede3 rc4 rsa512 rsa1024 rsa2048 \
3874 rsa4096 dsa512 dsa1024 dsa2048 idea rc2 des rsa blowfish' -- $cur ) )
3879 -@(CAfile|untrusted))
3889 if [[ "$cur" == -* ]]; then
3890 COMPREPLY=( $( compgen -W '-CApath -CAfile -purpose -untrusted -help -issuer_checks \
3891 -verbose -certificates' -- $cur ) )
3898 -@(in|out|CA|CAkey|CAserial|extfile))
3903 COMPREPLY=( $( compgen -W 'DER PEM NET' -- $cur ) )
3906 -@(key|CA|CAkey)form)
3907 COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
3916 if [[ "$cur" == -* ]]; then
3917 COMPREPLY=( $( compgen -W '-inform -outform \
3918 -keyform -CAform -CAkeyform -in -out \
3919 -serial -hash -subject -issuer -nameopt \
3920 -email -startdate -enddate -purpose \
3921 -dates -modulus -fingerprint -alias \
3922 -noout -trustout -clrtrust -clrreject \
3923 -addtrust -addreject -setalias -days \
3924 -set_serial -signkey -x509toreq -req \
3925 -CA -CAkey -CAcreateserial -CAserial \
3926 -text -C -md2 -md5 -sha1 -mdc2 -clrext \
3927 -extfile -extensions -engine' -- $cur ) )
3930 @(md5|md4|md2|sha1|sha|mdc2|ripemd160))
3931 if [[ "$cur" == -* ]]; then
3932 COMPREPLY=( $( compgen -W '-c -d' -- $cur ) )
3942 complete -F _openssl $default openssl
3945 # screen(1) completion
3950 local cur prev preprev
3954 prev=${COMP_WORDS[COMP_CWORD-1]}
3956 [ "$COMP_CWORD" -ge 2 ] && preprev=${COMP_WORDS[COMP_CWORD-2]}
3958 if [ "$preprev" = "-d" -o "$preprev" = "-D" -a "$prev" = "-r" -o \
3959 "$prev" = "-R" ]; then
3961 COMPREPLY=( $( command screen -ls | \
3962 sed -ne 's|^['$'\t'']\+\('$cur'[0-9]\+\.[^'$'\t'']\+\).*$|\1|p' ) )
3967 COMPREPLY=( $( command screen -ls | \
3968 sed -ne 's|^['$'\t'']\+\('$cur'[0-9]\+\.[^'$'\t'']\+\).*Detached.*$|\1|p' ) )
3972 COMPREPLY=( $( command screen -ls | \
3973 sed -ne 's|^['$'\t'']\+\('$cur'[0-9]\+\.[^'$'\t'']\+\).*Attached.*$|\1|p' ) )
3977 COMPREPLY=( $( grep ^${cur:-[^#]} /etc/shells ) )
3986 complete -F _screen $default screen
3988 # lftp(1) bookmark completion
3998 if [ $COMP_CWORD -eq 1 ] && [ -f ~/.lftp/bookmarks ]; then
3999 COMPREPLY=( $( compgen -W '$( sed -ne "s/^\(.*\)'$'\t''.*$/\1/p" \
4000 ~/.lftp/bookmarks )' -- $cur ) )
4005 complete -F _lftp $default lftp
4007 # ncftp(1) bookmark completion
4017 if [ $COMP_CWORD -eq 1 ] && [ -f ~/.ncftp/bookmarks ]; then
4018 COMPREPLY=( $( compgen -W '$( sed -ne "s/^\([^,]\{1,\}\),.*$/\1/p" \
4019 ~/.ncftp/bookmarks )' -- $cur ) )
4024 complete -F _ncftp $default ncftp
4035 prev=${COMP_WORDS[COMP_CWORD-1]}
4037 if [ $COMP_CWORD -eq 1 ]; then
4038 COMPREPLY=( $( compgen -c -- $cur ) )
4039 elif [ $COMP_CWORD -eq 2 ]; then
4041 COMPREPLY=( $( compgen -fW "$( command ps axo comm,pid | \
4042 awk '{if ($1 ~ /^'"$prev"'/) print $2}' ) )" \
4046 complete -F _gdb $filenames gdb
4048 # Postgresql completion
4054 COMPREPLY=( $( psql -l 2>/dev/null | \
4055 sed -e '1,/^-/d' -e '/^(/,$d' | \
4056 awk '{print $1}' | grep "^$cur" ) )
4061 #COMPREPLY=( $( psql -qtc 'select usename from pg_user' template1 2>/dev/null | \
4063 #[ ${#COMPREPLY[@]} -eq 0 ] &&
4064 COMPREPLY=( $( compgen -u -- $cur ) )
4067 # createdb(1) completion
4075 prev=${COMP_WORDS[COMP_CWORD-1]}
4088 if [[ "$cur" == -* ]]; then
4089 COMPREPLY=( $( compgen -W '-D -T -E -h -p -U -W -e -q \
4090 --location= --template= --encoding= --host= --port= \
4091 --username= --password --echo --quiet --help' -- $cur ))
4096 complete -F _createdb $default createdb
4098 # dropdb(1) completion
4106 prev=${COMP_WORDS[COMP_CWORD-1]}
4119 if [[ "$cur" == -* ]]; then
4120 COMPREPLY=( $( compgen -W '-h -p -U -W -e -q \
4121 --host= --port= --username= --password \
4122 --interactive --echo --quiet --help' -- $cur ) )
4127 complete -F _dropdb $default dropdb
4129 # psql(1) completion
4137 prev=${COMP_WORDS[COMP_CWORD-1]}
4152 -@(o|f)|--output|--file)
4158 if [[ "$cur" == -* ]]; then
4159 # return list of available options
4160 COMPREPLY=( $( compgen -W '-a --echo-all -A --no-align \
4161 -c --command -d --dbname -e --echo-queries \
4162 -E --echo-hidden -f --file -F --filed-separator \
4163 -h --host -H --html -l --list -n -o --output \
4164 -p --port -P --pset -q -R --record-separator \
4165 -s --single-step -S --single-line -t --tuples-only \
4166 -T --table-attr -U --username -v --variable \
4167 -V --version -W --password -x --expanded -X --nopsqlrc \
4168 -? --help ' -- $cur ) )
4170 # return list of available databases
4174 complete -F _psql $default psql
4183 if [[ "$cur" == --*=* ]]; then
4185 # cut backslash that gets inserted before '=' sign
4189 COMPREPLY=( $( compgen -P "$opt=" -W '${COMPREPLY[@]}' -- $cur))
4193 if [[ "$cur" == -* ]]; then
4194 COMPREPLY=( $( $1 --help 2>&1 | sed -e '/--/!d' \
4195 -e 's/.*\(--[-A-Za-z0-9]\+=\?\).*/\1/' | \
4196 command grep "^$cur" | sort -u ) )
4197 elif [[ "$1" == @(mk|rm)dir ]]; then
4203 # makeinfo and texi2dvi are defined elsewhere.
4204 for i in a2ps autoconf automake bc gprof ld nm objcopy objdump readelf strip \
4205 bison cpio diff patch enscript cp df dir du ln ls mkfifo mknod mv rm \
4206 touch vdir awk gperf grep grub indent less m4 sed shar date \
4207 tee who texindex cat csplit cut expand fmt fold head \
4208 md5sum nl od paste pr ptx sha1sum sort split tac tail tr unexpand \
4209 uniq wc ldd bash id irb mkdir rmdir; do
4210 have $i && complete -F _longopt $filenames $i
4213 # These commands use filenames, so '-o filenames' is not needed.
4214 for i in env netstat seq uname units wget; do
4215 have $i && complete -F _longopt $default $i
4221 # The only unusual feature is that we don't parse "gcc --help -v" output
4222 # directly, because that would include the options of all the other backend
4223 # tools (linker, assembler, preprocessor, etc) without any indication that
4224 # you cannot feed such options to the gcc driver directly. (For example, the
4225 # linker takes a -z option, but you must type -Wl,-z for gcc.) Instead, we
4226 # ask the driver ("g++") for the name of the compiler ("cc1"), and parse the
4227 # --help output of the compiler.
4232 local cur cc backend
4250 backend=cc1 # (near-)universal backend
4254 if [[ "$cur" == -* ]]; then
4255 cc=$( $1 -print-prog-name=$backend )
4257 # for C/C++/ObjectiveC it's useless
4258 # for FORTRAN/Java it's an error
4259 COMPREPLY=( $( $cc --help 2>/dev/null | tr '\t' ' ' | \
4260 sed -e '/^ *-/!d' -e 's/ *-\([^ ]*\).*/-\1/' | \
4261 command grep "^$cur" | sort -u ) )
4266 complete $filenames -F _gcc gcc g++ c++ g77 gcj gpc
4267 [ $UNAME = GNU -o $UNAME = Linux -o $UNAME = Cygwin ] && \
4268 [ -n "${have:-}" ] && complete $filenames -F _gcc cc
4270 # Linux cardctl(8) completion
4280 if [ $COMP_CWORD -eq 1 ]; then
4281 COMPREPLY=( $( compgen -W 'status config ident suspend \
4282 resume reset eject insert scheme' \
4286 complete -F _cardctl cardctl
4288 # This function is required by _dpkg() and _dpkg-reconfigure()
4291 _comp_dpkg_installed_packages()
4293 grep -A 1 "Package: $1" /var/lib/dpkg/status | \
4294 grep -B 1 -E "ok installed|half-installed|unpacked| \
4295 half-configured|config-files" | \
4296 grep "Package: $1" | cut -d\ -f2
4299 # Debian dpkg(8) completion
4307 prev=${COMP_WORDS[COMP_CWORD-1]}
4312 # find the last option flag
4313 if [[ $cur != -* ]]; then
4314 while [[ $prev != -* && $i != 1 ]]; do
4316 prev=${COMP_WORDS[i-1]}
4321 -@(c|i|A|I|f|e|x|X|-@(install|unpack|record-avail|contents|info|fsys-tarfile|field|control|extract)))
4329 -@(s|p|l|-@(status|print-avail|list)))
4330 COMPREPLY=( $( apt-cache pkgnames $cur 2>/dev/null ) )
4337 -@(r|L|P|-@(remove|purge|listfiles)))
4338 COMPREPLY=( $( _comp_dpkg_installed_packages $cur ) )
4343 COMPREPLY=( $( compgen -W '-i --install --unpack -A --record-avail \
4344 --configure -r --remove -P --purge --get-selections \
4345 --set-selections --update-avail --merge-avail \
4346 --clear-avail --command-fd --forget-old-unavail -s \
4347 --status -p --print-avail -L --listfiles -l --list \
4348 -S --search -C --audit --print-architecture \
4349 --print-gnu-build-architecture \
4350 --print-installation-architecture \
4351 --compare-versions --help --version --force-help \
4352 --force-all --force-auto-select --force-downgrade \
4353 --force-configure-any --force-hold --force-bad-path \
4354 --force-not-root --force-overwrite \
4355 --force-overwrite-diverted --force-bad-verify \
4356 --force-depends-version --force-depends \
4357 --force-confnew --force-confold --force-confdef \
4358 --force-confmiss --force-conflicts --force-architecture\
4359 --force-overwrite-dir --force-remove-reinstreq \
4360 --force-remove-essential -Dh \
4361 --debug=help --licence --admindir= --root= --instdir= \
4362 -O --selected-only -E --skip-same-version \
4363 -G --refuse-downgrade -B --auto-deconfigure \
4364 --no-debsig --no-act -D --debug= --status-fd \
4365 -b --build -I --info -f --field -c --contents \
4366 -x --extract -X --vextract --fsys-tarfile -e --control \
4367 --ignore-depends= --abort-after' -- $cur ) )
4373 complete -F _dpkg $filenames dpkg dpkg-deb
4376 # Debian GNU dpkg-reconfigure(8) completion
4378 have dpkg-reconfigure &&
4385 prev=${COMP_WORDS[COMP_CWORD-1]}
4390 opt=( $( echo /usr/share/perl5/Debconf/FrontEnd/* ) )
4391 opt=( ${opt[@]##*/} )
4392 opt=( ${opt[@]%.pm} )
4393 COMPREPLY=( $( compgen -W '${opt[@]}' -- $cur ) )
4397 COMPREPLY=( $( compgen -W 'low medium high critical' -- $cur ) )
4402 if [[ "$cur" == -* ]]; then
4403 COMPREPLY=( $( compgen -W '-f --frontend -p --priority -a --all \
4404 -u --unseen-only -h --help -s --showold \
4405 --force --terse' -- $cur ) )
4407 COMPREPLY=( $( _comp_dpkg_installed_packages $cur ) )
4410 complete -F _dpkg_reconfigure $default dpkg-reconfigure
4412 # Debian dpkg-source completion
4417 local cur prev options work i action packopts unpackopts
4419 packopts="-c -l -F -V -T -D -U -W -E -sa -i -I -sk -sp -su -sr -ss -sn -sA -sK -sP -sU -sR"
4420 unpackopts="-sp -sn -su"
4421 options=`echo "-x -b $packopts $unpackopts" | xargs echo | sort -u | xargs echo`
4424 if [ "$1" != "dpkg-source" ]; then
4428 prev=${COMP_WORDS[COMP_CWORD-1]}
4430 for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
4431 if [[ ${COMP_WORDS[$i]} == "-x" ]]; then
4433 elif [[ ${COMP_WORDS[$i]} == "-b" ]]; then
4435 elif [[ ${COMP_WORDS[$i]} == "-h" ]]; then
4439 # if currently seeing a complete option, return just itself.
4440 for i in $options; do
4441 if [ "$cur" = "$i" ]; then
4442 COMPREPLY=( "$cur" )
4448 if [ "$cur" = "-" -o "$cur" = "-s" ]; then
4449 COMPREPLY=( $unpackots )
4454 COMPREPLY=( $( compgen -d -- "$cur" ) \
4455 $( compgen -f -X '!*.dsc' -- "$cur" ) )
4459 COMPREPLY=( $unpackopts $(compgen -d -f -- "$cur" ) )
4466 if [ "$cur" = "-" ]; then
4467 COMPREPLY=( $packopts )
4470 if [ "$cur" = "-s" ]; then
4471 COMPREPLY=( "-sa" "-sk" "-sp" "-su" "-sr" "-ss" "-sn" \
4472 "-sA" "-sK" "-sP" "-sU" "-sR" )
4477 COMPREPLY=( $( compgen -d -- "$cur" ) )
4480 "-c"|"-l"|"-T"|"-i"|"-I")
4481 # -c: get controlfile
4482 # -l: get per-version info from this file
4483 # -T: read variables here, not debian/substvars
4484 # -i: <regexp> filter out files to ignore diffs of.
4485 # -I: filter out files when building tarballs.
4486 # return directory names and file names
4487 COMPREPLY=( $( compgen -d -f ) )
4491 # -F: force change log format
4492 COMPREPLY=( $( ( cd /usr/lib/dpkg/parsechangelog; compgen -f "$cur" ) ) )
4496 # -V: set a substitution variable
4497 # we don't know anything about possible variables or values
4498 # so we don't try to suggest any completion.
4503 # -D: override or add a .dsc field and value
4504 # if $cur doesn't contain a = yet, suggest variable names
4505 if echo -- "$cur" | grep -q "="; then
4506 # $cur contains a "="
4510 COMPREPLY=( Format Source Version Binary Maintainer Uploader Architecture Standards-Version Build-Depends Files )
4515 # -U: remove a field
4516 # Suggest possible fieldnames
4517 COMPREPLY=( Format Source Version Binary Maintainer Uploader Architecture Standards-Version Build-Depends Files )
4521 COMPREPLY=( $packopts )
4528 # if seeing a partial option, return possible completions.
4529 if [ "$cur" = "-s" ]; then
4530 COMPREPLY=( "-sa" "-sk" "-sp" "-su" "-sr" "-ss" "-sn" \
4531 "-sA" "-sK" "-sP" "-sU" "-sR" )
4534 # else return all possible options.
4535 COMPREPLY=( $options )
4540 complete -F _dpkg_source dpkg-source
4542 # Debian Linux dselect(8) completion.
4551 prev=${COMP_WORDS[COMP_CWORD-1]}
4565 if [[ "$cur" == -* ]]; then
4566 COMPREPLY=( $( compgen -W '--admindir --help --version --licence \
4567 --license --expert --debug' -- $cur ) )
4569 COMPREPLY=( $( compgen -W 'access update select install config \
4570 remove quit' -- $cur ) )
4576 complete -F _dselect $filenames dselect
4581 # available path elements completion
4586 _filedir '@(jar|zip)'
4589 # exact classpath determination
4590 _java_find_classpath()
4594 # search first in current options
4595 for (( i=1; i < COMP_CWORD; i++ )); do
4596 if [[ "${COMP_WORDS[i]}" == -@(cp|classpath) ]]; then
4597 classpath=${COMP_WORDS[i+1]}
4602 # default to environment
4603 [ -z "$classpath" ] && classpath=$CLASSPATH
4605 # default to current directory
4606 [ -z "$classpath" ] && classpath=.
4609 # exact sourcepath determination
4610 _java_find_sourcepath()
4614 # search first in current options
4615 for (( i=1; i < COMP_CWORD; i++ )); do
4616 if [[ "${COMP_WORDS[i]}" == -sourcepath ]]; then
4617 sourcepath=${COMP_WORDS[i+1]}
4622 # default to classpath
4623 [ -z "$sourcepath" ] && _java_find_classpath
4624 sourcepath=$classpath
4627 # available classes completion
4632 # find which classpath to use
4633 _java_find_classpath
4635 # convert package syntax to path syntax
4637 # parse each classpath element for classes
4638 for i in ${classpath//:/ }; do
4639 if [ -r $i ] && [[ "$i" == *.@(jar|zip) ]]; then
4640 if type zipinfo &> /dev/null; then
4641 COMPREPLY=( "${COMPREPLY[@]}" $( zipinfo -1 \
4642 "$i" | grep "^$cur" | grep '\.class$' | \
4645 COMPREPLY=( "${COMPREPLY[@]}" $( jar tf "$i" \
4646 "$cur" | grep "\.class$" | grep -v "\\$" ) )
4649 elif [ -d $i ]; then
4651 COMPREPLY=( "${COMPREPLY[@]}" $( find "$i" -type f \
4652 -path "$i/$cur*.class" 2>/dev/null | \
4653 grep -v "\\$" | sed -e "s|^$i/||" ) )
4657 # remove class extension
4658 COMPREPLY=( ${COMPREPLY[@]%.class} )
4659 # convert path syntax to package syntax
4660 COMPREPLY=( ${COMPREPLY[@]//\//.} )
4663 # available packages completion
4668 # find wich sourcepath to use
4669 _java_find_sourcepath
4671 # convert package syntax to path syntax
4673 # parse each sourcepath element for packages
4674 for i in ${sourcepath//:/ }; do
4676 COMPREPLY=( "${COMPREPLY[@]}" $( command ls -F -d \
4677 $i/$cur* 2>/dev/null | sed -e 's|^'$i'/||' ) )
4680 # keep only packages
4681 COMPREPLY=( $( echo "${COMPREPLY[@]}" | tr " " "\n" | grep "/$" ) )
4682 # remove packages extension
4683 COMPREPLY=( ${COMPREPLY[@]%/} )
4684 # convert path syntax to package syntax
4685 cur=${COMPREPLY[@]//\//.}
4696 prev=${COMP_WORDS[COMP_CWORD-1]}
4698 for ((i=1; i < $COMP_CWORD; i++)); do
4699 case ${COMP_WORDS[$i]} in
4701 ((i++)) # skip the classpath string.
4704 # this is an option, not a class/jarfile name.
4707 # once we've seen a class, just do filename completion
4721 if [[ "$cur" == -* ]]; then
4722 # relevant options completion
4723 COMPREPLY=( $( compgen -W '-client -hotspot -server -classic \
4724 -cp -classpath -D -verbose -verbose:class \
4725 -verbose:gc -version:jni -version \
4726 -showversion -? -help -X -jar \
4727 -ea -enableassertions -da -disableassertions \
4728 -esa -enablesystemassertions \
4729 -dsa -disablesystemassertions ' -- $cur ) )
4731 if [[ "$prev" == -jar ]]; then
4732 # jar file completion
4735 # classes completion
4740 complete -F _java $filenames java
4743 # javadoc completion
4752 prev=${COMP_WORDS[COMP_CWORD-1]}
4755 -@(overview|helpfile|stylesheetfile))
4763 -@(classpath|bootclasspath|docletpath|sourcepath|extdirs))
4769 if [[ "$cur" == -* ]]; then
4770 # relevant options completion
4771 COMPREPLY=( $( compgen -W '-overview -public -protected \
4772 -package -private -help -doclet -docletpath \
4773 -sourcepath -classpath -exclude -subpackages \
4774 -breakiterator -bootclasspath -source -extdirs \
4775 -verbose -locale -encoding -J -d -use -version \
4776 -author -docfilessubdirs -splitindex \
4777 -windowtitle -doctitle -header -footer -bottom \
4778 -link -linkoffline -excludedocfilessubdir \
4779 -group -nocomment -nodeprecated -noqualifier \
4780 -nosince -nodeprecatedlist -notree -noindex \
4781 -nohelp -nonavbar -quiet -serialwarn -tag \
4782 -taglet -tagletpath -charset -helpfile \
4783 -linksource -stylesheetfile -docencoding' -- \
4786 # source files completion
4788 # packages completion
4792 complete -F _javadoc $filenames javadoc
4803 prev=${COMP_WORDS[COMP_CWORD-1]}
4810 -@(classpath|bootclasspath|sourcepath|extdirs))
4816 if [[ "$cur" == -* ]]; then
4817 # relevant options completion
4818 COMPREPLY=( $( compgen -W '-g -g:none -g:lines -g:vars\
4819 -g:source -O -nowarn -verbose -deprecation -classpath\
4820 -sourcepath -bootclasspath -extdirs -d -encoding -source\
4821 -target -help' -- $cur ) )
4823 # source files completion
4827 complete -F _javac $filenames javac
4829 # PINE address-book completion
4839 COMPREPLY=( $( compgen -W '$( awk "{print \$1}" ~/.addressbook 2>/dev/null)' \
4842 complete -F _pineaddr $default pine
4846 # Mutt doesn't have an "addressbook" like Pine, but it has aliases and
4847 # a "query" function to retrieve addresses, so that's what we use here.
4848 have mutt || have muttng && {
4859 local -a newconffiles
4863 while [[ "$1" ]]; do
4864 newconffiles=( $(sed -rn 's|^source[[:space:]]+([^[:space:]]+).*$|\1|p' $(eval echo $1) ) )
4865 for file in "${newconffiles[@]}"; do
4866 [[ ! "$file" ]] || [[ "${sofar/ ${file} / }" != "$sofar" ]] &&
4868 sofar="$sofar $file"
4869 sofar=" $(eval _muttconffiles \"$sofar\" $file) "
4879 local -a conffiles aliases
4882 [ -f ~/.${muttcmd}/${muttcmd}rc ] && muttrc="~/.${muttcmd}/${muttcmd}rc"
4883 [ -f ~/.${muttcmd}rc ] && muttrc="~/.${muttcmd}rc"
4884 [ -z "$muttrc" ] && return 0
4886 conffiles=( $(eval _muttconffiles $muttrc $muttrc) )
4887 aliases=( $( sed -rn 's|^alias[[:space:]]+([^[:space:]]+).*$|\1|p' \
4888 $(eval echo "${conffiles[@]}") ) )
4889 COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "${aliases[*]}" -- $cur ) )
4897 local -a queryresults
4900 querycmd="$( $muttcmd -Q query_command | sed -r 's|^query_command=\"(.*)\"$|\1|; s|%s|'$cur'|' )"
4901 if [ -z "$cur" -o -z "$querycmd" ]; then
4904 queryresults=( $( $querycmd | \
4905 sed -nr '2,$s|^([^[:space:]]+).*|\1|p' ) )
4908 COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "${queryresults[*]}" \
4916 local cur folder spoolfile
4919 # This is currently not working so well. Perhaps this function should
4920 # just call _filedir() for the moment.
4921 if [[ $cur == [=+]* ]]; then
4922 folder="$( $muttcmd -Q folder | sed -r 's|^folder=\"(.*)\"$|\1|' )"
4925 # Match any file in $folder beginning with $cur
4926 # (minus the leading '=' sign).
4927 COMPREPLY=( $( compgen -f -- "$folder/${cur:1}" ) )
4928 COMPREPLY=( ${COMPREPLY[@]#$folder/} )
4930 elif [ "$cur" == !* ]; then
4931 spoolfile="$( $muttcmd -Q spoolfile | sed -r 's|^spoolfile=\"(.*)\"$|\1|' )"
4932 [ ! -z "$spoolfile" ] && eval cur="${cur/^!/$spoolfile}";
4943 prev=${COMP_WORDS[COMP_CWORD-1]}
4947 [ ${COMP_WORDS[0]} == muttng ] && muttcmd="muttng" || muttcmd="mutt"
4951 COMPREPLY=( $( compgen -W '-A -a -b -c -e -f -F -H -i -m -n \
4952 -p -Q -R -s -v -x -y -z -Z -h' \
4966 -@(e|m|Q|s|h|p|R|v|y|z|Z))
4978 complete -F _mutt $default $filenames mutt muttng
4988 # if $COMP_CONFIGURE_HINTS is not null, then completions of the form
4989 # --option=SETTING will include 'SETTING' as a contextual hint
4990 [[ "$cur" != -* ]] && return 0
4992 if [ -n "$COMP_CONFIGURE_HINTS" ]; then
4993 COMPREPLY=( $( $1 --help | awk '/^ --[A-Za-z]/ { print $1; if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,].*//g' | grep ^$cur ) )
4996 COMPREPLY=( $( $1 --help | awk '/^ --[A-Za-z]/ { print $1; if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,=].*//g' | grep ^$cur ) )
4999 complete -F _configure_func $default configure
5001 # Debian reportbug(1) completion
5010 prev=${COMP_WORDS[COMP_CWORD-1]}
5013 -f|--filename|-i|--include|--mta|-o|--output)
5018 COMPREPLY=( $( compgen -W "debian guug kde mandrake help" -- \
5023 COMP_WORDS=(COMP_WORDS[0] $cur)
5029 COMPREPLY=( $( compgen -W "novice standard expert" -- $cur ) )
5033 COMPREPLY=( $( compgen -W "grave serious important normal \
5034 minor wishlist" -- $cur ) )
5037 -u|--ui|--interface)
5038 COMPREPLY=( $( compgen -W "newt text gnome" -- $cur ) )
5042 COMPREPLY=( $( compgen -W "gnats debbugs" -- $cur ) )
5046 COMPREPLY=( $( compgen -W "none patch security upstream sid \
5047 woody potato sarge fixed" -- $cur ))
5054 COMPREPLY=($( compgen -W '-h --help -v --version -a --af -b \
5055 --no-query-bts --query-bts -B --bts -c --configure \
5056 --no-config-files --check-available -d --debug \
5057 --no-check-available -e --editor --email -f \
5058 --filename -g --gnupg -H --header -i --include -j \
5059 --justification -l --ldap --no-ldap -L --list-cc -m \
5060 --maintonly --mode --mua --mta --mutt -n --mh --nmh \
5061 -o --output -p --print -P --pgp --proxy --http_proxy\
5062 -q --quiet -Q --query-only --realname --report-quiet \
5063 --reply-to --replyto -s --subject -S --severity \
5064 --smtphost -t --type -T --tags --template -V -x \
5065 --no-cc --package-version -z --no-compress \
5066 --ui --interface -u \
5067 wnpp boot-floppies kernel-image' -- $cur ) \
5068 $( apt-cache pkgnames -- $cur 2> /dev/null ) )
5072 complete -F _reportbug $filenames reportbug
5074 # Debian querybts(1) completion
5083 prev=${COMP_WORDS[COMP_CWORD-1]}
5087 COMPREPLY=( $( compgen -W "debian guug kde mandrake help" -- \
5091 -u|--ui|--interface)
5092 COMPREPLY=($( compgen -W "newt text gnome" -- $cur ))
5099 COMPREPLY=($( compgen -W '-h --help -v --version -A --archive \
5100 -B --bts -l --ldap --no-ldap --proxy= --http_proxy= \
5101 -s --source -w --web -u --ui --interface \
5102 wnpp boot-floppies' -- $cur ) \
5103 $( apt-cache pkgnames -- $cur 2> /dev/null ) )
5105 complete -F _querybts $filenames querybts
5107 # update-alternatives completion
5109 have update-alternatives && {
5110 installed_alternatives()
5113 # find the admin dir
5114 for i in alternatives dpkg/alternatives rpm/alternatives; do
5115 [ -d /var/lib/$i ] && admindir=/var/lib/$i && break
5117 for (( i=1; i < COMP_CWORD; i++ )); do
5118 if [[ "${COMP_WORDS[i]}" == --admindir ]]; then
5119 admindir=${COMP_WORDS[i+1]}
5123 COMPREPLY=( $( command ls $admindir | grep "^$cur" ) )
5126 _update_alternatives()
5128 local cur prev mode args i
5132 prev=${COMP_WORDS[COMP_CWORD-1]}
5135 --@(altdir|admindir))
5144 # find wich mode to use and how many real args used so far
5145 for (( i=1; i < COMP_CWORD; i++ )); do
5146 if [[ "${COMP_WORDS[i]}" == --@(install|remove|auto|display|config|remove-all) ]]; then
5147 mode=${COMP_WORDS[i]}
5148 args=$(($COMP_CWORD - i))
5160 installed_alternatives
5170 installed_alternatives
5178 installed_alternatives
5181 installed_alternatives
5184 installed_alternatives
5187 installed_alternatives
5190 COMPREPLY=( $( compgen -W '--verbose --quiet --help --version \
5191 --altdir --admindir' -- $cur ) \
5192 $( compgen -W '--install --remove --auto --display \
5193 --config' -- $cur ) )
5196 complete -F _update_alternatives update-alternatives
5208 prev=${COMP_WORDS[COMP_CWORD-1]##*/}
5212 COMPREPLY=( $( compgen -W "old new warn warnall" -- $cur ) )
5216 COMPREPLY=( $( compgen -W "ignore default all module once error" -- $cur ) )
5220 _filedir '@(py|pyc|pyo)'
5224 [[ ${COMP_WORDS[COMP_CWORD-2]} != -@(Q|W) ]] && _filedir
5229 # if '-c' is already given, complete all kind of files.
5230 for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
5231 if [[ ${COMP_WORDS[i]} == -c ]]; then
5237 if [[ "$cur" != -* ]]; then
5238 _filedir '@(py|pyc|pyo)'
5240 COMPREPLY=( $( compgen -W "- -d -E -h -i -O -Q -S -t -u \
5241 -U -v -V -W -x -c" -- $cur ) )
5248 complete -F _python $filenames python
5256 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 ) )
5261 local cur prev prefix temp
5265 prev=${COMP_WORDS[COMP_CWORD-1]}
5268 # completing an option (may or may not be separated by a space)
5269 if [[ "$cur" == -?* ]]; then
5276 # only handle module completion for now
5279 COMPREPLY=( $( compgen -d -P "$prev" -- "$cur" ) )
5288 # handle case where first parameter is not a dash option
5289 if [[ "${COMP_WORDS[COMP_CWORD]}" != -* ]]; then
5294 # complete using basic options
5295 COMPREPLY=( $( compgen -W '-C -s -T -u -U -W -X -h -v -V -c -w -d -D -p \
5296 -n -a -F -l -0 -I -m -M -P -S -x -i -e ' -- $cur ) )
5299 complete -F _perl $filenames perl
5303 local cur prev prefix temp
5307 prev=${COMP_WORDS[COMP_CWORD-1]}
5310 # completing an option (may or may not be separated by a space)
5311 if [[ "$cur" == -?* ]]; then
5318 # complete builtin perl functions
5321 COMPREPLY=( $( compgen -W 'chomp chop chr crypt hex index lc \
5322 lcfirst length oct ord pack q qq reverse rindex sprintf \
5323 substr tr uc ucfirst y m pos quotemeta s split study qr abs \
5324 atan2 cos exp hex int log oct rand sin sqrt srand pop push \
5325 shift splice unshift grep join map qw reverse sort unpack \
5326 delete each exists keys values binmode close closedir \
5327 dbmclose dbmopen die eof fileno flock format getc print \
5328 printf read readdir rewinddir seek seekdir select syscall \
5329 sysread sysseek syswrite tell telldir truncate warn write \
5330 pack read syscall sysread syswrite unpack vec -X chdir chmod \
5331 chown chroot fcntl glob ioctl link lstat mkdir open opendir \
5332 readlink rename rmdir stat symlink umask unlink utime caller \
5333 continue do dump eval exit goto last next redo return \
5334 sub wantarray caller import local my our package use defined \
5335 formline reset scalar undef \
5336 alarm exec fork getpgrp getppid getpriority kill pipe qx \
5337 setpgrp setpriority sleep system times wait waitpid \
5338 import no package require use bless dbmclose dbmopen package \
5339 ref tie tied untie use accept bind connect getpeername \
5340 getsockname getsockopt listen recv send setsockopt shutdown \
5341 socket socketpair msgctl msgget msgrcv msgsnd semctl semget \
5342 semop shmctl shmget shmread shmwrite endgrent endhostent \
5343 endnetent endpwent getgrent getgrgid getgrnam getlogin \
5344 getpwent getpwnam getpwuid setgrent setpwent endprotoent \
5345 endservent gethostbyaddr gethostbyname gethostent \
5346 getnetbyaddr getnetbyname getnetent getprotobyname \
5347 getprotobynumber getprotoent getservbyname getservbyport \
5348 getservent sethostent setnetent setprotoent setservent \
5349 gmtime localtime time times' -- $cur ) )
5356 COMPREPLY=( $( compgen -W '-h -v -t -u -m -l -F -X -f -q' -- $cur ))
5364 COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W '$( PAGER=cat man perl 2>/dev/null | sed -ne "/perl.*Perl overview/,/perlwin32/s/^[^a-z0-9]*\([a-z0-9]*\).*$/\1/p")' -- $cur ) )
5370 complete -F _perldoc $default perldoc
5378 local cur prev file dir i
5382 prev=${COMP_WORDS[COMP_CWORD-1]}
5387 # deal with relative directory
5388 [ "$file" = "$dir" ] && dir=.
5390 COMPREPLY=( $( compgen -f "$dir/RCS/$file" ) )
5392 for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
5393 file=${COMPREPLY[$i]##*/}
5394 dir=${COMPREPLY[$i]%RCS/*}
5395 COMPREPLY[$i]=$dir$file
5398 COMPREPLY=( "${COMPREPLY[@]}" $( compgen -G "$dir/$file*,v" ) )
5400 for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
5401 COMPREPLY[$i]=${COMPREPLY[$i]%,v}
5404 # default to files if nothing returned and we're checking in.
5405 # otherwise, default to directories
5406 [ ${#COMPREPLY[@]} -eq 0 -a $1 = ci ] && _filedir || _filedir -d
5408 complete -F _rcs $filenames ci co rlog rcs rcsdiff
5410 # lilo(8) completion
5415 COMPREPLY=( $( awk -F'=' '/label/ {print $2}' \
5416 /etc/lilo.conf | sed -e 's/"//g' | grep "^$cur" ) )
5425 prev=${COMP_WORDS[COMP_CWORD-1]}
5449 COMPREPLY=( $( compgen -W 'help ChRul EBDA geom geom= \
5450 table= video' -- $cur ) )
5455 if [[ "$cur" == -* ]]; then
5456 # relevant options completion
5457 COMPREPLY=( $( compgen -W '-A -b -c -C -d -f -g -i -I -l -L -m \
5458 -M -p -P -q -r -R -s -S -t -T -u -U -v -V -w -x -z' -- \
5462 complete -F _lilo lilo
5477 COMPREPLY=( $( compgen -W '--help' -- $cur ) )
5480 COMPREPLY=( $( compgen -W '-async-dns -max-connections \
5481 -max-connections-to-host -retries \
5482 -receive-timeout -unrestartable-receive-timeout\
5483 -format-cache-size -memory-cache-size \
5484 -http-proxy -ftp-proxy -download-dir \
5485 -assume-codepage -anonymous -dump -no-connect \
5486 -source -version -help' -- $cur ) )
5489 if [ -r ~/.links/links.his ]; then
5490 COMPREPLY=( $( compgen -W '$( < ~/.links/links.his )' \
5493 _filedir '@(htm|html)'
5500 complete -F _links $filenames links
5502 [ $UNAME = FreeBSD ] && {
5503 # FreeBSD package management tool completion
5507 local cur pkgdir prev
5509 pkgdir=${PKG_DBDIR:-/var/db/pkg}/
5511 prev=${COMP_WORDS[COMP_CWORD-1]}
5513 [ "$prev" = "-o" -o "$prev" = "-p" -o "$prev" = "-W" ] && return 0
5515 COMPREPLY=( $( compgen -d $pkgdir$cur ) )
5516 COMPREPLY=( ${COMPREPLY[@]#$pkgdir} )
5520 complete -F _pkg_delete $dirnames pkg_delete pkg_info
5521 have pkg_deinstall && complete -F _pkg_delete $dirnames pkg_deinstall
5523 # FreeBSD kernel module commands
5530 [ -d $moddir ] || moddir=/boot/kernel/
5533 COMPREPLY=( $( compgen -f $moddir$cur ) )
5534 COMPREPLY=( ${COMPREPLY[@]#$moddir} )
5535 COMPREPLY=( ${COMPREPLY[@]%.ko} )
5539 complete -F _kldload $filenames kldload
5545 COMPREPLY=( $(kldstat | sed -ne "s/^.*[ \t]\+\($cur[a-z_]\+\).ko$/\1/p") )
5547 complete -F _kldunload $filenames kldunload
5550 # FreeBSD portupgrade completion
5555 local cur pkgdir prev
5557 pkgdir=${PKG_DBDIR:-/var/db/pkg}/
5559 prev=${COMP_WORDS[COMP_CWORD-1]}
5561 [ "$prev" = "-l" -o "$prev" = "-L" -o "$prev" = "-o" ] && return 0
5563 COMPREPLY=( $( compgen -d $pkgdir$cur ) )
5564 COMPREPLY=( ${COMPREPLY[@]#$pkgdir} )
5565 COMPREPLY=( ${COMPREPLY[@]%-*} )
5569 complete -F _portupgrade $dirnames portupgrade
5571 # FreeBSD portinstall completion
5576 local cur portsdir prev indexfile
5579 portsdir=${PORTSDIR:-/usr/ports}/
5581 prev=${COMP_WORDS[COMP_CWORD-1]}
5583 indexfile=$portsdir/INDEX-5
5584 # Then INDEX if INDEX-5 does not exist or system is not FreeBSD 5.x
5585 [ "${OSTYPE%.*}" = "freebsd5" -a -f $indexfile ] ||
5586 indexfile=$portsdir/INDEX
5588 [ "$prev" = "-l" -o "$prev" = "-L" -o "$prev" = "-o" ] && return 0
5590 COMPREPLY=( $( egrep "^$cur" < $indexfile | cut -d'|' -f1 ) )
5591 COMPREPLY2=( $( egrep "^[^\|]+\|$portsdir$cur" < $indexfile | \
5593 COMPREPLY2=( ${COMPREPLY2[@]#$portsdir} )
5594 COMPREPLY=( "${COMPREPLY[@]}" "${COMPREPLY2[@]}" )
5598 complete -F _portinstall $dirnames portinstall
5600 # Slackware Linux removepkg completion
5602 have removepkg && [ -f /etc/slackware-version ] &&
5610 COMPREPLY=( $( (cd /var/log/packages; compgen -f -- "$cur") ) )
5612 complete -F _removepkg $filenames removepkg &&
5613 complete $dirnames -f -X '!*.tgz' installpkg upgradepkg explodepkg
5615 # look(1) completion
5625 if [ $COMP_CWORD = 1 ]; then
5626 COMPREPLY=( $( compgen -W '$(look $cur)' ) )
5629 complete -F _look $default look
5631 # ypcat(1) and ypmatch(1) completion
5641 [ $1 = ypcat ] && [ $COMP_CWORD -gt 1 ] && return 0
5642 [ $1 = ypmatch ] && [ $COMP_CWORD -gt 2 ] && return 0
5644 if [ $1 = ypmatch ] && [ $COMP_CWORD -eq 1 ] && \
5645 [ ${#COMP_WORDS[@]} -eq 3 ]; then
5646 map=${COMP_WORDS[2]}
5647 COMPREPLY=( $( compgen -W '$( ypcat $map | \
5648 cut -d':' -f 1 )' -- $cur) )
5650 [ $1 = ypmatch ] && [ $COMP_CWORD -ne 2 ] && return 0
5651 COMPREPLY=( $( compgen -W \
5652 '$( echo $(ypcat -x | cut -d"\"" -f 2))' -- $cur))
5657 complete -F _ypmatch ypmatch ypcat
5659 # mplayer(1) completion
5662 _mplayer_options_list()
5665 COMPREPLY=( $( $1 $2 help 2> /dev/null | \
5666 sed -e '1,/^Available/d' | awk '{print $1}' | \
5667 sed -e 's/:$//' -e 's/^'${2#-}'$//' -e 's/<.*//' | \
5673 local cmd cur prev skinsdir IFS=$' \t\n' i j k=0
5676 cmd=${COMP_WORDS[0]}
5678 prev=${COMP_WORDS[COMP_CWORD-1]}
5681 -@(ac|afm|vc|vfm|ao|vo|vop|fstype))
5682 _mplayer_options_list mplayer $prev
5686 _mplayer_options_list mencoder $prev
5690 _filedir '@(mp3|MP3|mpg|MPG|ogg|OGG|wav|WAV|mid|MID|flac|FLAC|mka|MKA)'
5694 _filedir '@(desc|ttf)'
5698 _filedir '@(srt|SRT|sub|SUB|txt|TXT|utf|UTF|rar|RAR|mpsub|smi|js|ssa|SSA|aas|AAS)'
5702 _filedir '@(idx|IDX|ifo|IFO|sub|SUB)'
5704 COMPREPLY=( $( for i in "${COMPREPLY[@]}"; do
5705 if [ -f $i -a -r $i ]; then
5715 _filedir '@(ifo|IFO)'
5719 _filedir '@(bin|BIN|cue|CUE)'
5723 # if you don't have installed mplayer in /usr/local you
5724 # may want to set the MPLAYER_SKINS_DIR global variable
5725 if [ -n "$MPLAYER_SKINS_DIR" ]; then
5726 skinsdir=$MPLAYER_SKINS_DIR
5728 skinsdir=/usr/local/share/mplayer/Skin
5732 for i in ~/.mplayer/Skin $skinsdir; do
5733 if [ -d $i -a -r $i ]; then
5734 for j in $( compgen -d $i/$cur ); do
5735 COMPREPLY[$k]=${j#$i/}
5743 -@(mixer|@(cdrom|dvd)-device|dvdauth|fb|zrdev))
5748 -@(edl?(out)|lircconf|menu-cfg|playlist|csslib|dumpfile)| \
5749 -@(subfile|vobsub|aofile|fbmodeconfig|include|o|dvdkey)| \
5754 -@(auto@(q|sync)|loop|menu-root|speed|sstep|aid|alang)| \
5755 -@(?(@(audio|sub)-)demuxer|bandwidth|cache|chapter)| \
5756 -@(dvd?(angle)|fps|frames|mc|passwd|user|sb|srate|ss|vcd)| \
5757 -@(vi?(d|vo)|ffactor|sid|slang|spu@(align|aa|gauss))| \
5758 -@(vobsubid|delay|bpp|brightness|contrast|dfbopts|display)| \
5759 -@(fbmode|geometry|guiwid|hue|icelayer|screen[wh]|wid)| \
5760 -@(monitor@(aspect|-@(dotclock|[hv]freq))|panscan|saturation)| \
5761 -@(xineramascreen|zr@(crop|norm|quality|[xy]doff|[vh]dec))| \
5762 -@(aspect|pp|x|y|xy|z|stereo|audio-@(density|delay|preload))| \
5763 -@(endpos|osdlevel|ffourcc|sws|channels|skiplimit|format)| \
5764 -@(ofps|aa@(driver|@(osd|sub)color)|vobsubout?(i@(ndex|d)))| \
5765 -sub@(-bg-@(alpha|color)|cp|delay|fps|pos|align|width)| \
5766 -sub@(font-@(blur|outline|autoscale|encoding|@(osd|text)-scale)))
5770 COMPREPLY=( $( compgen -W 'ec er= bug= idct= gray' \
5775 COMPREPLY=( $( compgen -W 'vcodec= vqmin= vqscale= \
5776 vqmax= mbqmin= mbqmax= vqdiff= \
5777 vmax_b_frames= vme= vhq v4mv \
5778 keyint= vb_strategy= vpass= \
5779 aspect= vbitrate= vratetol= \
5780 vrc_maxrate= vrc_minrate= \
5781 vrc_buf_size= vb_qfactor= vi_qfactor= \
5782 vb_qoffset= vi_qoffset= vqblur= \
5783 vqcomp= vrc_eq= vrc_override= \
5784 vrc_init_cplx= vqsquish= vlelim= \
5785 vcelim= vstrict= vdpart vpsize= gray \
5786 vfdct= idct= lumi_mask= dark_mask= \
5787 tcplx_mask= scplx_mask= naq ildct \
5788 format= pred qpel precmp= cmp= \
5789 subcmp= predia= dia= trell last_pred= \
5790 preme= subq= psnr mpeg_quant aic umv' \
5795 COMPREPLY=( $( compgen -W 'lgb= cgb= ls= cs= chs= \
5800 COMPREPLY=( $( compgen -W 'noprogressive progressive \
5801 nobaseline baseline optimize= \
5802 smooth= quality= outdir=' -- $cur ) )
5806 COMPREPLY=( $( compgen -W 'dr2 nodr2' -- $cur ) )
5810 COMPREPLY=( $( compgen -W 'pass= bitrate= \
5811 fixed_quant= me_quality= 4mv \
5812 rc_reaction_delay_factor= \
5813 rc_averaging_period= rc_buffer= \
5814 quant_range= min_key_interval= \
5815 max_key_interval= mpeg_quant \
5816 mod_quant lumi_mask hintedme \
5817 hintfile debug keyframe_boost= \
5818 kfthreshold= kfreduction=' -- $cur ) )
5822 COMPREPLY=( $( compgen -W 'br= key= deinterlace q= \
5823 min_quant= max_quant= rc_period= \
5824 rc_reaction_period= crispness= \
5825 rc_reaction_ratio= pass= vbrpass= \
5830 COMPREPLY=( $( compgen -W 'name= artist= genre= \
5831 subject= copyright= srcform= \
5832 comment= help' -- $cur ) )
5836 COMPREPLY=( $( compgen -W 'vbr= abr cbr br= q= aq= \
5837 ratio= vol= mode= padding= fast \
5838 preset= help' -- $cur ) )
5842 COMPREPLY=( $( compgen -W 'on channels= rate= \
5843 samplesize= format=' -- $cur ) )
5847 COMPREPLY=( $( compgen -W 'on fps= sqcif qcif cif \
5848 4cif pal ntsc w= h= y420 yv12 yuy2 \
5849 y8 format= size=' -- $cur ) )
5853 COMPREPLY=( $( compgen -W 'list= delay= format= fout= \
5854 volume= mul= softclip' -- $cur ) )
5858 COMPREPLY=( $( compgen -W 'ar-mode= iec958-encoded \
5859 iec958-decoded mute ucode= 75ire bw \
5860 color interlaced macrovision= norm= \
5861 square-pixel ccir601-pixel cr-left= \
5862 cr-right= cr-top= cr-bot= ck-rmin= \
5863 ck-gmin= ck-bmin= ck-rmax= ck-gmax= \
5864 ck-bmax= ck-r= ck-g= ck-b= \
5865 ignore-cache= ol-osd= olh-cor= \
5866 olw-cor= olx-cor= oly-cor= overlay \
5867 overlay-ratio= update-cache' -- $cur ))
5871 COMPREPLY=( $( compgen -W 'on noaudio driver= device= \
5872 input= freq= outfmt= width= height= \
5873 buffersize= norm= channel= chanlist= \
5874 audiorate= forceaudio alsa amode= \
5875 forcechan= adevice= audioid= volume= \
5876 bass= treble= balance= fps= \
5877 channels= immediatemode=' -- $cur ) )
5881 COMPREPLY=( $( compgen -W 'on w= h= fps= type=' \
5886 COMPREPLY=( $( compgen -W 'speed= paranoia= \
5887 generic-dev= sector-size= overlap= \
5888 toc-bias toc-offset= skip noskip' \
5893 COMPREPLY=( $( compgen -W 'conf= ar-delay ar-rate \
5894 keylist cmdlist js-dev file' -- $cur ) )
5898 COMPREPLY=( $( compgen -W 'resample resample= \
5899 channels channels= format format= \
5900 volume volume= delay delay= pan \
5901 pan= sub sub= surround surround=' \
5906 COMPREPLY=( $( compgen -W 'force= list=' -- $cur ) )
5913 COMPREPLY=( $( compgen -W '-aid -alang -audio-demuxer \
5914 -audiofile -cdrom-device -cache -cdda \
5915 -channels -chapter -csslib -demuxer \
5916 -dvd -dvd-device -dvdangle -dvdauth \
5917 -dvdkey -dvdnav -forceidx -fps -frames \
5918 -hr-mp3-seek -idx -mc -mf -ni -nobps \
5919 -passwd -rawaudio -rtsp-stream-over-tcp\
5920 -skipopening -sb -srate -ss -tv -user \
5921 -vcd -vid -vivo -ifo -ffactor -font \
5922 -noautosub -nooverlapsub -sid -slang \
5923 -sub -subcc -subcp -sub-demuxer \
5924 -subdelay -subfont-autoscale \
5925 -subfont-blur -subfont-encoding \
5926 -subfont-osd-scale -subfont-outline \
5927 -subfont-text-scale -subfps -subfile \
5928 -subpos -unicode -utf8 -vobsub \
5929 -vobsubid -ac -afm -aspect -flip \
5930 -lavdopts -noaspect -nosound -pp -ssf \
5931 -stereo -sws -vc -vfm -vop -xvidopts\
5932 -xy -zoom -bandwidth -cuefile \
5933 -noextbased -rawvideo -overlapsub \
5934 -sub-bg-alpha -sub-bg-color -subalign \
5935 -subwidth -sub-no-text-pp -spualign \
5936 -spuaa -spugauss -pphelp -verbose -v \
5937 -noni -noidx -nohr-mp3-seek -extbased \
5938 -bps -oldpp -nozoom -noflip -nounicode \
5939 -noutf8' -- $cur ) )
5940 # add mplayer specific options
5941 [[ "$cmd" == @(?(g)mplayer) ]] && COMPREPLY=( "${COMPREPLY[@]}" \
5942 $(compgen -W '-autoq -autosync -benchmark \
5943 -framedrop -h -help -hardframedrop \
5944 -identify -input -lircconf -loop \
5945 -nojoystick -nolirc -nortc -playlist \
5946 -quiet -really-quiet -rnd -sdp -skin \
5947 -slave -softsleep -speed -sstep \
5948 -use-stdin -dumpaudio -dumpfile \
5949 -dumpstream -dumpvideo -dumpmicrodvdsub\
5950 -dumpmpsub -dumpsrtsub -dumpjacosub \
5951 -dumpsami -dumpsub -osdlevel -af \
5952 -af-adv -ao -aofile -aop -delay -mixer \
5953 -nowaveheader -bpp -brightness \
5954 -contrast -display -double -dr -dxr2 \
5955 -fb -fbmode -fbmodeconfig -forcexv -fs \
5956 -geometry -hue -icelayer -jpeg \
5957 -monitor-dotclock -monitor-hfreq \
5958 -monitor-vfreq -monitoraspect \
5959 -nograbpointer -noslices -panscan \
5960 -rootwin -saturation -screenw -screenh \
5961 -stop-xscreensaver -vm -vo -vsync -wid \
5962 -xineramascreen -z -zrbw -zrcrop \
5963 -zrdev -zrfd -zrhelp -zrnorm -zrquality \
5964 -zrvdec -zrhdec -zrxdoff -zrydoff -y \
5965 -edl -edlout -enqueue -fixed-vo \
5966 -menu -menu-root -menu-cfg -shuffle \
5967 -format -aahelp -dfbopts -fstype \
5968 -guiwid -nokeepaspect -x --help \
5969 -aaosdcolor -aasubcolor -aadriver \
5970 -aaextended -aaeight' -- $cur) )
5971 # add mencoder specific options
5972 [[ "$cmd" = mencoder ]] && COMPREPLY=( "${COMPREPLY[@]}" \
5973 $(compgen -W '-audio-density -audio-delay \
5974 -audio-preload -divx4opts -endpos \
5975 -ffourcc -include -info -lameopts \
5976 -lavcopts -noskip -o -oac -ofps -ovc \
5977 -passlogfile -skiplimit -vobsubout \
5978 -vobsuboutindex -vobsuboutid \
5979 -xvidencopts -of --verbose' -- $cur) )
5982 _filedir '@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|ASF|vob|VOB|bin|BIN|dat|DAT|vcd|VCD|ps|PS|pes|PES|fli|FLI|flv|FLV|viv|VIV|rm?(j)|RM?(J)|ra?(m)|RA?(M)|yuv|YUV|mov|MOV|qt|QT|mp[34]|MP[34]|m4v|M4V|og[gm]|OG[GM]|wav|WAV|dump|DUMP|mk[av]|MK[AV]|m4a|M4A|aac|AAC|m2v|M2V|dv|DV|rmvb|RMVB|mid|MID|ts|TS|3gp|mpc|MPC|flac|FLAC|flv|FLV|divx|DIVX)'
5988 complete $filenames -F _mplayer mplayer mencoder gmplayer kplayer
5991 # KDE dcop completion
6000 if [ -z $cur ]; then
6001 compstr=${COMP_WORDS[*]}
6003 compstr=$( command echo ${COMP_WORDS[*]} | sed "s/ $cur$//" )
6005 COMPREPLY=( $( compgen -W '$( command $compstr | sed s/\(.*\)// )' -- $cur ) )
6007 complete -F _dcop dcop
6009 # wvdial(1) completion
6014 local cur prev config i IFS=$'\t\n'
6018 prev=${COMP_WORDS[COMP_CWORD-1]}
6029 COMPREPLY=( $( compgen -W '--config --chat \
6030 --remotename --help --version --no-syslog' \
6034 # start with global and personal config files
6035 config="/etc/wvdial.conf"$'\t'"$HOME/.wvdialrc"
6036 # replace with command line config file if present
6037 for (( i=1; i < COMP_CWORD; i++ )); do
6038 if [[ "${COMP_WORDS[i]}" == "--config" ]]; then
6039 config=${COMP_WORDS[i+1]}
6043 # parse config files for sections and
6044 # remove default section
6045 COMPREPLY=( $( sed -ne \
6046 "s|^\[Dialer \($cur.*\)\]$|\1|p" \
6047 $config 2>/dev/null |grep -v '^Defaults$'))
6049 COMPREPLY=${COMPREPLY// /\\ }
6054 complete -F _wvdial wvdial
6065 prev=${COMP_WORDS[COMP_CWORD-1]}
6068 -@(s|-sign|-clearsign|-decrypt-files|-load-extension))
6072 --@(export|@(?(l|nr|nrl)sign|edit)-key))
6073 # return list of public keys
6074 COMPREPLY=( $( compgen -W "$( gpg --list-keys 2>/dev/null | sed -ne 's@^pub.*/\([^ ]*\).*\(<\([^>]*\)>\).*$@\1 \3@p')" -- "$cur" ))
6078 COMPREPLY=( $( compgen -W "$( gpg --list-keys 2>/dev/null | sed -ne 's@^pub.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ))
6079 if [ -e ~/.gnupg/gpg.conf ]; then
6080 COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$( sed -ne 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' ~/.gnupg/gpg.conf )" -- "$cur") )
6086 if [[ "$cur" == -* ]]; then
6087 COMPREPLY=( $( compgen -W '-s -b -e -f -c -d -a -r -u -Z -o -v\
6088 -q -n -N $(gpg --dump-options)' -- $cur ) )
6092 complete -F _gpg $default gpg
6094 # iconv(1) completion
6103 prev=${COMP_WORDS[COMP_CWORD-1]}
6106 -@(f|t|-@(from|to)-code))
6107 COMPREPLY=( $( compgen -W \
6108 '$( iconv --list | sed -e "s@//@@;" )' -- "$cur" ) )
6114 if [[ "$cur" = -* ]]; then
6115 COMPREPLY=( $( compgen -W '--from-code -f --to-code -t --list
6116 --output -o --verbose' -- "$cur" ) )
6120 complete -F _iconv $default iconv
6122 # dict(1) completion
6124 { have dict || have rdict; } && {
6127 dict $host $port $1 2>/dev/null | sed -ne \
6128 's/^['$'\t '']['$'\t '']*\([^'$'\t '']*\).*$/\1/p'
6133 local cur prev host port db dictfile
6137 prev=${COMP_WORDS[COMP_CWORD-1]}
6138 dictfile=/usr/share/dict/words
6140 for (( i=1; i < COMP_CWORD; i++ )); do
6141 case "${COMP_WORDS[i]}" in
6143 host=${COMP_WORDS[i+1]}
6144 [ -n "$host" ] && host="-h $host"
6148 port=${COMP_WORDS[i+1]}
6149 [ -n "$port" ] && port="-p $port"
6153 db=${COMP_WORDS[i+1]}
6154 [ -n "$db" ] && host="-d $db"
6162 if [[ "$cur" = -* ]]; then
6163 COMPREPLY=( $( compgen -W '-h --host -p --port -d --database \
6164 -m --match -s --strategy -c --config -C \
6165 --nocorrect -D --dbs -S --strats -H \
6166 --serverhelp -i --info -I --serverinfo \
6167 -a --noauth -u --user -k --key -V --version \
6168 -L --license --help -v --verbose -r --raw \
6169 -P --pager --debug --html --pipesize --client' \
6175 -@(d|-database|i|info))
6176 COMPREPLY=( $( compgen -W '$( _dictdata -D )' -- "$cur" ) )
6180 COMPREPLY=( $( compgen -W '$( _dictdata -S )' -- "$cur" ) )
6187 [ -r $dictfile ] && \
6188 COMPREPLY=( $( compgen -W '$( cat $dictfile )' -- "$cur" ) )
6190 complete -F _dict $default dict rdict
6193 # cdrecord(1) completion
6198 local cur prev i generic_options track_options track_mode
6202 prev=${COMP_WORDS[COMP_CWORD-1]}
6204 # foo=bar style option
6205 if [[ "$cur" == *=* ]]; then
6214 COMPREPLY=( $( compgen -W 'help all fast \
6215 track unreserve trtail unclose session' \
6220 COMPREPLY=( $( compgen -W 'burnfree noburnfree\
6221 varirec= audiomaster forcespeed noforcespeed\
6222 speedread nospeedread singlesession \
6223 nosinglesession hidecdr nohidecdr tattooinfo\
6224 tattoofile=' -- $cur ) )
6230 generic_options=(-version -v -V -d -silent -s -force -immed -dummy \
6231 -dao -raw -raw96r -raw96p -raw16 -multi -msinfo -toc \
6232 -atip -fix -nofix -waiti -load -lock -eject -format \
6233 -setdropts -checkdrive -prcap -inq -scanbus -reset \
6234 -abort -overburn -ignsize -useinfo -packet -noclose \
6235 -text debug= kdebug= kd= minbuf= speed= blank= fs= \
6236 dev= gracetime= timeout= driver= driveropts= \
6237 defpregap= pktsize= mcn= textfile= cuefile=)
6238 track_options=(-audio -swab -data -mode2 -xa -xa1 -xa2 -xamix -cdi \
6239 -isosize -pad padsize= -nopad -shorttrack -noshorttrack\
6240 pregap= -preemp -nopreemp -copy -nocopy -scms tcsize= \
6242 # look if previous was either a file or a track option
6244 if [ $COMP_CWORD -gt 1 ]; then
6245 if [ -f "$prev" ]; then
6248 for (( i=0; i < ${#track_options[@]}; i++ )); do
6249 if [[ "${track_options[i]}" == "$prev" ]]; then
6257 # files are always eligible completion
6259 # track options are always available
6260 COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W '${track_options[@]}' -- $cur ) )
6261 # general options are no more available after file or track option
6262 if [ $track_mode -eq 0 ]; then
6263 COMPREPLY=( "${COMPREPLY[@]}" \
6264 $( compgen -W '${generic_options[@]}' -- $cur ) )
6268 complete -F _cdrecord $filenames cdrecord
6270 # mkisofs(8) completion
6279 prev=${COMP_WORDS[COMP_CWORD-1]}
6282 -@(o|abstract|biblio|check-session|copyright|log-file|root-info|prep-boot|*-list))
6287 COMPREPLY=( $( mkisofs -input-charset help 2>&1 | \
6288 tail +3 | grep "^$cur") )
6301 if [[ "$cur" == -* ]]; then
6302 COMPREPLY=( $( compgen -W '-abstract -A -allow-lowercase \
6303 -allow-multidot -biblio -cache-inodes \
6304 -no-cache-inodes -b -eltorito-alt-boot -B -G \
6305 -hard-disk-boot -no-emul-boot -no-boot \
6306 -boot-load-seg -boot-load-size \
6307 -boot-info-table -C -c -check-oldname \
6308 -check-session -copyright -d -D -dir-mode \
6309 -dvd-video -f -file-mode -gid -gui \
6310 -graft-points -hide -hide-list -hidden \
6311 -hidden-list -hide-joliet -hide-joliet-list \
6312 -hide-joliet-trans-tbl -hide-rr-moved \
6313 -input-charset -output-charset -iso-level -J \
6314 -joliet-long -jcharset -l -L -log-file -m \
6315 -exclude-list -max-iso9660-filenames -M -N \
6316 -new-dir-mode -nobak -no-bak -force-rr -no-rr \
6317 -no-split-symlink-components \
6318 -no-split-symlink-fields -o -pad -no-pad \
6319 -path-list -P -p -print-size -quiet -R -r \
6320 -relaxed-filenames -sort -split-output \
6321 -stream-media-size -stream-file-name -sysid -T\
6322 -table-name -ucs-level -udf -uid \
6323 -use-fileversion -U -no-iso-translate -V \
6324 -volset -volset-size -volset-seqno -v -x -z \
6325 -hfs -apple -map -magic -hfs-creator \
6326 -hfs-type -probe -no-desktop -mac-name \
6327 -boot-hfs-file -part -auto -cluster-size \
6328 -hide-hfs -hide-hfs-list -hfs-volid \
6329 -icon-position -root-info -prep-boot \
6330 -input-hfs-charset -output-hfs-charset \
6331 -hfs-unlock -hfs-bless -hfs-parms --cap \
6332 --netatalk --double --ethershare --ushare \
6333 --exchange --sgi --xinet --macbin --single \
6334 --dave --sfm --osx-double --osx-hfs' -- $cur ))
6340 complete -F _mkisofs $filenames mkisofs
6351 prev=${COMP_WORDS[COMP_CWORD-1]}
6353 # -name value style option
6361 # --name=value style option
6362 if [[ "$cur" == *=* ]]; then
6366 --@(edit|view|ftplog|printwd))
6373 if [[ "$cur" == -* ]]; then
6374 COMPREPLY=( $( compgen -W '-a --stickchars -b --nocolor -c \
6375 --color -C --colors= -d --nomouse -e --edit= -f \
6376 --datadir -k --resetsoft -l --ftplog= -P --printwd= \
6377 -s --slow -t --termcap -u --nosubshell -U --subshell \
6378 -v --view= -V --version -x --xterm -h --help' -- $cur ) )
6383 complete -F _mc $filenames mc
6390 local cur prev special
6394 prev=${COMP_WORDS[COMP_CWORD-1]}
6396 for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
6397 if [[ ${COMP_WORDS[i]} == @(install|update|upgrade|remove|erase|deplist) ]]; then
6398 special=${COMP_WORDS[i]}
6402 if [ -n "$special" ]; then
6405 COMPREPLY=( $( compgen -W '$( yum -C list | cut -d" " -f1 )' -- $cur ) )
6409 _rpm_installed_packages
6417 COMPREPLY=( $( compgen -W '--installroot --version --help --enablerepo --disablerepo --exclude --obsoletes --noplugins' -- $cur ) )
6421 COMPREPLY=( $( compgen -W '-c -e -d -y -t -R -C -h' -- $cur ) )
6428 COMPREPLY=( $( compgen -W 'all available updates installed extras obsoletes recent' -- $cur ) )
6431 COMPREPLY=( $( compgen -W 'packages headers metadata cache dbcache all' -- $cur ) )
6443 COMPREPLY=( $( compgen -W 'install update check-update upgrade remove list \
6444 search info provides clean groupinstall groupupdate \
6445 grouplist deplist erase groupinfo groupremove \
6446 localinstall localupdate makecache resolvedep \
6447 shell whatprovides' -- $cur ) )
6451 complete -F _yum $filenames yum
6453 # yum-arch(8) completion
6463 COMPREPLY=( $( compgen -W '-d -v -vv -n -c -z -s -l -q' -- $cur ) )
6473 complete -F _yum_arch $filenames yum-arch
6476 # ImageMagick completion
6482 prev=${COMP_WORDS[COMP_CWORD-1]}
6486 COMPREPLY=( $( compgen -W 'Red Green Blue Opacity \
6487 Matte Cyan Magenta Yellow Black' -- $cur ) )
6491 COMPREPLY=( $( compgen -W 'shared private' -- $cur ) )
6495 COMPREPLY=( $( compgen -W 'GRAY OHTA RGB Transparent \
6496 XYZ YCbCr YIQ YPbPr YUV CMYK' -- $cur ) )
6500 COMPREPLY=( $( compgen -W 'Over In Out Atop Xor Plus \
6501 Minus Add Subtract Difference Multiply Bumpmap\
6502 Copy CopyRed CopyGreen CopyBlue CopyOpacity' \
6507 COMPREPLY=( $( compgen -W 'None BZip Fax Group4 JPEG \
6508 Lossless LZW RLE Zip' -- $cur ) )
6512 COMPREPLY=( $( compgen -W 'Undefined None Background \
6513 Previous' -- $cur ) )
6517 COMPREPLY=( $( compgen -W 'AdobeCustom AdobeExpert \
6518 AdobeStandard AppleRoman BIG5 GB2312 Latin2 \
6519 None SJIScode Symbol Unicode Wansung' -- $cur))
6523 COMPREPLY=( $( compgen -W 'MSB LSB' -- $cur ) )
6527 COMPREPLY=( $( compgen -W 'Point Box Triangle Hermite \
6528 Hanning Hamming Blackman Gaussian Quadratic \
6529 Cubic Catrom Mitchell Lanczos Bessel Sinc' \
6534 COMPREPLY=( $( convert -list format | \
6535 awk '/ [r-][w-][+-] / {print $1}' | \
6536 tr -d '*' | tr [:upper:] [:lower:] | \
6541 COMPREPLY=( $( compgen -W 'Northwest North NorthEast \
6542 West Center East SouthWest South SouthEast' \
6547 COMPREPLY=( $( compgen -W 'Absolute Perceptual \
6548 Relative Saturation' -- $cur ) )
6552 COMPREPLY=( $( compgen -W 'None Line Plane Partition' \
6557 COMPREPLY=( $( compgen -W 'Disk File Map Memory' \
6562 COMPREPLY=( $( compgen -W 'Delegate Format Magic \
6563 Module Resource Type' -- $cur ) )
6567 COMPREPLY=( $( compgen -W 'best default gray red \
6568 green blue' -- $cur ) )
6573 COMPREPLY=( $( compgen -W 'Uniform Gaussian \
6575 Impulse Laplacian Poisson' -- $cur ) )
6579 COMPREPLY=( $( compgen -W 'Rotate Shear Roll Hue \
6580 Saturation Brightness Gamma Spiff \
6581 Dull Grayscale Quantize Despeckle \
6582 ReduceNoise AddNoise Sharpen Blur \
6583 Treshold EdgeDetect Spread Shade \
6584 Raise Segment Solarize Swirl Implode \
6585 Wave OilPaint CharcoalDrawing JPEG' \
6589 -@(mask|profile|texture|tile|write))
6594 COMPREPLY=( $( compgen -W 'Bilevel Grayscale Palette \
6595 PaletteMatte TrueColor TrueColorMatte \
6596 ColorSeparation ColorSeparationlMatte \
6597 Optimize' -- $cur ) )
6601 COMPREPLY=( $( compgen -W 'Undefined PixelsPerInch \
6602 PixelsPerCentimeter' -- $cur ) )
6606 COMPREPLY=( $( compgen -W 'Constant Edge mirror tile' \
6611 COMPREPLY=( $( compgen -W 'StaticGray GrayScale \
6612 StaticColor PseudoColor TrueColor \
6613 DirectColor defaut visualid' -- $cur ))
6628 if [[ "$cur" == -* ]]; then
6629 COMPREPLY=( $( compgen -W '-adjoin -affine -antialias -append \
6630 -authenticate -average -background -black-threshold \
6631 -blue-primary -blur -border -bordercolor -channel \
6632 -charcoal -chop -clip -coalesce -colorize -colors \
6633 -colorspace -comment -compress -contrast -convolve \
6634 -crop -cycle -debug -deconstruct -delay -density \
6635 -depth -despeckle -display -dispose -dither -draw \
6636 -edge -emboss -encoding -endian -enhance -equalize \
6637 -extract -fill -filter -flatten -flip -flop -font \
6638 -frame -fuzz -gamma -gaussian -geometry \
6639 -green-primary -gravity -help -implode -intent \
6640 -interlace -label -lat -level -limit -list -log -loop \
6641 -map -mask -matte -median -modulate -monochrome \
6642 -morph -mosaic -negate -noop -noise -normalize \
6643 -opaque -ordered-dither -page -paint -ping -pointsize \
6644 -preview -profile -quality -raise -random-threshold \
6645 -region -raise -red-primary -render -resize -resample \
6646 -roll -rotate -sample -sampling-factor -scale -scene \
6647 -seed -segment -shade -sharpen -shave -shear -size \
6648 -solarize -spread -stroke -strokewidth -swirl \
6649 -texture -threshold -thumbnail -tile -transform \
6650 -transparent -treedepth -trim -type -undercolor \
6651 -units -unsharp -verbose -version -view \
6652 -virtual-pixel -wave -white-point -white-threshold \
6654 elif [[ "$cur" == +* ]]; then
6655 COMPREPLY=( $( compgen -W '+adjoin +append +compress \
6656 +contrast +debug +dither +endian +gamma +label +map \
6657 +mask +matte +negate +noise +page +raise +render \
6663 complete -F _convert $filenames convert
6674 if [[ "$cur" == -* ]]; then
6675 COMPREPLY=( $( compgen -W '-affine -antialias -authenticate \
6676 -background -black-threshold -blue-primary -blur \
6677 -border -bordercolor -channel -charcoal -chop \
6678 -colorize -colors -colorspace -comment -compress \
6679 -contrast -convolve -crop -cycle -debug -delay \
6680 -density -depth -despeckle -display -dispose -dither \
6681 -draw -edge -emboss -encoding -endian -enhance \
6682 -equalize -extract -fill -filter -flip -flop -font \
6683 -format -frame -fuzz -gamma -gaussian -geometry \
6684 -green-primary -implode -interlace -help -label -lat \
6685 -level -limit -list -log -loop -map -mask -matte \
6686 -median -modulate -monochrome -negate -noop \
6687 -normalize -opaque -page -paint -fill -ordered-dither \
6688 -pointsize -profile -quality -raise -random-threshold \
6689 -red-primary -region -resample -resize -roll -rotate \
6690 -sample -sampling-factor -scale -scene -seed -segment \
6691 -shade -sharpen -shear -size -solarize -spread \
6692 -stroke -strokewidth -swirl -texture -threshold \
6693 -thumbnail -tile -transform -transparent -treedepth \
6694 -trim -type -undercolor -units -unsharp -verbose \
6695 -version -view -virtual-pixel -wave -white-point \
6696 -white-threshold' -- $cur ) )
6697 elif [[ "$cur" == +* ]]; then
6698 COMPREPLY=( $( compgen -W '+compress +contrast +debug +dither \
6699 +endian +gamma +label +map +mask +matte +negate +page \
6705 complete -F _mogrify $filenames mogrify
6716 if [[ "$cur" == -* ]]; then
6717 COMPREPLY=( $( compgen -W '-authenticate -backdrop -border \
6718 -colormap -colors -colorspace -comment -compress \
6719 -contrast -crop -debug -delay -density -depth \
6720 -despeckle -display -dispose -dither -edge -endian \
6721 -enhance -extract -filter -flip -flop -frame -gamma \
6722 -geometry -help -immutable -interlace -label -limit \
6723 -log -map -matte -monochrome -negate -noop -page \
6724 -quality -raise -remote -roll -rotate -sample \
6725 -sampling-factor -scene -segment -sharpen -size \
6726 -texture -treedepth -trim -update -verbose -version \
6727 -virtual-pixel -window -window_group -write' -- $cur))
6728 elif [[ "$cur" == +* ]]; then
6729 COMPREPLY=( $( compgen -W '+compress +contrast +debug +dither \
6730 +endian +gamma +label +map +matte +negate +page \
6731 +raise +write' -- $cur ) )
6736 complete -F _display $filenames display
6747 if [[ "$cur" == -* ]]; then
6748 COMPREPLY=( $( compgen -W '-authenticate -backdrop -colormap \
6749 -colors -colorspace -crop -debug -delay -density \
6750 -depth -display -dither -extract -gamma -geometry \
6751 -help -interlace -limit -log -matte -map -monochrome \
6752 -noop -pause -remote -rotate -sampling-factor -scene \
6753 -size -treedepth -trim -verbose -version -visual \
6754 -virtual-pixel -window' -- $cur ) )
6755 elif [[ "$cur" == +* ]]; then
6756 COMPREPLY=( $( compgen -W '+debug +dither +gamma +map +matte' -- $cur ) )
6761 complete -F _animate $filenames animate
6772 if [[ "$cur" == -* ]]; then
6773 COMPREPLY=( $( compgen -W '-authenticate -debug -density \
6774 -depth -extract -format -help -interlace -limit -list \
6775 -log -size -sampling-factor -verbose -version \
6776 -virtual-pixel' -- $cur ) )
6777 elif [[ "$cur" == +* ]]; then
6778 COMPREPLY=( $( compgen -W '+debug ' -- $cur ) )
6783 complete -F _identify $filenames identify
6794 if [[ "$cur" == -* ]]; then
6795 COMPREPLY=( $( compgen -W '-adjoin -affine -authenticate \
6796 -blue-primary -blur -colors -colorspace -comment \
6797 -compose -compress -crop -debug -density -depth \
6798 -display -dispose -dither -draw -encoding -endian \
6799 -extract -fill -filter -flip -flop -frame -gamma \
6800 -geometry -gravity -green-primary -interlace -help \
6801 -label -limit -log -matte -mode -monochrome -noop \
6802 -page -pointsize -quality -red-primary -resize \
6803 -rotate -sampling-factor -scene -shadow -size \
6804 -stroke -texture -thumbnail -tile -transform \
6805 -transparent -treedepth -trim -type -verbose \
6806 -version -virtual-pixel -white-point' -- $cur ) )
6807 elif [[ "$cur" == +* ]]; then
6808 COMPREPLY=( $( compgen -W '+adjoin +compress +debug +dither \
6809 +endian +gamma +label +matte +page' -- $cur ) )
6814 complete -F _montage $filenames montage
6825 if [[ "$cur" == -* ]]; then
6826 COMPREPLY=( $( compgen -W '-affine -authenticate \
6827 -blue-primary -colors -colorspace -comment -compose \
6828 -compress -debug -density -depth -displace -display \
6829 -dispose -dissolve -dither -encoding -endian -extract \
6830 -filter -font -geometry -gravity -green-primary -help \
6831 -interlace -label -limit -log -matte -monochrome \
6832 -negate -page -profile -quality -red-primary -rotate \
6833 -resize -sampling-factor -scene -sharpen -size \
6834 -stegano -stereo -thumbnail -tile -transform \
6835 -treedepth -type -units -unsharp -verbose -version \
6836 -virtual-pixel -watermark -white-point -write' \
6838 elif [[ "$cur" == +* ]]; then
6839 COMPREPLY=( $( compgen -W '+compress +debug +dither +endian +label \
6840 +matte +negate +page +write' -- $cur ) )
6845 complete -F _composite $filenames composite
6866 COMPREPLY=( $( compgen -W 'ascii ebcdic ibm block unblock \
6867 lcase notrunc ucase swab noerror sync' \
6875 COMPREPLY=( $( compgen -W '--help --version' -- $cur ) \
6876 $( compgen -W 'bs cbs conv count ibs if obs of seek skip'\
6879 complete -F _dd $nospace $filenames dd
6881 # CUPS cancel(1) completion
6891 COMPREPLY=( $( lpstat | cut -d' ' -f1 | grep "^$cur" ) )
6893 complete -F _cancel $filenames cancel
6895 # aspell(1) completion
6898 _aspell_dictionary()
6901 datadir=/usr/lib/aspell
6902 COMPREPLY=( $( command ls $datadir/*.@(multi|alias) ) )
6903 COMPREPLY=( ${COMPREPLY[@]%.@(multi|alias)} )
6904 COMPREPLY=( $( compgen -W '${COMPREPLY[@]#$datadir/}' -- $cur ) )
6913 prev=${COMP_WORDS[COMP_CWORD-1]}
6915 # --name value style option
6921 @(dump|create|merge))
6922 COMPREPLY=( $( compgen -W 'master personal repl' -- $cur ) )
6931 # --name=value style option
6932 if [[ "$cur" == *=* ]]; then
6936 --@(conf|personal|repl|per-conf))
6940 --@(conf-dir|data-dir|dict-dir|home-dir|local-data-dir|prefix))
6949 COMPREPLY=( $( compgen -W 'none url email sgml tex' -- $cur ) )
6953 COMPREPLY=( $( compgen -W 'ultra fast normal bad-speller' -- $cur ) )
6957 COMPREPLY=( $( compgen -W 'aspell ispell' -- $cur ) )
6963 if [[ "$cur" == -* ]]; then
6964 COMPREPLY=( $( compgen -W '--conf= --conf-dir= --data-dir= --dict-dir= \
6965 --encoding= --add-filter= --rem-filter= --mode= -e \
6966 -H -t --add-extra-dicts= --rem-extra-dicts= \
6967 --home-dir= -W --ignore= --ignore-accents \
6968 --dont-ignore-accents --ignore-case --dont-ignore-case \
6969 --ignore-repl --dont-ignore-repl --jargon= --keyboard= \
6970 --lang= --language-tag= --local-data-dir= -d --master= \
6971 --module= --add-module-search-order= \
6972 --rem-module-search-order= --per-conf= -p --personal= \
6973 --prefix= --repl= -C -B --run-together --dont-run-together \
6974 --run-together-limit= --run-together-min= --save-repl \
6975 --dont-save-repl --set-prefix --dont-set-prefix --size= \
6976 --spelling= --strip-accents --dont-strip-accents \
6977 --sug-mode= --add-word-list-path= --rem-word-list-path= \
6978 -b -x --backup -b|-x --dont-backup --reverse --dont-reverse \
6979 --time --dont-time --keymapping= --add-email-quote= \
6980 --rem-email-quote= --email-margin= --add-tex-command= \
6981 --rem-tex-command= --tex-check-comments \
6982 --dont-tex-check-comments --add-tex-extension= \
6983 --rem-tex-extension= --add-sgml-check= --rem-sgml-check= \
6984 --add-sgml-extension= --rem-sgml-extension=' -- $cur ) )
6986 COMPREPLY=( $( compgen -W '-? help -c check -a pipe -l list \
6987 config config soundslike filter -v version dump \
6988 create merge' -- $cur ) )
6992 complete -F _aspell $filenames aspell
6995 # xmms(1) completion
7005 if [[ "$cur" == -* ]]; then
7006 COMPREPLY=( $( compgen -W '-h --help -r --rew -p --play \
7007 -u --pause -s --stop -t --play-pause -f --fwd -e \
7008 --enqueue -m --show-main-window -i --sm-client-id \
7009 -v --version' -- $cur ) )
7011 _filedir '@(mp[23]|MP[23]|ogg|OGG|wav|WAV|pls|m3u|xm|mod|s[3t]m|it|mtm|ult|flac)'
7016 complete -F _xmms $filenames xmms
7018 # info(1) completion
7023 local cur infopath UNAME
7030 # default completion if parameter contains /
7031 if [[ "$cur" == */* ]]; then
7036 infopath='/usr/share/info'
7038 if [ "${INFOPATH: -1:1}" == ':' ]; then
7039 infopath=${INFOPATH}${infopath}
7040 elif [ ${INFOPATH:+set} ]; then
7045 if [ -n "$cur" ]; then
7046 infopath="${infopath//://$cur* }"
7048 infopath="${infopath//:// }"
7051 # redirect stderr for when path doesn't exist
7052 COMPREPLY=( $( eval command ls "$infopath" 2>/dev/null ) )
7053 # weed out directory path names and paths to info pages
7054 COMPREPLY=( ${COMPREPLY[@]##*/?(:)} )
7055 # weed out info dir file
7056 for (( i=0 ; i < ${#COMPREPLY[@]} ; ++i )); do
7057 if [ "${COMPREPLY[$i]}" == 'dir' ]; then
7058 unset COMPREPLY[$i];
7061 # strip suffix from info pages
7062 COMPREPLY=( ${COMPREPLY[@]%.@(gz|bz2)} )
7063 COMPREPLY=( $( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" ) )
7067 complete -F _info $filenames info
7069 # dhclient(1) completion
7071 have dhclient && _dhclient()
7077 prev=${COMP_WORDS[COMP_CWORD-1]}
7090 if [[ "$cur" == -* ]]; then
7091 COMPREPLY=( $( compgen -W '-p -d -q -1 -r -lf -pf \
7092 -cf -sf -s -g -n -nw -w' -- $cur ) )
7094 _available_interfaces
7097 complete -F _dhclient dhclient
7104 COMPREPLY=( $(compgen -W "$( vgscan 2>/dev/null | \
7105 sed -n -e 's|.*Found.*"\(.*\)".*$|\1|p' )" -- $cur ) )
7110 COMPREPLY=( $(compgen -W "$( pvscan 2>/dev/null | \
7111 sed -n -e 's|^.*PV \(.*\) VG.*$|\1|p' )" -- $cur ) )
7116 COMPREPLY=( $(compgen -W "$( lvscan 2>/dev/null | \
7117 sed -n -e "s|^.*'\(.*\)'.*$|\1|p" )" -- $cur ) )
7122 COMPREPLY=( $( compgen -W 'h s b k m g t H K M G T' -- $cur ) )
7127 COMPREPLY=( $( compgen -W 'k K m M g G t T' -- $cur ) )
7133 if [[ "${COMP_WORDS[0]}" == lvm ]]; then
7138 for (( i=$offset; i < COMP_CWORD; i++ )); do
7139 if [[ "${COMP_WORDS[i]}" != -* ]]; then
7152 if [[ "$cur" == -* ]]; then
7153 COMPREPLY=( $( compgen -W '-d --debug -h -? --help -l \
7154 --lvmpartition -v --verbose --version' -- $cur ) )
7157 complete -F _lvmdiskscan lvmdiskscan
7166 if [[ "$cur" == -* ]]; then
7167 COMPREPLY=( $( compgen -W '-d --debug -e \
7168 --exported -n --novolumegroup -h -? \
7169 --help --ignorelockingfailure -P \
7170 --partial -s --short -u --uuid -v \
7171 --verbose --version' -- $cur ) )
7174 complete -F _pvscan pvscan
7182 prev=${COMP_WORDS[COMP_CWORD-1]}
7185 -@(o|O|-options|-sort))
7186 COMPREPLY=( $( compgen -W 'pv_fmt pv_uuid \
7187 pv_size pv_free pv_used pv_name \
7188 pv_attr pv_pe_count \
7189 pv_pe_alloc_count' -- $cur ) )
7198 if [[ "$cur" == -* ]]; then
7199 COMPREPLY=( $( compgen -W '--aligned -a --all -d --debug \
7200 -h -? --help --ignorelockingfailure --noheadings \
7201 --nosuffix -o --options -O --sort \
7202 --separator --unbuffered --units \
7203 -v --verbose --version' -- $cur ) )
7208 complete -F _pvs pvs
7216 prev=${COMP_WORDS[COMP_CWORD-1]}
7225 if [[ "$cur" == -* ]]; then
7226 COMPREPLY=( $( compgen -W '-c --colon -C --columns --units \
7227 -v --verbose -d --debug -h --help --version' -- $cur ) )
7232 complete -F _pvdisplay pvdisplay
7240 prev=${COMP_WORDS[COMP_CWORD-1]}
7243 -@(A|x|-autobackup|--allocatable))
7244 COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
7249 if [[ "$cur" == -* ]]; then
7250 COMPREPLY=( $( compgen -W '-a --all -A --autobackup \
7251 -d --debug -h --help -t --test -u --uuid -x \
7252 --allocatable -v --verbose --addtag --deltag \
7253 --version' -- $cur ) )
7258 complete -F _pvchange pvchange
7266 prev=${COMP_WORDS[COMP_CWORD-1]}
7273 -@(M|-metadatatype))
7274 COMPREPLY=( $( compgen -W '1 2' -- $cur ) )
7278 COMPREPLY=( $( compgen -W '0 1 2' -- $cur ) )
7281 --@(metadatasize|setphysicalvolumesize))
7287 if [[ "$cur" == -* ]]; then
7288 COMPREPLY=( $( compgen -W '--restorefile -d --debug -f \
7289 --force -h -? --help --labelsector -M --metadatatype \
7290 --metadatacopies --metadatasize \
7291 --setphysicalvolumesize -t --test -u --uuid uuid -v \
7292 --verbose -y --yes --version' -- $cur ) )
7297 complete -F _pvcreate pvcreate
7305 prev=${COMP_WORDS[COMP_CWORD-1]}
7309 COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
7317 if [[ "$cur" == -* ]]; then
7318 COMPREPLY=( $( compgen -W '--abort -A --autobackup \
7319 -b --background -d --debug -f --force -h -? \
7320 --help -i --interval -t --test -v --verbose \
7321 --version -n --name' -- $cur ) )
7326 complete -F _pvmove pvmove
7335 if [[ "$cur" == -* ]]; then
7336 COMPREPLY=( $( compgen -W '-d --debug -f --force -h -? \
7337 --help -y --yes -t --test -v --verbose \
7338 --version' -- $cur ) )
7343 complete -F _pvremove pvremove
7352 if [[ "$cur" == -* ]]; then
7353 COMPREPLY=( $( compgen -W '-d --debug -h --help \
7354 --ignorelockingfailure --mknodes -P \
7355 --partial -v --verbose --version' -- $cur ) )
7358 complete -F _vgscan vgscan
7366 prev=${COMP_WORDS[COMP_CWORD-1]}
7369 -@(o|O|-options|-sort))
7370 COMPREPLY=( $( compgen -W 'vg_fmt vg_uuid vg_name \
7371 vg_attr vg_size vg_free vg_sysid \
7372 vg_extent_size vg_extent_count vg_free_count \
7373 max_lv max_pv pv_count lv_count snap_count \
7374 vg_seqno' -- $cur ) )
7383 if [[ "$cur" == -* ]]; then
7384 COMPREPLY=( $( compgen -W '--aligned -d --debug \
7385 -h --help --ignorelockingfailure --noheadings \
7386 --nosuffix -o --options -O --sort -P --partial \
7387 --separator --unbuffered --units \
7388 -v --verbose --version' -- $cur ) )
7393 complete -F _vgs vgs
7401 prev=${COMP_WORDS[COMP_CWORD-1]}
7410 if [[ "$cur" == -* ]]; then
7411 COMPREPLY=( $( compgen -W '-c --colon -C --columns --units \
7412 -P --partial -A --activevolumegroups -v --verbose \
7413 -d --debug -h --help --version' -- $cur ) )
7418 complete -F _vgdisplay vgdisplay
7426 prev=${COMP_WORDS[COMP_CWORD-1]}
7429 -@(a|A|x|-available|-autobackup|-resizeable))
7430 COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
7435 if [[ "$cur" == -* ]]; then
7436 COMPREPLY=( $( compgen -W '-A --autobackup --alloc -P \
7437 --partial -d --debug -h --help --ignorelockingfailure \
7438 -t --test -u --uuid -v --verbose --version -a \
7439 --available -x --resizeable -l --logicalvolume \
7440 --addtag --deltag' -- $cur ) )
7445 complete -F _vgchange vgchange
7453 prev=${COMP_WORDS[COMP_CWORD-1]}
7457 COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
7460 -@(M|-metadatatype))
7461 COMPREPLY=( $( compgen -W '1 2' -- $cur ) )
7464 -@(s|-physicalextentsize))
7470 if [[ "$cur" == -* ]]; then
7471 COMPREPLY=( $( compgen -W '-A --autobackup --addtag \
7472 --alloc -d --debug -h --help -l --maxlogicalvolumes \
7473 -M --metadatatype -p --maxphysicalvolumes -s \
7474 --physicalextentsize -t --test -v --verbose \
7475 --version' -- $cur ) )
7478 if [ $args -eq 0 ]; then
7485 complete -F _vgcreate vgcreate
7494 if [[ "$cur" == -* ]]; then
7495 COMPREPLY=( $( compgen -W '-d --debug -h --help -t --test \
7496 -v --verbose --version' -- $cur ) )
7501 complete -F _vgremove vgremove
7509 prev=${COMP_WORDS[COMP_CWORD-1]}
7513 COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
7518 if [[ "$cur" == -* ]]; then
7519 COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -h \
7520 -? --help -t --test -v --verbose --version' -- $cur ) )
7525 complete -F _vgrename vgrename
7533 prev=${COMP_WORDS[COMP_CWORD-1]}
7537 COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
7542 if [[ "$cur" == -* ]]; then
7543 COMPREPLY=( $( compgen -W '-a --all -A --autobackup -d \
7544 --debug -h --help --removemissing -t --test -v \
7545 --verbose --version' -- $cur ) )
7549 if [ $args -eq 0 ]; then
7556 complete -F _vgreduce vgreduce
7564 prev=${COMP_WORDS[COMP_CWORD-1]}
7568 COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
7577 if [[ "$cur" == -* ]]; then
7578 COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -h \
7579 -? --help -t --test -v --verbose --version' -- $cur ) )
7582 if [ $args -eq 0 ]; then
7589 complete -F _vgextend vgextend
7598 if [[ "$cur" == -* ]]; then
7599 COMPREPLY=( $( compgen -W '-a --all -d --debug -h \
7600 -? --help -v --verbose --version' -- $cur ) )
7605 complete -F _vgport vgimport vgexport
7614 if [[ "$cur" == -* ]]; then
7615 COMPREPLY=( $( compgen -W '-d --debug -h \
7616 -? --help -v --verbose --version' -- $cur ) )
7621 complete -F _vgck vgck
7629 prev=${COMP_WORDS[COMP_CWORD-1]}
7632 -@(M|-metadatatype))
7633 COMPREPLY=( $( compgen -W '1 2' -- $cur ) )
7637 COMPREPLY=( $( compgen -W '0 1 2' -- $cur ) )
7646 if [[ "$cur" == -* ]]; then
7647 COMPREPLY=( $( compgen -W '-d --debug -h --help --labelsector \
7648 -M --metadatatype --metadatacopies --metadatasize \
7649 -t --test -v --verbose --version' -- $cur ) )
7654 complete -F _vgconvert vgconvert
7662 prev=${COMP_WORDS[COMP_CWORD-1]}
7671 if [[ "$cur" == -* ]]; then
7672 COMPREPLY=( $( compgen -W '-d --debug -f --file -h --help \
7673 --ignorelockingfailure -P --partial -v --verbose \
7674 --version' -- $cur ) )
7679 complete -F _vgcfgbackup vgcfgbackup
7687 prev=${COMP_WORDS[COMP_CWORD-1]}
7694 -@(M|-metadatatype))
7695 COMPREPLY=( $( compgen -W '1 2' -- $cur ) )
7704 if [[ "$cur" == -* ]]; then
7705 COMPREPLY=( $( compgen -W '-d --debug -f --file -l --list \
7706 -h --help -M --Metadatatype -n --name -t --test \
7707 -v --verbose --version' -- $cur ) )
7712 complete -F _vgcfgrestore vgcfgrestore
7720 prev=${COMP_WORDS[COMP_CWORD-1]}
7724 COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
7729 if [[ "$cur" == -* ]]; then
7730 COMPREPLY=( $( compgen -W '-A --autobackup -d --debug \
7731 -h --help -l --list -t --test -v --verbose \
7732 --version' -- $cur ) )
7737 complete -F _vgmerge vgmerge
7745 prev=${COMP_WORDS[COMP_CWORD-1]}
7749 COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
7752 -@(M|-metadatatype))
7753 COMPREPLY=( $( compgen -W '1 2' -- $cur ) )
7758 if [[ "$cur" == -* ]]; then
7759 COMPREPLY=( $( compgen -W '-A --autobackup -d --debug \
7760 -h --help -l --list -M --metadatatype -t --test \
7761 -v --verbose --version' -- $cur ) )
7764 if [ $args -eq 0 -o $args -eq 1 ]; then
7771 complete -F _vgsplit vgsplit
7780 if [[ "$cur" == -* ]]; then
7781 COMPREPLY=( $( compgen -W '-d --debug -h --help -v --verbose \
7782 --version' -- $cur ) )
7787 complete -F _vgmknodes vgmknodes
7796 if [[ "$cur" == -* ]]; then
7797 COMPREPLY=( $( compgen -W '-b --blockdevice -d --debug \
7798 -h -? --help --ignorelockingfailure -P \
7799 --partial -v --verbose --version' -- $cur ) )
7802 complete -F _lvscan lvscan
7810 prev=${COMP_WORDS[COMP_CWORD-1]}
7813 -@(o|O|-options|-sort))
7814 COMPREPLY=( $( compgen -W 'lv_uuid lv_name \
7815 lv_attr lv_minor lv_size seg_count \
7816 origin snap_percent segtype stripes \
7817 stripesize chunksize seg_start \
7818 seg_size' -- $cur ) )
7827 if [[ "$cur" == -* ]]; then
7828 COMPREPLY=( $( compgen -W '--aligned -d --debug \
7829 -h --help --ignorelockingfailure --noheadings \
7830 --nosuffix -o --options -O --sort -P --partial \
7831 --segments --separator --unbuffered --units \
7832 -v --verbose --version' -- $cur ) )
7837 complete -F _lvs lvs
7845 prev=${COMP_WORDS[COMP_CWORD-1]}
7854 if [[ "$cur" == -* ]]; then
7855 COMPREPLY=( $( compgen -W '-c --colon -C --columns --units \
7856 -P --partial -m --maps -v --verbose -d --debug -h \
7857 --help --version' -- $cur ) )
7862 complete -F _lvdisplay lvdisplay
7870 prev=${COMP_WORDS[COMP_CWORD-1]}
7873 -@(a|A|C|M|-available|-autobackup|-continguous|-persistent))
7874 COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
7878 COMPREPLY=( $( compgen -W 'r rw' -- $cur ) )
7883 if [[ "$cur" == -* ]]; then
7884 COMPREPLY=( $( compgen -W '-A --autobackup -a --available \
7885 --addtag --alloc -C --contiguous -d --debug --deltag \
7886 -f --force -h --help --ignorelockingfailure -M \
7887 --persistent --major major --minor minor -P --partial \
7888 -p --permission -r --readahead --refresh -t --test \
7889 -v --verbose --version' -- $cur ) )
7894 complete -F _lvchange lvchange
7902 prev=${COMP_WORDS[COMP_CWORD-1]}
7905 -@(A|C|M|Z|-autobackup|-continguous|-persistent|-zero))
7906 COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
7914 COMPREPLY=( $( compgen -W 'r rw' -- $cur ) )
7923 if [[ "$cur" == -* ]]; then
7924 COMPREPLY=( $( compgen -W '-A --autobackup --addtag --alloc \
7925 -C --contiguous -d --debug -h -? --help -i --stripes \
7926 -I --stripesize -l --extents -L --size -M --persistent \
7927 --major --minor -n --name -p --permission -r \
7928 --readahead -t --test --type -v --verbose -Z --zero \
7929 --version' -- $cur ) )
7932 if [ $args -eq 0 ]; then
7939 complete -F _lvcreate lvcreate
7947 prev=${COMP_WORDS[COMP_CWORD-1]}
7951 COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
7956 if [[ "$cur" == -* ]]; then
7957 COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -f \
7958 --force -h -? --help -t --test -v --verbose \
7959 --version' -- $cur ) )
7964 complete -F _lvremove lvremove
7972 prev=${COMP_WORDS[COMP_CWORD-1]}
7976 COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
7981 if [[ "$cur" == -* ]]; then
7982 COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -h \
7983 -? --help -t --test -v --verbose --version' -- $cur ) )
7988 complete -F _lvrename lvrename
7996 prev=${COMP_WORDS[COMP_CWORD-1]}
8000 COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
8009 if [[ "$cur" == -* ]]; then
8010 COMPREPLY=( $( compgen -W '-A --autobackup -d \
8011 --debug -f --force -h --help -l --extents \
8012 -L --size -n --nofsck -r --resizefs -t --test \
8013 -v --verbose --version' -- $cur ) )
8018 complete -F _lvreduce lvreduce
8026 prev=${COMP_WORDS[COMP_CWORD-1]}
8030 COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
8039 if [[ "$cur" == -* ]]; then
8040 COMPREPLY=( $( compgen -W '-A --autobackup --alloc -d \
8041 --debug -h --help -i --stripes -I --stripesize \
8042 -l --extents -L --size -n --nofsck -r --resizefs \
8043 -t --test --type -v --verbose --version' -- $cur ) )
8046 if [ $args -eq 0 ]; then
8053 complete -F _lvresize lvresize
8061 prev=${COMP_WORDS[COMP_CWORD-1]}
8065 COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
8074 if [[ "$cur" == -* ]]; then
8075 COMPREPLY=( $( compgen -W '-A --autobackup --alloc -d \
8076 --debug -h --help -i --stripes -I --stripesize \
8077 -l --extents -L --size -n --nofsck -r --resizefs \
8078 -t --test --type -v --verbose --version' -- $cur ) )
8081 if [ $args -eq 0 ]; then
8088 complete -F _lvextend lvextend
8097 if [ $COMP_CWORD -eq 1 ]; then
8098 COMPREPLY=( $( compgen -W 'dumpconfig help lvchange \
8099 lvcreate lvdisplay lvextend lvmchange \
8100 lvmdiskscan lvmsadc lvmsar lvreduce \
8101 lvremove lvrename lvresize lvs lvscan \
8102 pvchange pvcreate pvdata pvdisplay pvmove \
8103 pvremove pvresize pvs pvscan vgcfgbackup \
8104 vgcfgrestore vgchange vgck vgconvert \
8105 vgcreate vgdisplay vgexport vgextend \
8106 vgimport vgmerge vgmknodes vgreduce \
8107 vgremove vgrename vgs vgscan vgsplit \
8108 version' -- $cur ) )
8110 case ${COMP_WORDS[1]} in
8222 complete -F _lvm lvm
8225 # mkinitrd(8) completion
8234 prev=${COMP_WORDS[COMP_CWORD-1]}
8236 # --name value style option
8244 # --name=value style option
8245 if [[ "$cur" == *=* ]]; then
8265 if [[ "$cur" == -* ]]; then
8266 COMPREPLY=( $( compgen -W '--version -v -f --preload \
8267 --with= --omit-scsi-modules --omit-raid-modules \
8268 --images-version --fstab= --nocompress --builtin= \
8269 --nopivot --noudev --allow-missing --tmpdir= \
8270 --initrdfs= --dsdt= --lvm-version= --froce-usb' \
8280 COMPREPLY=( $( command ls /lib/modules | grep "^$cur" ) )
8286 complete -F _mkinitrd mkinitrd
8288 # pkgconfig(1) completion
8298 if [[ "$cur" == -* ]]; then
8299 # return list of available options
8300 COMPREPLY=( $( compgen -W '-version --modversion \
8301 --atleast-pkgconfig-version= --libs --libs-only-l \
8302 --libs-only-other --libs-only-L --cflags \
8303 --cflags-only-I --cflags-only-other --variable= \
8304 --define-variable= --exists --uninstalled \
8305 --atleast-version= --exact-version= --max-version= \
8306 --list-all --debug --print-errors --silence-errors \
8307 --errors-to-stdout -? --help --usage' -- $cur))
8309 COMPREPLY=( $( pkg-config --list-all 2>/dev/null | \
8310 awk '{print $1}' | grep "^$cur" ) )
8313 complete -F _pkg_config pkg-config
8316 # cpio(1) completion
8321 COMPREPLY=( $( compgen -W 'bin odc newc crc tar ustar hpbin hpodc' -- $cur ) )
8330 prev=${COMP_WORDS[COMP_CWORD-1]}
8332 # --name value style option
8348 # --name=value style option
8349 if [[ "$cur" == *=* ]]; then
8357 --@(file|pattern-file))
8366 COMPREPLY=( $( compgen -c -- $cur ) )
8372 if [ $COMP_CWORD -eq 1 ]; then
8373 COMPREPLY=( $( compgen -W '-o --create -i --extract -p --pass-through' -- $cur) )
8375 case ${COMP_WORDS[1]} in
8377 if [[ "$cur" == -* ]]; then
8378 COMPREPLY=( $( compgen -W '-0 -a -c -v -A -B\
8379 -L -V -C -H -M -O -F --file= --format=\
8380 --message= --null --reset-access-time\
8381 --verbose --dot --append --block-size=\
8382 --dereference --io-size= --quiet\
8383 --force-local --rsh-command= --help\
8384 --version' -- $cur ) )
8388 if [[ "$cur" == -* ]]; then
8389 COMPREPLY=( $( compgen -W '-b -c -d -f -m -n -r\
8390 -t -s -u -v -B -S -V -C -E -H -M -R -I\
8391 -F --file= --make-directories\
8393 --preserve-modification-time\
8394 --numeric-uid-gid --rename -t --list\
8395 --swap-bytes --swap --dot\
8396 --unconditional --verbose --block-size=\
8397 --swap-halfwords --io-size=\
8398 --pattern-file= --format= --owner=\
8399 --no-preserve-owner --message=\
8400 --force-local --no-absolute-filenames\
8401 --sparse --only-verify-crc --quiet\
8402 --rsh-command= --help\
8403 --version' -- $cur ) )
8406 -@(p|-pass-through))
8407 if [[ "$cur" == -* ]]; then
8408 COMPREPLY=( $( compgen -W '-0 -a -d -l -m -u -v\
8409 -L -V -R --null --reset-access-time\
8410 --make-directories --link --quiet\
8411 --preserve-modification-time\
8412 --unconditional --verbose --dot\
8413 --dereference --owner=\
8414 --no-preserve-owner --sparse --help\
8415 --version' -- $cur ) )
8423 complete -F _cpio cpio
8436 if [[ "$cur" == -* ]]; then
8437 COMPREPLY=( $( compgen -W '-a -g --group -G --groups -n --name\
8438 -r --real -u --user --help --version' -- $cur ) )
8440 COMPREPLY=( $( compgen -u $cur ) )
8445 # getent(1) completion
8454 prev=${COMP_WORDS[COMP_CWORD-1]}
8458 COMPREPLY=( $( compgen -u $cur ) )
8462 COMPREPLY=( $( compgen -g $cur ) )
8466 COMPREPLY=( $( compgen -s $cur ) )
8470 COMPREPLY=( $( compgen -A hostname $cur ) )
8474 COMPREPLY=( $( getent protocols | awk '{print $1}' | grep "^$cur" ) )
8478 COMPREPLY=( $( getent networks | awk '{print $1}' | grep "^$cur" ) )
8484 if [ $COMP_CWORD -eq 1 ]; then
8485 COMPREPLY=( $( compgen -W 'passwd group hosts services protocols networks' -- $cur ) )
8488 complete -F _getent getent
8490 # ntpdate(1) completion
8499 prev=${COMP_WORDS[COMP_CWORD-1]}
8507 COMPREPLY=( $( compgen -u $cur ) )
8512 if [[ "$cur" == -* ]]; then
8513 COMPREPLY=( $( compgen -W '-4 -6 -b -B -d -Q -q -s -u -v -a\
8514 -e -k -p -o -r -t' -- $cur ) )
8519 complete -F _ntpdate ntpdate
8521 # smartctl(8) completion
8524 _smartctl_quietmode()
8526 COMPREPLY=( $( compgen -W 'errorsonly silent' -- $cur ) )
8530 COMPREPLY=( $( compgen -W 'ata scsi 3ware' -- $cur ) )
8532 _smartctl_tolerance()
8534 COMPREPLY=( $( compgen -W 'warn exit ignore' -- $cur ) )
8538 COMPREPLY=( $( compgen -W 'normal conservative permissive verypermissive' -- $cur ) )
8542 COMPREPLY=( $( compgen -W 'ioctl ataioctl scsiioctl' -- $cur ) )
8546 COMPREPLY=( $( compgen -W 'on off' -- $cur ) )
8550 COMPREPLY=( $( compgen -W 'error selftest selective directory' -- $cur ) )
8552 _smartctl_vendorattribute()
8554 COMPREPLY=( $( compgen -W 'help 9,minutes 9,seconds 9,halfminutes \
8555 9,temp 192,emergencyretractcyclect 193,loadunload \
8556 194,10xCelsius 194,unknown 198,offlinescanuncsectorct \
8557 200,writeerrorcount 201,detectedtacount 220,temp' -- $cur ) )
8559 _smartctl_firmwarebug()
8561 COMPREPLY=( $( compgen -W 'none samsung samsung2' -- $cur ) )
8565 COMPREPLY=( $( compgen -W 'use ignore show showall' -- $cur ) )
8569 COMPREPLY=( $( compgen -W 'offline short long conveyance select afterselect,on afterselect,off pending' -- $cur ) )
8578 prev=${COMP_WORDS[COMP_CWORD-1]}
8580 # --name value style option
8618 _smartctl_vendorattribute
8622 _smartctl_firmwarebug
8635 # --name=value style option
8636 if [[ "$cur" == *=* ]]; then
8677 _smartctl_vendorattribute
8681 _smartctl_firmwarebug
8696 if [[ "$cur" == -* ]]; then
8697 COMPREPLY=( $( compgen -W '-h --help --usage -V --version \
8698 --copyright --license-i --info -a --all -q \
8699 --quietmode= -d --device= -T --tolerance= -b --badsum= \
8700 -r --report= -s --smart= -o --offlineauto= -S \
8701 --saveauto= -H --health -c --capabilities -A \
8702 --attributes -l --log= -v --vendorattribute= -F \
8703 --firmwarebug= -P --presets= -t --test= -C \
8704 --captive -X --abort' -- $cur ) )
8710 complete -F _smartctl smartctl
8713 # vncviewer(1) completion
8723 prev=${COMP_WORDS[COMP_CWORD-1]}
8730 # ssh into the the server, find and ping the broadcast address, then
8731 # sort and show the results.
8732 COMPREPLY=( $( ssh -o 'Batchmode yes' $prev \
8733 "ping -bnc 4 255.255.255.255" 2>/dev/null | \
8734 awk -F ' ' '{print $4}' | \
8735 sort -n | uniq | egrep '[0-9]+\.[0-9]+\.' 2>/dev/null ) )
8740 complete -F _vncviewer vncviewer
8742 # sysctl(8) completion
8752 COMPREPLY=( $( compgen -W "$(sysctl -N -a 2>/dev/null)" -- $cur ) )
8756 complete -F _sysctl sysctl
8758 # update-rc.d(8) completion
8760 # Copyright (C) 2004 Servilio Afre Puentes <servilio@gmail.com>
8765 local cur prev sysvdir services options valid_options
8768 prev=${COMP_WORDS[COMP_CWORD-1]}
8770 [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \
8771 || sysvdir=/etc/init.d
8773 services=( $(echo $sysvdir/!(README*|*.sh|*.dpkg*|*.rpm*)) )
8774 services=( ${services[@]#$sysvdir/} )
8777 if [[ $COMP_CWORD -eq 1 || "$prev" == -* ]]; then
8778 valid_options=( $( \
8779 echo "${COMP_WORDS[@]} ${options[@]}" \
8781 | sed -ne "/$( echo "${options[@]}" | sed "s/ /\\|/g" )/p" \
8784 COMPREPLY=( $( compgen -W '${options[@]} ${services[@]}' \
8785 -X '$( echo ${COMP_WORDS[@]} | tr " " "|" )' -- $cur ) )
8786 elif [[ "$prev" == ?($( echo ${services[@]} | tr " " "|" )) ]]; then
8787 COMPREPLY=( $( compgen -W 'remove defaults start stop' -- $cur ) )
8788 elif [[ "$prev" == defaults && "$cur" == [0-9] ]]; then
8789 COMPREPLY=( 0 1 2 3 4 5 6 7 8 9 )
8790 elif [[ "$prev" == defaults && "$cur" == [sk]?([0-9]) ]]; then
8791 COMPREPLY=( 0 1 2 3 4 5 6 7 8 9 )
8792 elif [[ "$prev" == defaults && -z "$cur" ]]; then
8793 COMPREPLY=( 0 1 2 3 4 5 6 7 8 9 s k )
8794 elif [[ "$prev" == ?(start|stop) ]]; then
8795 if [[ "$cur" == [0-9] || -z "$cur" ]]; then
8796 COMPREPLY=( 0 1 2 3 4 5 6 7 8 9 )
8797 elif [[ "$cur" == [0-9][0-9] ]]; then
8802 elif [[ "$prev" == ?([0-9][0-9]|[0-6S]) ]]; then
8803 if [[ -z "$cur" ]]; then
8804 if [[ $prev == [0-9][0-9] ]]; then
8805 COMPREPLY=( 0 1 2 3 4 5 6 S )
8807 COMPREPLY=( 0 1 2 3 4 5 6 S . )
8809 elif [[ "$cur" == [0-6S.] ]]; then
8814 elif [[ "$prev" == "." ]]; then
8815 COMPREPLY=( $(compgen -W "start stop" -- $cur) )
8822 complete -F _update_rc_d update-rc.d
8824 # invoke-rc.d(8) completion
8826 # Copyright (C) 2004 Servilio Afre Puentes <servilio@gmail.com>
8831 local cur prev sysvdir services options valid_options
8834 prev=${COMP_WORDS[COMP_CWORD-1]}
8836 [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \
8837 || sysvdir=/etc/init.d
8839 services=( $(echo $sysvdir/!(README*|*.sh|*.dpkg*|*.rpm*)) )
8840 services=( ${services[@]#$sysvdir/} )
8841 options=( --help --quiet --force --try-anyway --disclose-deny --query --no-fallback )
8843 if [[ ($COMP_CWORD -eq 1) || ("$prev" == --* ) ]]; then
8844 valid_options=( $( \
8845 echo ${COMP_WORDS[@]} ${options[@]} \
8847 | sed -ne "/$( echo ${options[@]} | sed "s/ /\\\\|/g" )/p" \
8850 COMPREPLY=( $( compgen -W '${valid_options[@]} ${services[@]}' -- \
8852 elif [ -x $sysvdir/$prev ]; then
8853 COMPREPLY=( $( compgen -W '`sed -ne "y/|/ /; \
8854 s/^.*Usage:[ ]*[^ ]*[ ]*{*\([^}\"]*\).*$/\1/p" \
8855 $sysvdir/$prev`' -- \
8863 complete -F _invoke_rc_d invoke-rc.d
8865 # minicom(1) completion
8874 prev=${COMP_WORDS[COMP_CWORD-1]}
8878 COMPREPLY=( $( compgen -W 'on off' -- $cur ) )
8886 COMPREPLY=( $( command ls /dev/tty* ) )
8887 COMPREPLY=( $( compgen -W '${COMPREPLY[@]} ${COMPREPLY[@]#/dev/}' -- $cur ) )
8893 if [[ "$cur" == -* ]]; then
8894 COMPREPLY=( $( compgen -W '-s -o -m -M -z -l -L -w -a -t \
8895 -c -S -d -p -C -T -8' -- $cur ) )
8897 COMPREPLY=( $( command ls /etc/minicom/minirc.* 2>/dev/null | sed -e 's|/etc/minicom/minirc.||' | grep "^$cur" ) )
8900 complete -F _minicom minicom
8908 local cur prev commands options command
8913 commands='add blame praise annotate ann cat checkout co cleanup commit \
8914 ci copy cp delete del remove rm diff di export help ? h import \
8915 info list ls lock log merge mkdir move mv rename ren \
8916 propdel pdel pd propedit pedit pe propget pget pg \
8917 proplist plist pl propset pset ps resolved revert \
8918 status stat st switch sw unlock update up'
8920 if [[ $COMP_CWORD -eq 1 ]] ; then
8921 if [[ "$cur" == -* ]]; then
8922 COMPREPLY=( $( compgen -W '--version' -- $cur ) )
8924 COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
8928 prev=${COMP_WORDS[COMP_CWORD-1]}
8934 -@(F|-file|-targets))
8939 COMPREPLY=( $( compgen -W \
8940 '$( iconv --list | sed -e "s@//@@;" )' \
8944 --@(editor|diff|diff3)-cmd)
8945 COMP_WORDS=(COMP_WORDS[0] $cur)
8952 command=${COMP_WORDS[1]}
8954 if [[ "$cur" == -* ]]; then
8955 # possible options for the command
8958 options='--auto-props --no-auto-props \
8959 --force --targets --no-ignore \
8960 --non-recursive -N -q --quiet'
8962 @(blame|annotate|ann|praise))
8963 options='-r --revisions --username \
8964 --password --no-auth-cache \
8965 --non-interactive -v \
8966 --verbose --incremental --xml'
8969 options='-r --revision --username \
8970 --password --no-auth-cache \
8974 options='-r --revision -q --quiet -N \
8975 --non-recursive --username \
8976 --password --no-auth-cache \
8981 options='--diff3-cmd'
8984 options='-m --message -F --file \
8985 --encoding --force-log -q \
8986 --quiet --non-recursive -N \
8987 --targets --editor-cmd \
8988 --username --password \
8990 --non-interactive --no-unlock'
8993 options='-m --message -F --file \
8994 --encoding --force-log -r \
8995 --revision -q --quiet \
8996 --editor-cmd -username \
8997 --password --no-auth-cache \
9000 @(delete|del|remove|rm))
9001 options='--force -m --message -F \
9002 --file --encoding --force-log \
9003 -q --quiet --targets \
9004 --editor-cmd -username \
9005 --password --no-auth-cache \
9009 options='-r --revision -x --extensions \
9010 --diff-cmd --no-diff-deleted \
9011 -N --non-recursive --username \
9012 --password --no-auth-cache \
9013 --non-interactive --force \
9014 --old --new --notice-ancestry'
9017 options='-r --revision -q --quiet \
9018 --username --password \
9020 --non-interactive -N \
9021 --non-recursive --force \
9022 --native-eol --ignore-externals'
9025 options='--auto-props --no-auto-props \
9026 -m --message -F --file \
9027 --encoding --force-log -q \
9028 --quiet --non-recursive \
9029 --no-ignore --editor-cmd \
9030 --username --password \
9035 options='--username --password \
9037 --non-interactive -r \
9038 --revision --xml --targets \
9039 -R --recursive --incremental'
9042 options='-r --revision -v --verbose -R \
9043 --recursive --username \
9044 --password --no-auth-cache \
9046 --incremental --xml'
9049 options='-m --message -F --file \
9050 --encoding --force-log \
9051 --targets --force --username \
9052 --password --no-auth-cache \
9056 options='-r --revision -v --verbose \
9057 --targets --username \
9058 --password --no-auth-cache \
9060 --stop-on-copy --incremental \
9061 --xml -q --quiet --limit'
9064 options='-r --revision -N \
9065 --non-recursive -q --quiet \
9066 --force --dry-run --diff3-cmd \
9067 --username --password \
9073 options='-m --message -F --file \
9074 --encoding --force-log -q \
9075 --quiet --editor-cmd \
9076 --username --password \
9080 @(move|mv|rename|ren))
9081 options='-m --message -F --file \
9082 --encoding --force-log -r \
9083 --revision -q --quiet \
9084 --force --editor-cmd \
9085 --username --password \
9090 options='-q --quiet -R --recursive -r \
9091 --revision --revprop \
9092 --username --password \
9096 @(propedit|pedit|pe))
9097 options='-r --revision --revprop \
9098 --encoding --editor-cmd \
9099 --username --password \
9101 --non-interactive --force'
9104 options='-R --recursive -r --revision \
9105 --revprop --strict --username \
9106 --password --no-auth-cache \
9109 @(proplist|plist|pl))
9110 options='-v --verbose -R --recursive \
9111 -r --revision --revprop -q \
9112 --quiet --username --password \
9117 options='-F --file -q --quiet \
9118 --targets -R --recursive \
9119 --revprop --encoding \
9120 --username --password \
9122 --non-interactive -r \
9126 options='--targets -R --recursive -q \
9130 options='--targets -R --recursive -q \
9134 options='-u --show-updates -v \
9135 --verbose -N --non-recursive \
9136 -q --quiet --username \
9137 --password --no-auth-cache \
9138 --non-interactive --no-ignore \
9139 --ignore-externals \
9140 --incremental --xml'
9143 options='--relocate -r --revision -N \
9144 --non-recursive -q --quiet \
9145 --username --password \
9147 --non-interactive --diff3-cmd'
9150 options='--targets --force --username \
9151 --password --no-auth-cache \
9155 options='-r --revision -N \
9156 --non-recursive -q --quiet \
9157 --username --password \
9160 --diff3-cmd --ignore-externals'
9163 options="$options --help -h --config-dir"
9165 COMPREPLY=( $( compgen -W "$options" -- $cur ) )
9167 if [[ "$command" == @(help|h|\?) ]]; then
9168 COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
9177 complete -F _svn $default svn
9181 local cur prev commands options mode
9186 commands='create deltify dump help ? hotcopy list-dblogs \
9187 list-unused-dblogs load lslocks lstxns recover rmlocks \
9188 rmtxns setlog verify'
9190 if [[ $COMP_CWORD -eq 1 ]] ; then
9191 if [[ "$cur" == -* ]]; then
9192 COMPREPLY=( $( compgen -W '--version' -- $cur ) )
9194 COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
9197 prev=${COMP_WORDS[COMP_CWORD-1]}
9204 COMPREPLY=( $( compgen -W 'fsfs bdb' -- $cur ) )
9209 command=${COMP_WORDS[1]}
9211 if [[ "$cur" == -* ]]; then
9212 # possible options for the command
9215 options='--bdb-txn-nosync \
9216 --bdb-log-keep --config-dir \
9220 options='-r --revision -q --quiet'
9223 options='-r --revision --incremental \
9224 -q --quiet --deltas'
9227 options='--clean-logs'
9230 options='--ignore-uuid --force-uuid \
9231 --parent-dir -q --quiet \
9232 --use-pre-commit-hook \
9233 --use-post-commit-hook'
9236 options='-q --quiet'
9239 options='-r --revision --bypass-hooks'
9243 options="$options --help -h"
9244 COMPREPLY=( $( compgen -W "$options" -- $cur ) )
9246 if [[ "$command" == @(help|h|\?) ]]; then
9247 COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
9256 complete -F _svnadmin $default svnadmin
9260 local cur prev commands options mode
9265 commands='author cat changed date diff dirs-changed help ? h history \
9266 info lock log propget pget pg proplist plist pl tree uuid \
9269 if [[ $COMP_CWORD -eq 1 ]] ; then
9270 if [[ "$cur" == -* ]]; then
9271 COMPREPLY=( $( compgen -W '--version' -- $cur ) )
9273 COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
9276 command=${COMP_WORDS[1]}
9278 if [[ "$cur" == -* ]]; then
9279 # possible options for the command
9281 @(author|cat|date|dirs-changed|info|log))
9282 options='-r --revision -t \
9286 options='-r --revision -t \
9287 --transaction --copy-info'
9290 options='-r --revision -t \
9297 options='-r --revision --show-ids'
9300 options='-r --revision -t \
9301 --transaction --revprop'
9304 options='-r --revision -t \
9305 --transaction --show-ids \
9310 options="$options --help -h"
9311 COMPREPLY=( $( compgen -W "$options" -- $cur ) )
9313 if [[ "$command" == @(help|h|\?) ]]; then
9314 COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
9323 complete -F _svnlook $default svnlook
9336 # get first exclusion compspec that matches this command
9337 xspec=$( sed -ne $'/^complete .*[ \t]'${1##*/}$'\([ \t]\|$\)/{p;q;}' \
9339 # prune to leave nothing but the -X spec
9345 while read -r tmp; do
9346 [[ -n $tmp ]] && toks[${#toks[@]}]=$tmp
9347 done < <( compgen -d -- "$(quote_readline "$cur")" )
9349 while read -r tmp; do
9350 [[ -n $tmp ]] && toks[${#toks[@]}]=$tmp
9351 done < <( eval compgen -f -X $xspec -- "\$(quote_readline "\$cur")" )
9353 COMPREPLY=( "${toks[@]}" )
9355 list=( $( sed -ne '/^# START exclude/,/^# FINISH exclude/p' \
9356 $BASH_COMPLETION | \
9357 # read exclusion compspecs
9361 # ignore compspecs that are commented out
9362 if [ "${line#\#}" != "$line" ]; then continue; fi
9363 line=${line%# START exclude*}
9364 line=${line%# FINISH exclude*}
9366 list=( "${list[@]}" $line )
9371 # remove previous compspecs
9372 if [ ${#list[@]} -gt 0 ]; then
9373 eval complete -r ${list[@]}
9374 # install new compspecs
9375 eval complete -F _filedir_xspec $filenames "${list[@]}"
9379 # source completion directory definitions
9380 if [ -d $BASH_COMPLETION_DIR -a -r $BASH_COMPLETION_DIR -a \
9381 -x $BASH_COMPLETION_DIR ]; then
9382 for i in $BASH_COMPLETION_DIR/*; do
9383 [[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|.rpm*) ]] &&
9384 [ \( -f $i -o -h $i \) -a -r $i ] && . $i
9389 # source user completion file
9390 [ $BASH_COMPLETION != ~/.bash_completion -a -r ~/.bash_completion ] \
9391 && . ~/.bash_completion
9393 unset UNAME RELEASE default dirnames filenames have nospace bashdefault \
9396 set $BASH_COMPLETION_ORIGINAL_V_VALUE
9397 unset BASH_COMPLETION_ORIGINAL_V_VALUE
9399 ### Local Variables:
9400 ### mode: shell-script