2 # This file contains an example set of shell completions that can be used with
3 # bash(1). These completions allow a user to complete filenames, commands
4 # name, command line options, and command line arguments using the [tab] key.
5 # The completions defined here are specific to the GNU command set, as a result
6 # they will provide the choice of GNU command line options in response to the
7 # [tab] key. For the completed options to match the command implementation,
8 # you may have to have /usr/gnu/bin at the head of your PATH.
10 # These completions are not included in the default bash(1) environment. To
11 # include them in the default environment, it is recommended that this file be
12 # copied to /etc/bash/bash_completion and be sourced from either a system wide
13 # bashrc in /etc/bash/bashrc or individual bashrcs in ~/.bashrc via
14 # [ -f /etc/bash/bash_completion ] && . /etc/bash/bash_completion
17 # bash_completion - programmable completion functions for bash 3.x
18 # (backwards compatible with bash 2.05b)
20 # $Id: bash_completion,v 1.872 2006/03/01 16:20:18 ianmacd Exp $
22 # Copyright (C) Ian Macdonald <ian@caliban.org>
24 # This program is free software; you can redistribute it and/or modify
25 # it under the terms of the GNU General Public License as published by
26 # the Free Software Foundation; either version 2, or (at your option)
29 # This program is distributed in the hope that it will be useful,
30 # but WITHOUT ANY WARRANTY; without even the implied warranty of
31 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 # GNU General Public License for more details.
34 # You should have received a copy of the GNU General Public License
35 # along with this program; if not, write to the Free Software Foundation,
36 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
38 # The latest version of this software can be obtained here:
40 # http://www.caliban.org/bash/index.shtml#completion
44 if [[ $- == *v* ]]; then
45 BASH_COMPLETION_ORIGINAL_V_VALUE="-v"
47 BASH_COMPLETION_ORIGINAL_V_VALUE="+v"
50 if [[ -n $BASH_COMPLETION_DEBUG ]]; then
56 # Alter the following to reflect the location of this file.
58 [ -n "$BASH_COMPLETION" ] || BASH_COMPLETION=/etc/bash/bash_completion
59 [ -n "$BASH_COMPLETION_DIR" ] || BASH_COMPLETION_DIR=/etc/bash/bash_completion.d
60 readonly BASH_COMPLETION BASH_COMPLETION_DIR
62 # Set a couple of useful vars
65 # strip OS type and version under Cygwin (e.g. CYGWIN_NT-5.1 => Cygwin)
66 UNAME=${UNAME/CYGWIN_*/Cygwin}
69 # features supported by bash 2.05 and higher
70 if [ ${BASH_VERSINFO[0]} -eq 2 ] && [[ ${BASH_VERSINFO[1]} > 04 ]] ||
71 [ ${BASH_VERSINFO[0]} -gt 2 ]; then
72 declare -r bash205=$BASH_VERSION 2>/dev/null || :
74 dirnames="-o dirnames"
75 filenames="-o filenames"
77 # features supported by bash 2.05b and higher
78 if [ ${BASH_VERSINFO[0]} -eq 2 ] && [[ ${BASH_VERSINFO[1]} = "05b" ]] ||
79 [ ${BASH_VERSINFO[0]} -gt 2 ]; then
80 declare -r bash205b=$BASH_VERSION 2>/dev/null || :
83 # features supported by bash 3.0 and higher
84 if [ ${BASH_VERSINFO[0]} -gt 2 ]; then
85 declare -r bash3=$BASH_VERSION 2>/dev/null || :
86 bashdefault="-o bashdefault"
87 plusdirs="-o plusdirs"
90 # Turn on extended globbing and programmable completion
91 shopt -s extglob progcomp
93 # A lot of the following one-liners were taken directly from the
94 # completion examples provided with the bash 2.04 source distribution
96 # Make directory commands see only directories
99 # The following section lists completions that are redefined later
100 # Do NOT break these over multiple lines.
102 # START exclude -- do NOT remove this line
103 complete -f -X '!*.?(t)bz?(2)' bunzip2 bzcat bzcmp bzdiff bzegrep bzfgrep bzgrep
104 complete -f -X '!*.@(zip|ZIP|jar|JAR|exe|EXE|pk3|war|wsz|ear|zargo|xpi|sxw|ott)' unzip zipinfo
105 complete -f -X '*.Z' compress znew
106 complete -f -X '!*.@(Z|gz|tgz|Gz|dz)' gunzip zcmp zdiff zcat zegrep zfgrep zgrep zless zmore
107 complete -f -X '!*.Z' uncompress
108 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
109 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
110 complete -f -X '!*.@(@(?(e)ps|?(E)PS|pdf|PDF)?(.gz|.GZ|.bz2|.BZ2|.Z))' gv ggv kghostview
111 complete -f -X '!*.@(dvi|DVI)?(.@(gz|Z|bz2))' xdvi
112 complete -f -X '!*.@(dvi|DVI)?(.@(gz|bz2))' kdvi
113 complete -f -X '!*.@(dvi|DVI)' dvips dviselect dvitype dvipdf advi dvipdfm dvipdfmx
114 complete -f -X '!*.@(pdf|PDF)' acroread gpdf xpdf
115 complete -f -X '!*.@(?(e)ps|?(E)PS|pdf|PDF)' kpdf
116 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
117 complete -f -X '!*.@(?(e)ps|?(E)PS)' ps2pdf
118 complete -f -X '!*.texi*' makeinfo texi2html
119 complete -f -X '!*.@(?(la)tex|?(LA)TEX|texi|TEXI|dtx|DTX|ins|INS)' tex latex slitex jadetex pdfjadetex pdftex pdflatex texi2dvi
120 complete -f -X '!*.@(mp3|MP3)' mpg123 mpg321 madplay
121 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
122 complete -f -X '!*.@(avi|asf|wmv)' aviplay
123 complete -f -X '!*.@(rm?(j)|ra?(m)|smi?(l))' realplay
124 complete -f -X '!*.@(mpg|mpeg|avi|mov|qt)' xanim
125 complete -f -X '!*.@(ogg|OGG|m3u|flac|spx)' ogg123
126 complete -f -X '!*.@(mp3|MP3|ogg|OGG|pls|m3u)' gqmpeg freeamp
127 complete -f -X '!*.fig' xfig
128 complete -f -X '!*.@(mid?(i)|MID?(I))' playmidi
129 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
130 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
131 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
132 complete -f -X '!*.@(exe|EXE|com|COM|scr|SCR|exe.so)' wine
133 complete -f -X '!*.@(zip|ZIP|z|Z|gz|GZ|tgz|TGZ)' bzme
134 complete -f -X '!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))' netscape mozilla lynx opera galeon curl dillo elinks amaya
135 complete -f -X '!*.@(sxw|stw|sxg|sgl|doc|dot|rtf|txt|htm|html|odt|ott|odm)' oowriter
136 complete -f -X '!*.@(sxi|sti|pps|ppt|pot|odp|otp)' ooimpress
137 complete -f -X '!*.@(sxc|stc|xls|xlw|xlt|csv|ods|ots)' oocalc
138 complete -f -X '!*.@(sxd|std|sda|sdd|odg|otg)' oodraw
139 complete -f -X '!*.@(sxm|smf|mml|odf)' oomath
140 complete -f -X '!*.odb' oobase
141 complete -f -X '!*.rpm' rpm2cpio
142 # FINISH exclude -- do not remove this line
144 # start of section containing compspecs that can be handled within bash
146 # user commands see only users
147 complete -u su usermod userdel passwd chage write chfn groups slay w sux
149 # group commands see only groups
150 [ -n "$bash205" ] && complete -g groupmod groupdel newgrp 2>/dev/null
152 # bg completes with stopped jobs
153 complete -A stopped -P '%' bg
156 complete -j -P '%' fg jobs disown
158 # readonly and unset complete with shell variables
159 complete -v readonly unset
161 # set completes with set options
162 complete -A setopt set
164 # shopt completes with shopt options
165 complete -A shopt shopt
168 complete -A helptopic help
170 # unalias completes with aliases
173 # bind completes with readline bindings (make this more intelligent)
174 complete -A binding bind
176 # type and which complete on commands
177 complete -c command type which
179 # builtin completes on builtins
182 # start of section containing completion functions called by other functions
184 # This function checks whether we have a given program on the system.
185 # No need for bulky functions in memory if we don't.
190 PATH=/usr/gnu/bin:$PATH:/sbin:/usr/sbin type $1 &>/dev/null &&
194 # use GNU sed if we have it, since its extensions are still used in our code
196 [ $UNAME != Linux ] && have gsed && alias sed=gsed
198 # This function checks whether a given readline variable
203 [[ "$( bind -v )" = *$1+([[:space:]])on* ]]
206 # This function shell-quotes the argument
209 echo \'${1//\'/\'\\\'\'}\' #'# Help vim syntax highlighting
212 # This function quotes the argument in a way so that readline dequoting
213 # results in the original argument
216 local t="${1//\\/\\\\}"
217 echo \'${t//\'/\'\\\'\'}\' #'# Help vim syntax highlighting
220 # This function shell-dequotes the argument
227 # Get the word to complete
228 # This is nicer than ${COMP_WORDS[$COMP_CWORD]}, since it handles cases
229 # where the user is completing in the middle of a word.
230 # (For example, if the line is "ls foobar",
231 # and the cursor is here --------> ^
232 # it will complete just "foo", not "foobar", which is what the user wants.)
235 if [[ "${#COMP_WORDS[COMP_CWORD]}" -eq 0 ]] || [[ "$COMP_POINT" == "${#COMP_LINE}" ]]; then
236 echo "${COMP_WORDS[COMP_CWORD]}"
239 local cur="$COMP_LINE"
240 local index="$COMP_POINT"
241 for (( i = 0; i <= COMP_CWORD; ++i )); do
242 while [[ "${#cur}" -ge ${#COMP_WORDS[i]} ]] && [[ "${cur:0:${#COMP_WORDS[i]}}" != "${COMP_WORDS[i]}" ]]; do
244 index="$(( index - 1 ))"
246 if [[ "$i" -lt "$COMP_CWORD" ]]; then
247 local old_size="${#cur}"
248 cur="${cur#${COMP_WORDS[i]}}"
249 local new_size="${#cur}"
250 index="$(( index - old_size + new_size ))"
254 if [[ "${COMP_WORDS[COMP_CWORD]:0:${#cur}}" != "$cur" ]]; then
255 # We messed up! At least return the whole word so things keep working
256 echo "${COMP_WORDS[COMP_CWORD]}"
258 echo "${cur:0:$index}"
264 # This function performs file and directory completion. It's better than
265 # simply using 'compgen -f', because it honours spaces in filenames.
266 # If passed -d, it completes only on directories. If passed anything else,
267 # it's assumed to be a file glob to complete on.
271 local IFS=$'\t\n' xspec
276 while read -r tmp; do
277 [[ -n $tmp ]] && toks[${#toks[@]}]=$tmp
278 done < <( compgen -d -- "$(quote_readline "$cur")" )
280 if [[ "$1" != -d ]]; then
282 while read -r tmp; do
283 [[ -n $tmp ]] && toks[${#toks[@]}]=$tmp
284 done < <( compgen -f -X "$xspec" -- "$(quote_readline "$cur")" )
287 COMPREPLY=( "${COMPREPLY[@]}" "${toks[@]}" )
290 # This function completes on signal names
296 # standard signal completion is rather braindead, so we need
297 # to hack around to get what we want here, which is to
298 # complete on a dash, followed by the signal name minus
300 COMPREPLY=( $( compgen -A signal SIG${cur#-} ))
301 for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
302 COMPREPLY[i]=-${COMPREPLY[i]#SIG}
306 # This function completes on configured network interfaces
308 _configured_interfaces()
310 if [ -f /etc/debian_version ]; then
312 COMPREPLY=( $( sed -ne 's|^iface \([^ ]\+\).*$|\1|p' \
313 /etc/network/interfaces ) )
314 elif [ -f /etc/SuSE-release ]; then
316 COMPREPLY=( $( command ls \
317 /etc/sysconfig/network/ifcfg-* | \
318 sed -ne 's|.*ifcfg-\('$cur'.*\)|\1|p' ) )
319 elif [ -f /etc/pld-release ]; then
321 COMPREPLY=( $( command ls -B \
322 /etc/sysconfig/interfaces | \
323 sed -ne 's|.*ifcfg-\('$cur'.*\)|\1|p' ) )
326 COMPREPLY=( $( command ls \
327 /etc/sysconfig/network-scripts/ifcfg-* | \
328 sed -ne 's|.*ifcfg-\('$cur'.*\)|\1|p' ) )
332 # This function completes on all available network interfaces
333 # -a: restrict to active interfaces only
334 # -w: restrict to wireless interfaces only
336 _available_interfaces()
340 if [ "${1:-}" = -w ]; then
342 elif [ "${1:-}" = -a ]; then
348 COMPREPLY=( $( eval $cmd 2>/dev/null | \
349 sed -ne 's|^\('$cur'[^[:space:][:punct:]]\{1,\}\).*$|\1|p') )
352 # This function expands tildes in pathnames
356 # FIXME: Why was this here?
357 # [ "$cur" != "${cur%\\}" ] && cur="$cur\\"
359 # expand ~username type directory specifications
360 if [[ "$cur" == \~*/* ]]; then
362 elif [[ "$cur" == \~* ]]; then
364 COMPREPLY=( $( compgen -P '~' -u $cur ) )
365 return ${#COMPREPLY[@]}
369 # This function completes on process IDs.
370 # AIX and Solaris ps prefers X/Open syntax.
371 [ $UNAME = SunOS -o $UNAME = AIX ] &&
374 COMPREPLY=( $( compgen -W '$( command ps -efo pid | sed 1d )' -- $cur ))
378 COMPREPLY=( $( compgen -W '$( command ps axo pid | sed 1d )' -- $cur ) )
381 # This function completes on process group IDs.
382 # AIX and SunOS prefer X/Open, all else should be BSD.
383 [ $UNAME = SunOS -o $UNAME = AIX ] &&
386 COMPREPLY=( $( compgen -W '$( command ps -efo pgid | sed 1d )' -- $cur ))
390 COMPREPLY=( $( compgen -W '$( command ps axo pgid | sed 1d )' -- $cur ))
393 # This function completes on user IDs
397 if type getent &>/dev/null; then
398 COMPREPLY=( $( getent passwd | \
399 awk -F: '{if ($3 ~ /^'$cur'/) print $3}' ) )
400 elif type perl &>/dev/null; then
401 COMPREPLY=( $( compgen -W '$( perl -e '"'"'while (($uid) = (getpwent)[2]) { print $uid . "\n" }'"'"' )' -- $cur ) )
403 # make do with /etc/passwd
404 COMPREPLY=( $( awk 'BEGIN {FS=":"} {if ($3 ~ /^'$cur'/) print $3}'\
409 # This function completes on group IDs
413 if type getent &>/dev/null; then
414 COMPREPLY=( $( getent group | \
415 awk -F: '{if ($3 ~ /^'$cur'/) print $3}' ) )
416 elif type perl &>/dev/null; then
417 COMPREPLY=( $( compgen -W '$( perl -e '"'"'while (($gid) = (getgrent)[2]) { print $gid . "\n" }'"'"' )' -- $cur ) )
419 # make do with /etc/group
420 COMPREPLY=( $( awk 'BEGIN {FS=":"} {if ($3 ~ /^'$cur'/) print $3}'\
425 # This function completes on services
430 [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d
432 COMPREPLY=( $( builtin echo $sysvdir/!(*.rpmsave|*.rpmorig|*~|functions)) )
434 if [ -d $famdir ]; then
435 COMPREPLY=( "${COMPREPLY[@]}" $( builtin echo $famdir/!(*.rpmsave|*.rpmorig|*~)) )
438 COMPREPLY=( $( compgen -W '${COMPREPLY[@]#@($sysvdir|$famdir)/}' -- $cur ) )
441 # This function complete on modules
446 modpath=/lib/modules/$1
447 COMPREPLY=( $( command ls -R $modpath | \
448 sed -ne 's/^\('$cur'.*\)\.k\?o\(\|.gz\)$/\1/p') )
451 # this function complete on user:group format
457 if [[ $cur = *@(\\:|.)* ]] && [ -n "$bash205" ]; then
458 user=${cur%%*([^:.])}
459 COMPREPLY=( $(compgen -P ${user/\\\\} -g -- ${cur##*[.:]}) )
460 elif [[ $cur = *:* ]] && [ -n "$bash205" ]; then
461 COMPREPLY=( $( compgen -g -- ${cur##*[.:]} ) )
463 COMPREPLY=( $( compgen -S : -u -- $cur ) )
467 # this function count the number of mandatory args
472 for (( i=1; i < COMP_CWORD; i++ )); do
473 if [[ "${COMP_WORDS[i]}" != -* ]]; then
479 # start of section containing completion functions for bash built-ins
481 # bash alias completion
488 cur=${COMP_WORDS[$COMP_CWORD]}
492 COMPREPLY=( $( compgen -A alias -S '=' -- $cur ) )
495 COMPREPLY=( "$( alias ${cur%=} 2>/dev/null | \
496 sed -e 's|^alias '$cur'\(.*\)$|\1|' )" )
500 complete -F _alias $nospace alias
502 # bash export completion
509 cur=${COMP_WORDS[$COMP_CWORD]}
513 COMPREPLY=( $( compgen -v -P '$' -- ${cur#*=\$} ) )
516 COMPREPLY=( $( compgen -v -S '=' -- $cur ) )
519 COMPREPLY=( "$( eval echo -n \"$`echo ${cur%=}`\" |
521 sed -e 's/'\''/'\''\\\'\'''\''/g'
526 complete -F _export $default $nospace export
528 # bash shell function completion
536 prev=${COMP_WORDS[COMP_CWORD-1]}
538 if [[ $1 == @(declare|typeset) ]]; then
539 if [ "$prev" = -f ]; then
540 COMPREPLY=( $( compgen -A function -- $cur ) )
541 elif [[ "$cur" == -* ]]; then
542 COMPREPLY=( $( compgen -W '-a -f -F -i -r -x -p' -- \
545 elif [ $COMP_CWORD -eq 1 ]; then
546 COMPREPLY=( $( compgen -A function -- $cur ) )
548 COMPREPLY=( "() $( type -- ${COMP_WORDS[1]} | sed -e 1,2d )" )
551 complete -F _function function declare typeset
553 # bash complete completion
557 local cur prev options
561 prev=${COMP_WORDS[COMP_CWORD-1]}
565 options="default dirnames filenames"
566 [ -n "$bash205b" ] && options="$options nospace"
567 [ -n "$bash3" ] && options="$options bashdefault plusdirs"
568 COMPREPLY=( $( compgen -W "$options" -- $cur ) )
573 COMPREPLY=( $( compgen -W 'alias arrayvar binding \
574 builtin command directory disabled enabled \
575 export file function group helptopic hostname \
576 job keyword running service setopt shopt \
577 signal stopped user variable' -- $cur ) )
582 COMPREPLY=( $( compgen -A command -- $cur ) )
586 COMPREPLY=( $( compgen -A function -- $cur ) )
590 COMPREPLY=( $( complete -p | sed -e 's|.* ||' | \
597 if [[ "$cur" == -* ]]; then
598 # relevant options completion
599 options="-a -b -c -d -e -f -g -j -k -s -v -u -A -G -W -P -S -X -F -C"
600 [ -n "$bash205" ] && options="$options -o"
601 COMPREPLY=( $( compgen -W "$options" -- $cur ) )
603 COMPREPLY=( $( compgen -A command -- $cur ) )
606 complete -F _complete complete
608 # start of section containing completion functions for external programs
610 # a little help for FreeBSD ports users
611 [ $UNAME = FreeBSD ] && complete -W 'index search fetch fetch-list \
612 extract patch configure build install reinstall \
613 deinstall clean clean-depends kernel buildworld' make
615 # This completes on a list of all available service scripts for the
616 # 'service' command and/or the SysV init.d directory, followed by
617 # that script's available commands
619 { have service || [ -d /etc/init.d/ ]; } &&
625 prev=${COMP_WORDS[COMP_CWORD-1]}
628 # don't complete for things like killall, ssh and mysql if it's
629 # the standalone command, rather than the init script
630 [[ ${COMP_WORDS[0]} != @(*init.d/!(functions|~)|service) ]] && return 0
632 # don't complete past 2nd token
633 [ $COMP_CWORD -gt 2 ] && return 0
635 [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \
636 || sysvdir=/etc/init.d
638 if [[ $COMP_CWORD -eq 1 ]] && [[ $prev == "service" ]]; then
641 COMPREPLY=( $( compgen -W '`sed -ne "y/|/ /; \
642 s/^.*Usage.*{\(.*\)}.*$/\1/p" \
643 $sysvdir/${prev##*/} 2>/dev/null`' -- $cur ) )
648 complete -F _service service
649 [ -d /etc/init.d/ ] && complete -F _service $default \
650 $(for i in /etc/init.d/*; do echo ${i##*/}; done)
652 # chown(1) completion
660 if [[ "$cur" == -* ]]; then
661 COMPREPLY=( $( compgen -W '-c -h -f -R -v --changes \
662 --dereference --no-dereference --from= --silent --quiet \
663 --reference= --recursive --verbose --help --version' -- $cur ) )
677 complete -F _chown $filenames chown
679 # chgrp(1) completion
688 prev=${COMP_WORDS[COMP_CWORD-1]}
691 if [[ "$cur" == -* ]]; then
692 COMPREPLY=( $( compgen -W '-c -h -f -R -v --changes \
693 --dereference --no-dereference --silent --quiet \
694 --reference= --recursive --verbose --help --version' -- $cur ) )
698 # first parameter on line or first since an option?
699 if [ $COMP_CWORD -eq 1 ] && [[ "$cur" != -* ]] || \
700 [[ "$prev" == -* ]] && [ -n "$bash205" ]; then
702 COMPREPLY=( $( compgen -g $cur 2>/dev/null ) )
709 complete -F _chgrp $filenames chgrp
711 # umount(8) completion. This relies on the mount point being the third
712 # space-delimited field in the output of mount(8)
723 COMPREPLY=( $( compgen -W '$( mount | cut -d" " -f 3 )' -- $cur ) )
728 complete -F _umount $dirnames umount
730 # mount(8) completion. This will pull a list of possible mounts out of
731 # /etc/{,v}fstab, unless the word being completed contains a ':', which
732 # would indicate the specification of an NFS server. In that case, we
733 # query the server for a list of all available exports and complete on
737 { local cur i sm host
741 [[ "$cur" == \\ ]] && cur="/"
743 for i in {,/usr}/{,s}bin/showmount; do [ -x $i ] && sm=$i && break; done
745 if [ -n "$sm" ] && [[ "$cur" == *:* ]]; then
746 COMPREPLY=( $( $sm -e ${cur%%:*} | sed 1d | \
747 grep ^${cur#*:} | awk '{print $1}' ) )
748 elif [[ "$cur" == //* ]]; then
751 if [ -n "$host" ]; then
752 COMPREPLY=( $( compgen -W "$( echo $( smbclient -d 0 -NL $host 2>/dev/null|
753 sed -ne '/^['"$'\t '"']*Sharename/,/^$/p' |
754 sed -ne '3,$s|^[^A-Za-z]*\([^'"$'\t '"']*\).*$|//'$host'/\1|p' ) )" -- "$cur" ) )
756 elif [ -r /etc/vfstab ]; then
758 COMPREPLY=( $( awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' \
759 /etc/vfstab | grep "^$cur" ) )
760 elif [ ! -e /etc/fstab ]; then
762 COMPREPLY=( $( mount | awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' \
766 COMPREPLY=( $( awk '! /^[ \t]*#/ {if ($2 ~ /\//) print $2}' \
767 /etc/fstab | grep "^$cur" ) )
772 complete -F _mount $default $filenames mount
774 # Linux rmmod(8) completion. This completes on a list of all currently
775 # installed kernel modules.
785 COMPREPLY=( $( /sbin/lsmod | \
786 awk '{if (NR != 1 && $1 ~ /^'$cur'/) print $1}' 2>/dev/null ))
789 complete -F _rmmod rmmod
791 # Linux insmod(8), modprobe(8) and modinfo(8) completion. This completes on a
792 # list of all available modules for the version of the kernel currently
797 local cur prev modpath
801 prev=${COMP_WORDS[COMP_CWORD-1]}
803 # behave like lsmod for modprobe -r
804 if [ $1 = "modprobe" ] &&
805 [ "${COMP_WORDS[1]}" = "-r" ]; then
806 COMPREPLY=( $( /sbin/lsmod | \
807 awk '{if (NR != 1 && $1 ~ /^'$cur'/) print $1}' ) )
811 # do filename completion if we're giving a path to a module
812 if [[ "$cur" == */* ]]; then
813 _filedir '@(?(k)o?(.gz))'
817 if [ $COMP_CWORD -gt 1 ] &&
818 [[ "${COMP_WORDS[COMP_CWORD-1]}" != -* ]]; then
819 # do module parameter completion
820 COMPREPLY=( $( /sbin/modinfo -p ${COMP_WORDS[1]} 2>/dev/null | \
821 awk '{if ($1 ~ /^parm:/ && $2 ~ /^'$cur'/) { print $2 } \
822 else if ($1 !~ /:/ && $1 ~ /^'$cur'/) { print $1 }}' ) )
829 complete -F _insmod $filenames insmod modprobe modinfo
834 [ $UNAME = GNU -o $UNAME = Linux -o $UNAME = Darwin \
835 -o $UNAME = FreeBSD -o $UNAME = SunOS -o $UNAME = Cygwin \
836 -o $UNAME = OpenBSD ] &&
839 local cur prev sect manpath UNAME
843 prev=${COMP_WORDS[COMP_CWORD-1]}
847 # default completion if parameter contains /
848 if [[ "$cur" == */* ]]; then
854 # strip OS type and version under Cygwin
855 UNAME=${UNAME/CYGWIN_*/Cygwin}
856 if [ $UNAME = GNU -o $UNAME = Linux -o $UNAME = FreeBSD \
857 -o $UNAME = Cygwin ]; then
858 manpath=$( manpath 2>/dev/null || command man --path )
863 if [ -z "$manpath" ]; then
864 COMPREPLY=( $( compgen -c -- $cur ) )
868 # determine manual section to search
869 [[ "$prev" == [0-9ln] ]] && sect=$prev || sect='*'
872 if [ -n "$cur" ]; then
873 manpath="${manpath//://*man$sect/$cur* } ${manpath//://*cat$sect/$cur* }"
875 manpath="${manpath//://*man$sect/ } ${manpath//://*cat$sect/ }"
878 # redirect stderr for when path doesn't exist
879 COMPREPLY=( $( eval command ls "$manpath" 2>/dev/null ) )
880 # weed out directory path names and paths to man pages
881 COMPREPLY=( ${COMPREPLY[@]##*/?(:)} )
882 # strip suffix from man pages
883 COMPREPLY=( ${COMPREPLY[@]%.@(gz|bz2)} )
884 COMPREPLY=( $( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" ) )
886 [[ "$prev" != [0-9ln] ]] && _filedir '[0-9ln]'
890 [ $UNAME = GNU -o $UNAME = Linux -o $UNAME = Darwin \
891 -o $UNAME = FreeBSD -o $UNAME = SunOS -o $UNAME = Cygwin \
892 -o $UNAME = OpenBSD ] && \
893 complete -F _man $filenames man apropos whatis
895 # renice(8) completion
899 local command cur curopt i
906 # walk back through command line and find last option
907 while [ $i -le $COMP_CWORD -a ${#COMPREPLY[@]} -eq 0 ]; do
908 curopt=${COMP_WORDS[COMP_CWORD-$i]}
911 COMPREPLY=( $( compgen -u -- $cur ) )
923 complete -F _renice renice
934 if [ $COMP_CWORD -eq 1 ] && [[ "$cur" == -* ]]; then
935 # return list of available signals
938 # return list of available PIDs
942 complete -F _kill kill
944 # Linux and FreeBSD killall(1) completion.
946 [ $UNAME = Linux -o $UNAME = FreeBSD ] &&
954 if [ $COMP_CWORD -eq 1 ] && [[ "$cur" == -* ]]; then
957 COMPREPLY=( $( compgen -W '$( command ps axo command | \
958 sed -ne "1d; s/^\[\?\([^-][^] ]*\).*$/\1/p" | \
959 sed -e "s/.*\///" )' -- $cur ) )
964 [ $UNAME = Linux -o $UNAME = FreeBSD ] && complete -F _killall killall pkill
966 # Linux and FreeBSD pgrep(1) completion.
968 [ $UNAME = Linux -o $UNAME = FreeBSD ] &&
976 COMPREPLY=( $( compgen -W '$( command ps axo command | \
977 sed -ne "1d; s/^\[\?\([^-][^] ]*\).*$/\1/p" | \
978 sed -e "s/.*\///" )' -- $cur ) )
982 [ $UNAME = Linux -o $UNAME = FreeBSD ] && complete -F _pgrep pgrep
983 # Linux pidof(8) completion.
984 [ $UNAME = Linux ] && complete -F _pgrep pidof
986 # GNU find(1) completion. This makes heavy use of ksh style extended
987 # globs and contains Linux specific code for completing the parameter
988 # to the -fstype option.
992 local cur prev i exprfound onlyonce
996 prev=${COMP_WORDS[COMP_CWORD-1]}
1000 COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9' -- $cur ) )
1003 -?(a|c)newer|-fls|-fprint?(0|f)|-?(i)?(l)name|-?(i)wholename)
1008 # this is highly non-portable
1009 [ -e /proc/filesystems ] &&
1010 COMPREPLY=( $( cut -d$'\t' -f 2 /proc/filesystems | \
1019 if [ -n "$bash205" ]; then
1020 COMPREPLY=( $( compgen -g -- $cur 2>/dev/null) )
1025 COMPREPLY=( $( compgen -W 'b c d p f l s' -- $cur ) )
1033 COMPREPLY=( $( compgen -u -- $cur ) )
1037 COMP_WORDS=(COMP_WORDS[0] $cur)
1042 -[acm]min|-[acm]time|-?(i)?(l)name|-inum|-?(i)path|-?(i)regex| \
1043 -links|-perm|-size|-used|-printf)
1044 # do nothing, just wait for a parameter to be given
1051 # set exprfound to 1 if there is already an expression present
1052 for i in ${COMP_WORDS[@]}; do
1053 [[ "$i" = [-\(\),\!]* ]] && exprfound=1 && break
1056 # handle case where first parameter is not a dash option
1057 if [ "$exprfound" != 1 ] && [[ "$cur" != [-\(\),\!]* ]]; then
1062 # complete using basic options
1063 COMPREPLY=( $( compgen -W '-daystart -depth -follow -help -maxdepth \
1064 -mindepth -mount -noleaf -version -xdev -amin -anewer \
1065 -atime -cmin -cnewer -ctime -empty -false -fstype \
1066 -gid -group -ilname -iname -inum -ipath -iregex \
1068 -links -lname -mmin -mtime -name -newer -nouser \
1069 -nogroup -perm -regex -size -true -type -uid -used \
1070 -user -xtype -exec -fls -fprint -fprint0 -fprintf -ok \
1071 -print -print0 -printf -prune -ls' -- $cur ) )
1073 # this removes any options from the list of completions that have
1074 # already been specified somewhere on the command line, as long as
1075 # these options can only be used once (in a word, "options", in
1076 # opposition to "tests" and "actions", as in the find(1) manpage).
1077 onlyonce=' -daystart -depth -follow -help -maxdepth -mindepth -mount \
1078 -noleaf -version -xdev '
1079 COMPREPLY=( $( echo "${COMP_WORDS[@]}" | \
1080 (while read -d ' ' i; do
1082 [ "${onlyonce/ ${i%% *} / }" == "$onlyonce" ] &&
1084 # flatten array with spaces on either side,
1085 # otherwise we cannot grep on word boundaries of
1086 # first and last word
1087 COMPREPLY=" ${COMPREPLY[@]} "
1088 # remove word from list of completions
1089 COMPREPLY=( ${COMPREPLY/ ${i%% *} / } )
1091 echo "${COMPREPLY[@]}")
1098 complete -F _find $filenames find
1100 # Linux iwconfig(8) completion
1102 [ $UNAME = Linux ] && have iwconfig &&
1109 prev=${COMP_WORDS[COMP_CWORD-1]}
1113 COMPREPLY=( $( compgen -W 'managed ad-hoc master \
1114 repeater secondary monitor' -- $cur ) )
1118 COMPREPLY=( $( compgen -W 'on off any' -- $cur ) )
1119 if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
1120 COMPREPLY=( "${COMPREPLY[@]}" \
1121 $( iwlist ${COMP_WORDS[1]} scan | \
1122 awk -F '"' '/ESSID/ {print $2}' | \
1128 COMPREPLY=( $( compgen -W 'on off' -- $cur ) )
1132 COMPREPLY=( $( iwlist ${COMP_WORDS[1]} channel | \
1133 awk '/^[[:space:]]*Channel/ {print $2}' | \
1139 COMPREPLY=( $( iwlist ${COMP_WORDS[1]} channel | \
1140 awk '/^[[:space:]]*Channel/ {print $4"G"}' | \
1145 COMPREPLY=( $( compgen -W 'on off any' -- $cur ) )
1146 if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
1147 COMPREPLY=( "${COMPREPLY[@]}" \
1148 $( iwlist ${COMP_WORDS[1]} scan | \
1149 awk -F ': ' '/Address/ {print $2}' | \
1155 COMPREPLY=( $( compgen -W 'auto fixed' -- $cur ) )
1156 COMPREPLY=( "${COMPREPLY[@]}" \
1157 $( iwlist ${COMP_WORDS[1]} rate | \
1158 awk '/^[[:space:]]*[0-9]/ {print $1"M"}' | \
1163 COMPREPLY=( $( compgen -W 'auto fixed off' -- $cur ) )
1167 COMPREPLY=( $( compgen -W 'auto fixed off' -- $cur ) )
1171 COMPREPLY=( $( compgen -W 'off on open restricted' -- $cur ) )
1175 COMPREPLY=( $( compgen -W 'off on open restricted' -- $cur ) )
1179 COMPREPLY=( $( compgen -W 'period timeout off on' -- $cur ) )
1183 COMPREPLY=( $( compgen -W 'off on auto' -- $cur ) )
1187 COMPREPLY=( $( compgen -W 'limit lifetime' -- $cur ) )
1192 if [ $COMP_CWORD -eq 1 ]; then
1193 if [[ "$cur" == -* ]]; then
1194 COMPREPLY=( $( compgen -W '--help --version' -- $cur ) )
1196 _available_interfaces -w
1199 COMPREPLY=( $( compgen -W 'essid nwid mode freq channel sens mode \
1200 ap nick rate rts frag enc key power txpower commit' -- $cur ) )
1204 complete -F _iwconfig iwconfig
1206 # Linux iwlist(8) completion
1208 [ $UNAME = Linux ] && have iwlist &&
1215 prev=${COMP_WORDS[COMP_CWORD-1]}
1217 if [ $COMP_CWORD -eq 1 ]; then
1218 if [[ "$cur" == -* ]]; then
1219 COMPREPLY=( $( compgen -W '--help --version' -- $cur ) )
1221 _available_interfaces -w
1224 COMPREPLY=( $( compgen -W 'scan scanning freq frequency \
1225 channel rate bit bitrate key enc encryption power \
1226 txpower retry ap accesspoint peers event' -- $cur ) )
1229 complete -F _iwlist iwlist
1231 # Linux iwspy(8) completion
1233 [ $UNAME = Linux ] && have iwspy &&
1241 if [ $COMP_CWORD -eq 1 ]; then
1242 if [[ "$cur" == -* ]]; then
1243 COMPREPLY=( $( compgen -W '--help --version' -- $cur ) )
1245 _available_interfaces -w
1248 COMPREPLY=( $( compgen -W 'setthr getthr off' -- $cur ) )
1251 complete -F _iwspy iwspy
1253 # Linux iwpriv(8) completion
1255 [ $UNAME = Linux ] && have iwpriv &&
1262 prev=${COMP_WORDS[COMP_CWORD-1]}
1266 COMPREPLY=( $( compgen -W 'on off' -- $cur ) )
1270 COMPREPLY=( $( compgen -W 'ad-hoc managed' -- $cur ) )
1275 if [ $COMP_CWORD -eq 1 ]; then
1276 if [[ "$cur" == -* ]]; then
1277 COMPREPLY=( $( compgen -W '--help --version' -- $cur ) )
1279 _available_interfaces -w
1282 COMPREPLY=( $( compgen -W '--all roam port' -- $cur ) )
1285 complete -F _iwpriv iwpriv
1287 # RedHat & Debian GNU/Linux if{up,down} completion
1289 [ $UNAME = Linux ] && { have ifup || have ifdown; } &&
1297 if [ $COMP_CWORD -eq 1 ]; then
1298 _configured_interfaces
1299 COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- "$cur") )
1304 complete -F _ifupdown ifup ifdown
1305 [ $UNAME = Linux ] && have ifstatus && complete -F _ifupdown ifstatus
1307 # Linux ipsec(8) completion (for FreeS/WAN)
1309 [ $UNAME = Linux ] && have ipsec &&
1318 if [ $COMP_CWORD -eq 1 ]; then
1319 COMPREPLY=( $( compgen -W 'auto barf eroute klipsdebug look \
1320 manual pluto ranbits rsasigkey \
1321 setup showdefaults showhostkey spi \
1322 spigrp tncfg whack' -- $cur ) )
1326 case ${COMP_WORDS[1]} in
1328 COMPREPLY=( $( compgen -W '--asynchronous --up --add --delete \
1329 --replace --down --route --unroute \
1330 --ready --status --rereadsecrets' \
1334 COMPREPLY=( $( compgen -W '--up --down --route --unroute \
1335 --union' -- $cur ) )
1338 COMPREPLY=( $( compgen -W '--quick --continuous --bytes' \
1342 COMPREPLY=( $( compgen -W '--start --stop --restart' -- $cur ) )
1351 complete -F _ipsec ipsec
1353 # Postfix completion.
1363 prev=${COMP_WORDS[COMP_CWORD-1]}
1365 if [[ $cur == '-' ]]; then
1366 COMPREPLY=(-c -D -v)
1369 if [[ $prev == '-c' ]]; then
1373 if [[ $prev == '-D' ]]; then
1374 COMPREPLY=( $( compgen -W 'start' -- "`get_cword`" ) )
1377 COMPREPLY=( $( compgen -W 'start stop reload abort flush check' -- \
1380 complete -F _postfix postfix
1382 # postalias(1) and postmap(1)
1386 local cur prev len idx
1389 prev=${COMP_WORDS[COMP_CWORD-1]}
1391 if [[ $cur == '-' ]]; then
1392 COMPREPLY=(-N -f -i -n -o -p -r -v -w -c -d -q)
1395 if [[ $prev == '-c' ]]; then
1399 if [[ $prev == -[dq] ]]; then
1403 if [[ "$cur" == *:* ]]; then
1404 COMPREPLY=( $( compgen -f -- ${cur#*:} ) )
1408 for pval in $( /usr/sbin/postconf -m ); do
1409 if [[ "$cur" == "${pval:0:$len}" ]]; then
1410 COMPREPLY[$idx]="$pval:"
1414 if [[ $idx -eq 0 ]]; then
1415 COMPREPLY=( $( compgen -f -- "$cur" ) )
1420 complete -F _postmap postmap postalias
1426 local cur prev pval len idx qfile
1429 prev=${COMP_WORDS[COMP_CWORD-1]}
1431 if [[ $cur == '-' ]]; then
1432 COMPREPLY=(-c -q -v)
1435 if [[ $prev == '-c' ]]; then
1441 for idx in "${COMP_WORDS[@]}"; do
1442 [[ "$idx" = -q ]] && qfile=1 && break
1444 if [[ $qfile == 1 ]]; then
1447 for pval in $( mailq | \
1448 sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* !].*$//' ); do
1449 if [[ "$cur" == "${pval:0:$len}" ]]; then
1450 COMPREPLY[$idx]=$pval
1460 complete -F _postcat postcat
1466 local cur prev pval len idx eqext
1469 prev=${COMP_WORDS[COMP_CWORD-1]}
1470 if [[ $cur == '-' ]]; then
1471 COMPREPLY=(-c -d -e -h -m -l -n -v)
1474 if [[ $prev == '-c' ]]; then
1478 if [[ $prev == '-e' ]]; then
1484 for pval in $( /usr/sbin/postconf | cut -d ' ' -f 1 ); do
1485 if [[ "$cur" == "${pval:0:$len}" ]]; then
1486 COMPREPLY[$idx]="$pval$eqext"
1492 complete -F _postconf postconf
1498 local cur prev pval len idx
1501 prev=${COMP_WORDS[COMP_CWORD-1]}
1503 if [[ $cur == '-' ]]; then
1504 COMPREPLY=(-c -d -h -H -p -r -s -v)
1511 for pval in $( echo ALL; mailq | \
1512 sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* !].*$//' ); do
1513 if [[ "$cur" == "${pval:0:$len}" ]]; then
1514 COMPREPLY[$idx]=$pval
1523 for pval in $( echo ALL; mailq | \
1524 sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* ].*$//; /!$/d' ); do
1525 if [[ "$cur" == "${pval:0:$len}" ]]; then
1526 COMPREPLY[$idx]=$pval
1535 for pval in $( echo ALL; mailq | \
1536 sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; /^[0-9A-Z]*[* ]/d; s/!.*$//' ); do
1537 if [[ "$cur" == "${pval:0:$len}" ]]; then
1538 COMPREPLY[$idx]=$pval
1545 COMPREPLY=( $( compgen -W 'hold incoming active deferred' -- $cur ) )
1548 complete -F _postsuper postsuper
1556 [ -z ${prefix:-} ] || prefix=${cur%/*}/
1557 [ -r ${prefix:-}CVS/Entries ] || prefix=""
1563 [ -r ${prefix:-}CVS/Entries ] && \
1564 entries=$(cut -d/ -f2 -s ${prefix:-}CVS/Entries)
1569 if [ -n "$prefix" ]; then
1570 COMPREPLY=( $( command ls -d ${cvsroot}/${prefix}/!(CVSROOT) ) )
1572 COMPREPLY=( $( command ls -d ${cvsroot}/!(CVSROOT) ) )
1578 local cur count mode i cvsroot cvsroots pwd
1579 local -a flags miss files entries changed newremoved
1585 for i in "${COMP_WORDS[@]}"; do
1586 [ $count -eq $COMP_CWORD ] && break
1587 # Last parameter was the CVSROOT, now go back to mode selection
1588 if [ "${COMP_WORDS[((count))]}" == "$cvsroot" -a "$mode" == "cvsroot" ]; then
1591 if [ -z "$mode" ]; then
1595 cvsroot=${COMP_WORDS[((count+1))]}
1636 @(remove|rm|delete))
1654 elif [[ "$i" = -* ]]; then
1655 flags=( "${flags[@]}" $i )
1662 if [[ "$cur" != -* ]]; then
1664 if [ $COMP_CWORD -gt 1 -a -r ${prefix:-}CVS/Entries ]; then
1667 files=$( command ls -Ad !(CVS) ) || \
1668 files=$( command ls -d ${cur}* 2>/dev/null )
1669 for i in "${entries[@]}"; do
1670 files=( ${files[@]/#$i//} )
1672 COMPREPLY=( $( compgen -W '${files[@]}' -- \
1676 COMPREPLY=( $( compgen -W '-k -m' -- $cur ) )
1680 if [[ "$cur" = -* ]]; then
1681 COMPREPLY=( $( compgen -W '-i -a -A -e -b -c -k -l -u \
1682 -L -U -m -M -n -N -o -q -I \
1683 -s -t -t- -T -V -x -z' -- \
1688 if [[ "$cur" = -* ]]; then
1689 COMPREPLY=( $( compgen -W '-D -F -f -l -R -r' -- $cur ) )
1692 COMPREPLY=( $( compgen -W '${entries[@]}' -- $cur ) )
1696 if [[ "$cur" != -* ]]; then
1697 [ -z "$cvsroot" ] && cvsroot=$CVSROOT
1698 COMPREPLY=( $( cvs -d "$cvsroot" co -c 2> /dev/null | \
1699 awk '{print $1}' ) )
1700 COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- $cur ) )
1702 COMPREPLY=( $( compgen -W '-A -N -P -R -c -f -l -n -p \
1703 -s -r -D -d -k -j' -- $cur ) )
1709 if [[ "$cur" != -* ]] && [ -r ${prefix:-}CVS/Entries ]; then
1710 # if $COMP_CVS_REMOTE is not null, 'cvs commit' will
1711 # complete on remotely checked-out files (requires
1712 # passwordless access to the remote repository
1713 if [ -n "${COMP_CVS_REMOTE:-}" ]; then
1714 # this is the least computationally intensive
1715 # way found so far, but other changes
1716 # (something other than changed/removed/new)
1718 changed=( $( cvs -q diff --brief 2>&1 | \
1719 sed -ne 's/^Files [^ ]* and \([^ ]*\) differ$/\1/p' ) )
1720 newremoved=( $( cvs -q diff --brief 2>&1 | \
1721 sed -ne 's/^cvs diff: \([^ ]*\) .*, no comparison available$/\1/p' ) )
1722 COMPREPLY=( $( compgen -W '${changed[@]:-} \
1723 ${newremoved[@]:-}' -- $cur ) )
1728 COMPREPLY=( $( compgen -W '-n -R -l -f -F -m -r' -- \
1733 if [ -r ~/.cvspass ]; then
1734 # Ugly escaping because of bash treating ':' specially
1735 cvsroots=$( sed 's/^[^ ]* //; s/:/\\:/g' ~/.cvspass )
1736 COMPREPLY=( $( compgen -W '$cvsroots' -- $cur ) )
1740 if [[ "$cur" != -* ]]; then
1741 [ -z "$cvsroot" ] && cvsroot=$CVSROOT
1742 COMPREPLY=( $( cvs -d "$cvsroot" co -c | awk '{print $1}' ) )
1743 COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- $cur ) )
1745 COMPREPLY=( $( compgen -W '-N -f -l -R -n \
1746 -r -D -d -k' -- $cur ) )
1750 if [[ "$cur" == -* ]]; then
1754 COMPREPLY=( $( compgen -W '${entries[@]:-}' -- $cur ) )
1758 if [[ "$cur" != -* ]]; then
1760 if [ $COMP_CWORD -gt 1 -a -r ${prefix:-}CVS/Entries ]; then
1762 # find out what files are missing
1763 for i in "${entries[@]}"; do
1764 [ ! -r "$i" ] && miss=( "${miss[@]}" $i )
1766 COMPREPLY=( $(compgen -W '${miss[@]:-}' -- $cur) )
1769 COMPREPLY=( $( compgen -W '-f -l -R' -- $cur ) )
1773 if [[ "$cur" != -* ]]; then
1774 # starts with same algorithm as checkout
1775 [ -z "$cvsroot" ] && cvsroot=$CVSROOT
1777 if [ -r ${cvsroot}/${prefix} ]; then
1779 COMPREPLY=( ${COMPREPLY[@]#$cvsroot} )
1780 COMPREPLY=( ${COMPREPLY[@]#\/} )
1784 COMPREPLY=( $( compgen -W '${COMPREPLY[@]} $pwd' -- \
1787 COMPREPLY=( $( compgen -W '-d -k -I -b -m -W' -- $cur ))
1791 if [[ "$cur" = -* ]]; then
1792 COMPREPLY=( $( compgen -W '-A -P -C -d -f -l -R -p \
1793 -k -r -D -j -I -W' -- \
1798 COMPREPLY=( $( compgen -W 'add admin annotate checkout ci co \
1799 commit diff delete edit export \
1800 freeze get history import log new \
1801 patch rcs rdiff release remove \
1802 rfreeze rlog rm rtag stat status \
1803 tag unedit up update -H -Q -q -b \
1804 -d -e -f -l -n -t -r -v -w -x -z \
1805 --help --version' -- $cur ) )
1813 complete -F _cvs $default cvs
1817 # helper functions for rpm completion
1819 _rpm_installed_packages()
1821 local ver nodig nosig
1823 if [ -r /var/log/rpmpkgs -a \
1824 /var/log/rpmpkgs -nt /var/lib/rpm/Packages ]; then
1825 # using RHL 7.2 or later - this is quicker than querying the DB
1826 COMPREPLY=( $( sed -ne \
1827 's|^\('$cur'.*\)-[0-9a-zA-Z._]\+-[0-9a-z.@]\+.*\.rpm$|\1|p' \
1828 /var/log/rpmpkgs ) )
1832 ver=$(rpm --version)
1835 if [[ "$ver" > "4.0.4" ]]; then
1838 if [[ "$ver" > "4.0.99" ]]; then
1839 nosig="--nosignature"
1842 COMPREPLY=( $( rpm -qa $nodig $nosig | sed -ne \
1843 's|^\('$cur'.*\)-[0-9a-zA-Z._]\+-[0-9a-z.@]\+$|\1|p' ) )
1850 # remove trailing backslash, or grep will complain
1852 COMPREPLY=( $( rpm -qa $nodig $nosig --queryformat '%{group}\n' | \
1854 # backslash escape spaces and translate newlines to tabs
1855 COMPREPLY=( $( echo "${COMPREPLY[@]}" | sed 's/ /\\ /g' | tr '\n' '\t' ) )
1862 local cur prev ver nodig nosig
1866 prev=${COMP_WORDS[COMP_CWORD-1]}
1869 ver=$(rpm --version); ver=${ver##* }
1871 if [[ "$ver" > "4.0.4" ]]; then
1874 if [[ "$ver" > "4.0.99" ]]; then
1875 nosig="--nosignature"
1878 if [ $COMP_CWORD -eq 1 ]; then
1879 # first parameter on line
1882 COMPREPLY=( $( compgen -W '-ba -bb -bc -bi -bl -bp -bs'\
1886 COMPREPLY=( $( compgen -W '-ta -tb -tc -ti -tl -tp -ts'\
1890 COMPREPLY=( $( compgen -W '--help --version --initdb \
1891 --checksig --recompile --rebuild --resign --addsign \
1892 --rebuilddb --showrc --setperms --setugids --tarbuild \
1893 --eval --install --upgrade --query --freshen --erase \
1894 --verify --querytags --rmsource --rmspec --clean \
1895 --import' -- $cur ) )
1898 COMPREPLY=( $( compgen -W '-b -e -F -i -q -t -U -V' \
1907 --@(@(db|exclude)path|prefix|relocate|root))
1912 # get a list of macros
1913 COMPREPLY=( $( sed -ne 's|^\(%'${cur#\%}'[^ '$'\t'']*\).*$|\1|p' \
1914 /usr/lib/rpm/macros ) )
1918 COMPREPLY=( $( compgen -c -- $cur ) )
1926 # complete on .spec files
1931 if [[ "$cur" == */* ]]; then
1934 # complete on capabilities
1935 COMPREPLY=( $( rpm -qa $nodig $nosig --queryformat \
1936 '%{providename}\n' | grep "^$cur" ) )
1941 # complete on capabilities
1942 COMPREPLY=( $( rpm -qa $nodig $nosig --queryformat \
1943 '%{requirename}\n' | grep "^$cur" ) )
1948 case "${COMP_WORDS[1]}" in
1949 -@([iFU]*|-install|-freshen|-upgrade))
1950 if [[ "$cur" == -* ]]; then
1951 COMPREPLY=( $( compgen -W '--percent --force --test \
1952 --replacepkgs --replacefiles --root --excludedocs \
1953 --includedocs --noscripts --rcfile --ignorearch \
1954 --dbpath --prefix --ignoreos --nodeps --allfiles \
1955 --ftpproxy --ftpport --justdb --httpproxy --httpport \
1956 --noorder --relocate --badreloc --notriggers \
1957 --excludepath --ignoresize --oldpackage --define \
1958 --eval --pipe --queryformat --repackage --nosuggests \
1959 --nodigest --nosignature' -- $cur ) )
1965 if [[ "$cur" == -* ]]; then
1966 COMPREPLY=( $( compgen -W '--allmatches --noscripts \
1967 --notriggers --nodeps --test --repackage' -- $cur ) )
1969 _rpm_installed_packages
1973 # check whether we're doing file completion
1974 if [ "${COMP_LINE#* -*([^ -])f}" != "$COMP_LINE" ]; then
1975 if [[ "$cur" == -* ]]; then
1976 COMPREPLY=( $( compgen -W '--scripts --root \
1977 --rcfile --requires --ftpport --ftpproxy \
1978 --httpproxy --httpport --provides --triggers \
1979 --dump --changelog --dbpath \
1980 --last --filesbypkg \
1981 --info --list --state \
1982 --docfiles --configfiles --queryformat \
1983 --conflicts --obsoletes \
1984 --nodigest --nosignature \
1985 --triggerscripts' -- $cur ) )
1989 elif [ "${COMP_LINE#* -*([^ -])g}" != "$COMP_LINE" ]; then
1991 elif [ "${COMP_LINE#* -*([^ -])p}" != "$COMP_LINE" ]; then
1992 # uninstalled package completion
1993 if [[ "$cur" == -* ]]; then
1994 COMPREPLY=( $( compgen -W '--scripts --root \
1995 --rcfile --whatprovides --whatrequires \
1996 --requires --triggeredby --ftpport --ftpproxy \
1997 --httpproxy --httpport --provides --triggers \
1998 --dump --changelog --dbpath --filesbypkg \
1999 --define --eval --pipe --showrc --info --list \
2000 --state --docfiles --configfiles --queryformat\
2001 --conflicts --obsoletes --nodigest \
2002 --nosignature' -- $cur ) )
2007 # installed package completion
2008 if [[ "$cur" == -* ]]; then
2009 COMPREPLY=( $( compgen -W '--scripts --root \
2010 --rcfile --whatprovides --whatrequires \
2011 --requires --triggeredby --ftpport --ftpproxy \
2012 --httpproxy --httpport --provides --triggers \
2013 --dump --changelog --dbpath --specfile \
2014 --querybynumber --last --filesbypkg --define \
2015 --eval --pipe --showrc --info --list --state \
2016 --docfiles --configfiles --queryformat \
2017 --conflicts --obsoletes --pkgid --hdrid \
2018 --fileid --tid --nodigest --nosignature \
2019 --triggerscripts' -- $cur ) )
2020 elif [ "${COMP_LINE#* -*([^ -])a}" == "$COMP_LINE" ]; then
2021 _rpm_installed_packages
2026 if [[ "$cur" == -* ]]; then
2027 COMPREPLY=( $( compgen -W '--nopgp --nogpg --nomd5 \
2028 --nodigest --nosignature' -- $cur ) )
2034 if [[ "$cur" == -* ]]; then
2035 COMPREPLY=( $( compgen -W '--root --rcfile --dbpath \
2036 --nodeps --nogroup --nolinkto --nomode --nomtime \
2037 --nordev --nouser --nofiles --noscripts --nomd5 \
2038 --querytags --specfile --whatrequires --whatprovides \
2039 --nodigest --nosignature' -- $cur ) )
2040 # check whether we're doing file completion
2041 elif [ "${COMP_LINE#* -*([^ -])f}" != "$COMP_LINE" ]; then
2043 elif [ "${COMP_LINE#* -*([^ -])g}" != "$COMP_LINE" ]; then
2045 elif [ "${COMP_LINE#* -*([^ -])p}" != "$COMP_LINE" ]; then
2048 _rpm_installed_packages
2052 if [[ "$cur" == -* ]]; then
2053 COMPREPLY=( $( compgen -W '--short-circuit --timecheck \
2054 --clean --rmsource --rmspec --test --sign --buildroot \
2055 --target -- buildarch --buildos --nobuild --nodeps \
2056 --nodirtokens' -- $cur ) )
2057 elif [[ ${COMP_WORDS[1]} == -b* ]]; then
2060 _filedir '@(tgz|tar.@(gz|bz2))'
2063 --re@(build|compile))
2064 if [[ "$cur" == -* ]]; then
2065 COMPREPLY=( $( compgen -W '--nodeps --rmsource \
2066 --rmspec --sign --nodirtokens --target' -- $cur ) )
2068 _filedir '?(no)src.rpm'
2072 _filedir '@(tgz|tar.@(gz|bz2))'
2078 _rpm_installed_packages
2080 --@(clean|rms@(ource|pec)))
2081 if [[ "$cur" == -* ]]; then
2082 COMPREPLY=( $( compgen -W '--clean --rmsource \
2083 --rmspec' -- $cur ) )
2088 --@(import|dbpath|root))
2089 if [[ "$cur" == -* ]]; then
2090 COMPREPLY=( $( compgen -W '--import --dbpath --root' \
2100 complete -F _rpm $filenames rpm rpmbuild
2103 # Debian apt-get(8) completion.
2108 local cur prev special i
2112 prev=${COMP_WORDS[COMP_CWORD-1]}
2114 for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
2115 if [[ ${COMP_WORDS[i]} == @(install|remove|purge|source|build-dep) ]]; then
2116 special=${COMP_WORDS[i]}
2120 if [ -n "$special" ]; then
2123 if [ -f /etc/debian_version ]; then
2125 COMPREPLY=( $( _comp_dpkg_installed_packages \
2129 _rpm_installed_packages
2134 COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) )
2147 -@(t|-target-release|-default-release))
2148 COMPREPLY=( $( apt-cache policy | \
2149 grep "release.o=Debian,a=$cur" | \
2150 sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null) )
2156 if [[ "$cur" == -* ]]; then
2158 COMPREPLY=( $( compgen -W '-d -f -h -v -m -q -s -y \
2159 -u -t -b -c -o --download-only --fix-broken \
2160 --help --version --ignore-missing \
2161 --fix-missing --no-download --quiet --simulate \
2162 --just-print --dry-run --recon --no-act --yes \
2163 --assume-yes --show-upgraded --only-source \
2164 --compile --build --ignore-hold \
2165 --target-release --no-upgrade --force-yes \
2166 --print-uris --purge --reinstall \
2167 --list-cleanup --default-release \
2168 --trivial-only --no-remove --diff-only \
2169 --tar-only --config-file --option --auto-remove' -- $cur ) )
2172 COMPREPLY=( $( compgen -W 'update upgrade dselect-upgrade \
2173 dist-upgrade install remove purge source \
2174 build-dep check clean autoclean autoremove' \
2182 complete -F _apt_get $filenames apt-get
2184 # Debian apt-cache(8) completion.
2189 local cur prev special i
2193 prev=${COMP_WORDS[COMP_CWORD-1]}
2196 if [ "$cur" != show ]; then
2197 for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
2198 if [[ ${COMP_WORDS[i]} == @(add|depends|dotty|policy|rdepends|madison|show?(pkg|src|)) ]]; then
2199 special=${COMP_WORDS[i]}
2205 if [ -n "$special" ]; then
2213 COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) )
2222 -@(c|p|s|-config-file|-@(pkg|src)-cache))
2227 if [[ "$cur" != -* ]]; then
2233 if [[ "$cur" == -* ]]; then
2235 COMPREPLY=( $( compgen -W '-h -v -p -s -q -i -f -a -g -c \
2236 -o --help --version --pkg-cache --src-cache \
2237 --quiet --important --full --all-versions \
2238 --no-all-versions --generate --no-generate \
2239 --names-only --all-names --recurse \
2240 --config-file --option' -- $cur ) )
2243 COMPREPLY=( $( compgen -W 'add gencaches show showpkg showsrc \
2244 stats dump dumpavail unmet search search \
2245 depends rdepends pkgnames dotty xvcg \
2246 policy madison' -- $cur ) )
2253 complete -F _apt_cache $filenames apt-cache
2256 # Debian aptitude(1) completion
2259 have grep-status && {
2260 _comp_dpkg_hold_packages()
2262 grep-status -P -e "^$1" -a -FStatus 'hold' -n -s Package
2265 _comp_dpkg_hold_packages()
2267 grep -B 2 'hold' /var/lib/dpkg/status | grep "Package: $1" \
2274 local cur dashoptions prev special i
2278 prev=${COMP_WORDS[COMP_CWORD-1]}
2281 dashoptions='-S -u -i -h --help --version -s --simulate -d \
2282 --download-only -P --prompt -y --assume-yes -F \
2283 --display-format -O --sort -w --width -f -r -g \
2284 --with-recommends --with-suggests -R -G \
2285 --without-recommends --without-suggests -t \
2286 --target-release -V --show-versions -D --show-deps\
2287 -Z -v --verbose --purge-unused'
2289 for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
2290 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
2291 special=${COMP_WORDS[i]}
2293 #exclude some mutually exclusive options
2294 [[ ${COMP_WORDS[i]} == '-u' ]] && dashoptions=${dashoptions/-i}
2295 [[ ${COMP_WORDS[i]} == '-i' ]] && dashoptions=${dashoptions/-u}
2298 if [[ -n "$special" ]]; then
2300 @(install|hold|markauto|unmarkauto|dist-upgrade|full-upgrade|download|show|changelog|why|why-not))
2301 COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) )
2304 @(purge|remove|reinstall|forbid-version))
2305 COMPREPLY=( $( _comp_dpkg_installed_packages $cur ) )
2309 COMPREPLY=( $( _comp_dpkg_hold_packages $cur ) )
2317 # don't complete anything if these options are found
2318 @(autoclean|clean|forget-new|search|upgrade|safe-upgrade|update|keep-all))
2327 -@(t|-target-release|-default-release))
2328 COMPREPLY=( $( apt-cache policy | \
2329 grep "release.o=Debian,a=$cur" | \
2330 sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null ) )
2336 if [[ "$cur" == -* ]]; then
2337 COMPREPLY=( $( compgen -W "$dashoptions" -- $cur ) )
2339 COMPREPLY=( $( compgen -W 'update upgrade safe-upgrade forget-new clean \
2340 autoclean install reinstall remove \
2341 hold unhold purge markauto unmarkauto why why-not \
2342 dist-upgrade full-upgrade download search show \
2343 forbid-version changelog keep-all' -- $cur ) )
2349 complete -F _aptitude $default aptitude
2352 # Debian apt-build(1) completion.
2357 local cur prev special i
2361 prev=${COMP_WORDS[COMP_CWORD-1]}
2363 for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
2364 if [[ ${COMP_WORDS[i]} == @(install|remove|source|info|clean) ]]; then
2365 special=${COMP_WORDS[i]}
2369 if [ -n "$special" ]; then
2371 @(install|source|info))
2372 COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) )
2376 COMPREPLY=( $( _comp_dpkg_installed_packages \
2388 --@(patch|build-dir|repository-dir))
2399 if [[ "$cur" == -* ]]; then
2400 COMPREPLY=( $( compgen -W '--help --show-upgraded -u --build-dir \
2401 --repository-dir --build-only \
2402 --build-command --reinstall --rebuild \
2403 --remove-builddep --no-wrapper --purge \
2404 --patch --patch-strip -p --yes -y \
2405 --version -v --no-source' -- $cur ) )
2408 COMPREPLY=( $( compgen -W 'update upgrade install remove \
2409 source dist-upgrade world clean info \
2410 clean-build update-repository ' -- $cur ) )
2416 complete -F _apt_build $filenames apt-build
2418 # chsh(1) completion
2426 prev=${COMP_WORDS[COMP_CWORD-1]}
2428 if [ "$prev" = "-s" ]; then
2429 if [ -f /etc/debian_version ]; then
2430 COMPREPLY=( $( </etc/shells ) )
2432 COMPREPLY=( $( chsh -l | grep "^$cur" ) )
2435 COMPREPLY=( $( compgen -u -- $cur ) )
2440 complete -F _chsh chsh
2442 # chkconfig(8) completion
2451 prev=${COMP_WORDS[COMP_CWORD-1]}
2454 @([1-6]|--@(list|add|del)))
2459 COMPREPLY=( $( compgen -W '1 2 3 4 5 6' -- $cur ) )
2464 if [[ "$cur" == -* ]]; then
2465 COMPREPLY=( $( compgen -W '--list --add --del --level' -- $cur ) )
2467 if [ $COMP_CWORD -eq 2 -o $COMP_CWORD -eq 4 ]; then
2468 COMPREPLY=( $( compgen -W 'on off reset' -- $cur ) )
2474 complete -F _chkconfig chkconfig
2476 # This function provides simple user@host completion
2484 if [[ $cur == *@* ]]; then
2487 COMPREPLY=( $( compgen -u -- "$cur" ) )
2492 shopt -u hostcomplete && complete -F _user_at_host $nospace talk ytalk finger
2494 # This function performs host completion based on ssh's known_hosts files,
2495 # defaulting to standard host completion if they don't exist.
2499 local cur curd ocur user suffix aliases global_kh user_kh hosts i host
2500 local -a kh khd config
2506 [ "$1" = -a ] || [ "$2" = -a ] && aliases='yes'
2507 [ "$1" = -c ] || [ "$2" = -c ] && suffix=':'
2508 [[ $cur == *@* ]] && user=${cur%@*}@ && cur=${cur#*@}
2512 [ -r /etc/ssh/ssh_config ] &&
2513 config=( "${config[@]}" "/etc/ssh/ssh_config" )
2514 [ -r "${HOME}/.ssh/config" ] &&
2515 config=( "${config[@]}" "${HOME}/.ssh/config" )
2516 [ -r "${HOME}/.ssh2/config" ] &&
2517 config=( "${config[@]}" "${HOME}/.ssh2/config" )
2519 if [ ${#config[@]} -gt 0 ]; then
2520 # expand path (if present) to global known hosts file
2521 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[@]}" ) )
2522 # expand path (if present) to user known hosts file
2523 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[@]}" ) )
2526 # Global known_hosts files
2527 [ -r "$global_kh" ] &&
2528 kh=( "${kh[@]}" "$global_kh" )
2529 [ -r /etc/ssh/ssh_known_hosts ] &&
2530 kh=( "${kh[@]}" /etc/ssh/ssh_known_hosts )
2531 [ -r /etc/ssh/ssh_known_hosts2 ] &&
2532 kh=( "${kh[@]}" /etc/ssh/ssh_known_hosts2 )
2533 [ -r /etc/known_hosts ] &&
2534 kh=( "${kh[@]}" /etc/known_hosts )
2535 [ -r /etc/known_hosts2 ] &&
2536 kh=( "${kh[@]}" /etc/known_hosts2 )
2537 [ -d /etc/ssh2/knownhosts ] &&
2538 khd=( "${khd[@]}" /etc/ssh2/knownhosts/*pub )
2540 # User known_hosts files
2541 [ -r "$user_kh" ] &&
2542 kh=( "${kh[@]}" "$user_kh" )
2543 [ -r ~/.ssh/known_hosts ] &&
2544 kh=( "${kh[@]}" ~/.ssh/known_hosts )
2545 [ -r ~/.ssh/known_hosts2 ] &&
2546 kh=( "${kh[@]}" ~/.ssh/known_hosts2 )
2547 [ -d ~/.ssh2/hostkeys ] &&
2548 khd=( "${khd[@]}" ~/.ssh2/hostkeys/*pub )
2550 # If we have known_hosts files to use
2551 if [ ${#kh[@]} -gt 0 -o ${#khd[@]} -gt 0 ]; then
2552 # Escape slashes and dots in paths for awk
2557 if [[ "$cur" == [0-9]*.* ]]; then
2558 # Digits followed by a dot - just search for that
2560 elif [[ "$cur" == [0-9]* ]]; then
2561 # Digits followed by no dot - search for digits followed
2564 elif [ -z "$cur" ]; then
2565 # A blank - search for a dot or an alpha character
2571 if [ ${#kh[@]} -gt 0 ]; then
2573 # FS needs to look for a comma separated list
2574 COMPREPLY=( $( awk 'BEGIN {FS=","}
2575 /^[^|]/ {for (i=1; i<=2; ++i) { \
2576 gsub(" .*$", "", $i); \
2577 if ($i ~ /'$cur'/) {print $i} \
2578 }}' "${kh[@]}" 2>/dev/null ) )
2580 if [ ${#khd[@]} -gt 0 ]; then
2581 # Needs to look for files called
2582 # .../.ssh2/key_22_<hostname>.pub
2583 # dont fork any processes, because in a cluster environment,
2584 # there can be hundreds of hostkeys
2585 for i in "${khd[@]}" ; do
2586 if [[ "$i" == *key_22_$curd*.pub ]] && [ -r "$i" ] ; then
2587 host=${i/#*key_22_/}
2589 COMPREPLY=( "${COMPREPLY[@]}" $host )
2594 # append any available aliases from config files
2595 if [ ${#config[@]} -gt 0 ] && [ -n "$aliases" ]; then
2596 local host_aliases=$( sed -ne 's/^[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\?['"$'\t '"']\+\([^*?]*\)$/\2/p' "${config[@]}" )
2597 hosts=$( compgen -W "$host_aliases" -- $ocur )
2598 COMPREPLY=( "${COMPREPLY[@]}" $hosts )
2601 # Now add results of normal hostname completion
2602 COMPREPLY=( "${COMPREPLY[@]}" $( compgen -A hostname -- $ocur ) )
2605 for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
2606 COMPREPLY[i]=$user${COMPREPLY[i]}$suffix
2609 # Just do normal hostname completion
2610 COMPREPLY=( $( compgen -A hostname -S "$suffix" -- $cur ) )
2615 complete -F _known_hosts traceroute traceroute6 tracepath tracepath6 \
2616 ping ping6 fping fping6 telnet host nslookup rsh rlogin ftp dig ssh-installkeys mtr
2628 prev=${COMP_WORDS[COMP_CWORD-1]}
2632 COMPREPLY=( $( compgen -W 'blowfish 3des 3des-cbc blowfish-cbc \
2633 arcfour cast128-cbc' -- $cur ) )
2639 COMPREPLY=( $( compgen -u -- $cur ) )
2644 [ $COMP_CWORD -eq 1 ] || \
2645 COMPREPLY=( "${COMPREPLY[@]}" $( compgen -c -- $cur ) )
2650 shopt -u hostcomplete && complete -F _ssh ssh slogin sftp xhost autossh
2656 local cur userhost path
2663 if [[ "$cur" == *:* ]]; then
2665 # remove backslash escape from :
2667 userhost=${cur%%?(\\):*}
2670 path=${path//\\\\\\\\ / }
2671 if [ -z "$path" ]; then
2672 # default to home dir of specified user on remote host
2673 path=$(ssh -o 'Batchmode yes' $userhost pwd 2>/dev/null)
2675 # escape spaces; remove executables, aliases, pipes and sockets;
2676 # add space at end of file names
2677 COMPREPLY=( $( ssh -o 'Batchmode yes' $userhost \
2678 command ls -aF1d "$path*" 2>/dev/null | \
2679 sed -e "s/[][(){}<>\",:;^&!$&=?\`|\\ ']/\\\\\\\\\\\\&/g" \
2680 -e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' ) )
2684 [[ "$cur" == */* ]] || _known_hosts -c -a
2686 COMPREPLY=( "${COMPREPLY[@]}" $( command ls -aF1d $cur* \
2688 -e "s/[][(){}<>\",:;^&!$&=?\`|\\ ']/\\\\&/g" \
2689 -e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' ) )
2692 complete -F _scp $nospace scp
2695 # rsync(1) completion
2700 local cur prev shell i userhost path
2704 prev=${COMP_WORDS[COMP_CWORD-1]}
2709 --@(config|password-file|include-from|exclude-from))
2713 -@(T|-temp-dir|-compare-dest))
2718 COMPREPLY=( $( compgen -W 'rsh ssh' -- $cur ) )
2725 COMPREPLY=( $( compgen -W '-v -q -c -a -r -R -b -u -l -L -H \
2726 -p -o -g -D -t -S -n -W -x -B -e -C -I -T -P \
2727 -z -h -4 -6 --verbose --quiet --checksum \
2728 --archive --recursive --relative --backup \
2729 --backup-dir --suffix= --update --links \
2730 --copy-links --copy-unsafe-links --safe-links \
2731 --hard-links --perms --owner --group --devices\
2732 --times --sparse --dry-run --whole-file \
2733 --no-whole-file --one-file-system \
2734 --block-size= --rsh= --rsync-path= \
2735 --cvs-exclude --existing --ignore-existing \
2736 --delete --delete-excluded --delete-after \
2737 --ignore-errors --max-delete= --partial \
2738 --force --numeric-ids --timeout= \
2739 --ignore-times --size-only --modify-window= \
2740 --temp-dir= --compare-dest= --compress \
2741 --exclude= --exclude-from= --include= \
2742 --include-from= --version --daemon --no-detach\
2743 --address= --config= --port= --blocking-io \
2744 --no-blocking-io --stats --progress \
2745 --log-format= --password-file= --bwlimit= \
2746 --write-batch= --read-batch= --help' -- $cur ))
2749 # find which remote shell is used
2751 for (( i=1; i < COMP_CWORD; i++ )); do
2752 if [[ "${COMP_WORDS[i]}" == -@(e|-rsh) ]]; then
2753 shell=${COMP_WORDS[i+1]}
2757 if [[ "$shell" == ssh ]]; then
2758 # remove backslash escape from :
2760 userhost=${cur%%?(\\):*}
2763 path=${path//\\\\\\\\ / }
2764 if [ -z "$path" ]; then
2765 # default to home dir of specified
2766 # user on remote host
2767 path=$(ssh -o 'Batchmode yes' \
2768 $userhost pwd 2>/dev/null)
2770 # escape spaces; remove executables, aliases, pipes
2771 # and sockets; add space at end of file names
2772 COMPREPLY=( $( ssh -o 'Batchmode yes' $userhost \
2773 command ls -aF1d "$path*" 2>/dev/null | \
2774 sed -e 's/ /\\\\\\\ /g' -e 's/[*@|=]$//g' \
2775 -e 's/[^\/]$/& /g' ) )
2786 complete -F _rsync $nospace $filenames rsync
2788 # Linux route(8) completion
2790 [ $UNAME = Linux ] &&
2797 prev=${COMP_WORDS[COMP_CWORD-1]}
2799 if [ "$prev" = dev ]; then
2800 COMPREPLY=( $( ifconfig -a | sed -ne 's|^\('$cur'[^ ]*\).*$|\1|p' ))
2804 COMPREPLY=( $( compgen -W 'add del -host -net netmask metric mss \
2805 window irtt reject mod dyn reinstate dev \
2806 default gw' -- $cur ) )
2808 COMPREPLY=( $( echo " ${COMP_WORDS[@]}" | \
2809 (while read -d ' ' i; do
2810 [ "$i" == "" ] && continue
2811 # flatten array with spaces on either side,
2812 # otherwise we cannot grep on word
2813 # boundaries of first and last word
2814 COMPREPLY=" ${COMPREPLY[@]} "
2815 # remove word from list of completions
2816 COMPREPLY=( ${COMPREPLY/ $i / } )
2818 echo "${COMPREPLY[@]}")
2822 [ $UNAME = Linux ] && complete -F _route route
2824 # GNU make(1) completion
2826 have make || have gmake || have gnumake || have pmake &&
2829 local file makef makef_dir="." makef_inc cur prev i
2833 prev=${COMP_WORDS[COMP_CWORD-1]}
2835 # --name value style option
2847 # --name=value style option
2848 if [[ "$cur" == *=* ]]; then
2856 --@(directory|include-dir))
2863 if [[ "$cur" == -* ]]; then
2864 COMPREPLY=( $( compgen -W '-b -m -B -C -d -e -f -h -i -I\
2865 -j -l -k -n -o -p -q -r -R - s -S -t -v -w -W \
2866 --always-make --directory= --debug \
2867 --environment-overrides --file= --makefile= --help \
2868 --ignore-errors --include-dir= --jobs --load-average \
2869 --max-load --keep-going --just-print --dry-run \
2870 --recon --old-file= --assume-old= --print-data-base \
2871 --question --no-builtin-rules --no-builtin-variables \
2872 --silent --quiet --no-keep-goind --stop --touch \
2873 --version --print-directory --no-print-directory \
2874 --what-if= --new-file= --assume-new= \
2875 --warn-undefined-variables' -- $cur ) )
2877 # before we check for makefiles, see if a path was specified
2879 for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do
2880 if [[ ${COMP_WORDS[i]} == -C ]]; then
2881 # eval for tilde expansion
2882 eval makef_dir=${COMP_WORDS[i+1]}
2887 # make reads `GNUmakefile', then `makefile', then `Makefile'
2888 if [ -f ${makef_dir}/GNUmakefile ]; then
2889 makef=${makef_dir}/GNUmakefile
2890 elif [ -f ${makef_dir}/makefile ]; then
2891 makef=${makef_dir}/makefile
2892 elif [ -f ${makef_dir}/Makefile ]; then
2893 makef=${makef_dir}/Makefile
2895 makef=${makef_dir}/*.mk # local convention
2898 # before we scan for targets, see if a Makefile name was
2900 for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do
2901 if [[ ${COMP_WORDS[i]} == -f ]]; then
2902 # eval for tilde expansion
2903 eval makef=${COMP_WORDS[i+1]}
2908 [ ! -f $makef ] && return 0
2910 # deal with included Makefiles
2911 makef_inc=$( grep -E '^-?include' $makef | sed -e "s,^.* ,"$makef_dir"/," )
2913 for file in $makef_inc; do
2914 [ -f $file ] && makef="$makef $file"
2917 COMPREPLY=( $( awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ \
2918 {split($1,A,/ /);for(i in A)print A[i]}' \
2919 $makef 2>/dev/null | command grep "^$cur" ))
2922 complete -f -F _make $filenames make gmake gnumake pmake
2924 # GNU tar(1) completion
2928 local cur ext regex tar untar
2933 if [ $COMP_CWORD -eq 1 ]; then
2934 COMPREPLY=( $( compgen -W 'c t x u r d A' -- $cur ) )
2938 case "${COMP_WORDS[1]}" in
2944 ext='t@(ar?(.@(Z|gz|bz?(2)))|gz|bz?(2))'
2945 regex='t\(ar\(\.\(Z\|gz\|bz2\?\)\)\?\|gz\|bz2\?\)'
2948 ext='t?(ar.)@(gz|Z)'
2949 regex='t\(ar\.\)\?\(gz\|Z\)'
2953 regex='t\(ar\.\)\?bz2\?'
2962 if [[ "$COMP_LINE" == *$ext' ' ]]; then
2963 # complete on files in tar file
2965 # get name of tar file from command line
2966 tar=$( echo "$COMP_LINE" | \
2967 sed -e 's/^.* \([^ ]*'$regex'\) .*$/\1/' )
2968 # devise how to untar and list it
2969 untar=t${COMP_WORDS[1]//[^Izjyf]/}
2971 COMPREPLY=( $( compgen -W "$( echo $( tar $untar $tar \
2972 2>/dev/null ) )" -- "$cur" ) )
2976 # file completion on relevant files
2981 [ -n "${COMP_TAR_INTERNAL_PATHS:-}" ] && complete -F _tar $dirnames tar ||
2982 complete -F _tar $filenames tar
2994 if [ $COMP_CWORD = 1 ]; then
2995 COMPREPLY=( $( compgen -W 'c t x u' -- $cur ) )
2999 case "${COMP_WORDS[1]}" in
3004 _filedir '?(e|j|w)ar'
3011 complete -F _jar $filenames jar
3013 # Linux iptables(8) completion
3018 local cur prev table chain
3022 prev=${COMP_WORDS[COMP_CWORD-1]}
3023 chain='s/^Chain \([^ ]\+\).*$/\1/p'
3025 if [[ $COMP_LINE == *-t\ *filter* ]]; then
3027 elif [[ $COMP_LINE == *-t\ *nat* ]]; then
3029 elif [[ $COMP_LINE == *-t\ *mangle* ]]; then
3035 COMPREPLY=( $( compgen -W '`iptables $table -nL | \
3036 sed -ne "s/^Chain \([^ ]\+\).*$/\1/p"`' -- $cur ) )
3039 COMPREPLY=( $( compgen -W 'nat filter mangle' -- $cur ) )
3042 if [ "$table" = "-t filter" -o "$table" = "" ]; then
3043 COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \
3044 `iptables $table -nL | sed -ne "$chain" \
3045 -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \
3047 elif [ "$table" = "-t nat" ]; then
3048 COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \
3049 MIRROR SNAT DNAT MASQUERADE `iptables $table -nL | \
3050 sed -ne "$chain" -e "s/OUTPUT|PREROUTING|POSTROUTING//"`' \
3052 elif [ "$table" = "-t mangle" ]; then
3053 COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \
3054 MARK TOS `iptables $table -nL | sed -ne "$chain" \
3055 -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \
3060 if [[ "$cur" == -* ]]; then
3061 COMPREPLY=( $( compgen -W '-i -o -s -d -p -f -m --append \
3062 --delete --insert --replace --list --flush --zero --new \
3063 --delete-chain --policy --rename-chain --proto --source \
3064 --destination --in-interface --jump --match --numeric \
3065 --out-interface --table --verbose --line-numbers --exact \
3066 --fragment --modprobe= --set-counters --version' -- "$cur") )
3072 complete -F _iptables iptables
3074 # tcpdump(8) completion
3083 prev=${COMP_WORDS[COMP_CWORD-1]}
3091 _available_interfaces -a
3097 if [[ "$cur" == -* ]]; then
3098 COMPREPLY=( $( compgen -W '-a -d -e -f -l -n -N -O -p \
3099 -q -R -S -t -u -v -x -C -F -i -m -r -s -T -w \
3104 complete -F _tcpdump tcpdump
3106 # autorpm(8) completion
3116 COMPREPLY=( $( compgen -W '--notty --debug --help --version \
3117 auto add fullinfo info help install list \
3118 remove set' -- $cur ) )
3121 complete -F _autorpm autorpm
3123 # This meta-cd function observes the CDPATH variable, so that cd additionally
3124 # completes on directories under those specified in CDPATH.
3128 local IFS=$'\t\n' cur=`_get_cword` i j k
3130 # try to allow variable completion
3131 if [[ "$cur" == ?(\\)\$* ]]; then
3132 COMPREPLY=( $( compgen -v -P '$' -- "${cur#?(\\)$}" ) )
3136 # Use standard dir completion if no CDPATH or parameter starts with /,
3138 if [ -z "${CDPATH:-}" ] || [[ "$cur" == ?(.)?(.)/* ]]; then
3143 local -r mark_dirs=$(_rl_enabled mark-directories && echo y)
3144 local -r mark_symdirs=$(_rl_enabled mark-symlinked-directories && echo y)
3146 # we have a CDPATH, so loop on its contents
3147 for i in ${CDPATH//:/$'\t'}; do
3148 # create an array of matched subdirs
3149 k="${#COMPREPLY[@]}"
3150 for j in $( compgen -d $i/$cur ); do
3151 if [[ ( $mark_symdirs && -h $j || $mark_dirs && ! -h $j ) && ! -d ${j#$i/} ]]; then
3154 COMPREPLY[k++]=${j#$i/}
3160 if [[ ${#COMPREPLY[@]} -eq 1 ]]; then
3162 if [ "$i" == "$cur" ] && [[ $i != "*/" ]]; then
3163 COMPREPLY[0]="${i}/"
3169 if shopt -q cdable_vars; then
3170 complete -v -F _cd $nospace $filenames cd
3172 complete -F _cd $nospace $filenames cd
3177 if [[ COMP_CWORD -eq 0 ]]; then
3179 elif [[ ${#COMP_WORDS[@]} -ge 2 ]]; then
3180 local old_cw0="${COMP_WORDS[0]}"
3181 local new_cw0="${COMP_WORDS[1]}"
3182 local old_length="${#COMP_LINE}"
3183 COMP_LINE=${COMP_LINE#${old_cw0}}
3184 local head=${COMP_LINE:0:${#new_cw0}}
3186 while [[ $head != $new_cw0 ]]; do
3187 COMP_LINE=${COMP_LINE:1}
3188 head=${COMP_LINE:0:${#new_cw0}}
3189 if (( ++i > 10 )); then
3193 local new_length="${#COMP_LINE}"
3194 COMP_POINT=$(( COMP_POINT + new_length - old_length))
3196 COMP_CWORD=$(( COMP_CWORD - 1 ))
3197 for (( i=0; i < ${#COMP_WORDS[@]} - 1; ++i )); do
3198 COMP_WORDS[i]="${COMP_WORDS[i+1]}"
3200 unset COMP_WORDS[${#COMP_WORDS[@]}-1]
3206 # A meta-command completion function for commands like sudo(8), which need to
3207 # first complete on a command, then complete according to that command's own
3208 # completion definition - currently not quite foolproof (e.g. mount and umount
3209 # don't work properly), but still quite useful.
3213 local cur func cline cspec noglob cmd done i \
3214 _COMMAND_FUNC _COMMAND_FUNC_ARGS
3219 # If the the first arguments following our meta-command-invoker are
3220 # switches, get rid of them. Most definitely not foolproof.
3222 while [ -z $done ] ; do
3223 cmd=${COMP_WORDS[0]}
3224 if [[ "$cmd" == -* ]] && [ $COMP_CWORD -ge 1 ]; then
3226 elif [[ "$cmd" == -* ]] && [[ $COMP_CWORD -eq 0 ]]; then
3233 if [ $COMP_CWORD -eq 0 ]; then
3234 COMPREPLY=( $( compgen -c -- $cur ) )
3235 elif complete -p $cmd &>/dev/null; then
3236 cspec=$( complete -p $cmd )
3237 if [ "${cspec#* -F }" != "$cspec" ]; then
3238 # COMP_CWORD and COMP_WORDS() are not read-only,
3239 # so we can set them before handing off to regular
3240 # completion routine
3246 if [[ ${#COMP_WORDS[@]} -ge 2 ]]; then
3247 $func $cmd "${COMP_WORDS[${#COMP_WORDS[@]}-1]}" "${COMP_WORDS[${#COMP_WORDS[@]}-2]}"
3249 $func $cmd "${COMP_WORDS[${#COMP_WORDS[@]}-1]}"
3252 # remove any \: generated by a command that doesn't
3253 # default to filenames or dirnames (e.g. sudo chown)
3254 # FIXME: I'm pretty sure this does not work!
3255 if [ "${cspec#*-o }" != "$cspec" ]; then
3258 if [[ "$cspec" != @(dir|file)names ]]; then
3259 COMPREPLY=("${COMPREPLY[@]//\\\\:/:}")
3262 elif [ -n "$cspec" ]; then
3263 cspec=${cspec#complete};
3264 cspec=${cspec%%$cmd};
3265 COMPREPLY=( $( eval compgen "$cspec" -- "$cur" ) );
3269 [ ${#COMPREPLY[@]} -eq 0 ] && _filedir
3271 complete -F _command $filenames nohup exec nice eval strace time ltrace then \
3272 else do vsound command xargs
3276 PATH=/usr/gnu/bin:$PATH:/sbin:/usr/sbin _command $1 $2 $3
3278 complete -F _root_command $filenames sudo fakeroot really
3285 local cur prev buildfile i
3289 prev=${COMP_WORDS[COMP_CWORD-1]}
3302 if [[ "$cur" == -* ]]; then
3303 # relevant options completion
3304 COMPREPLY=( $( compgen -W '-help -projecthelp -version -quiet \
3305 -verbose -debug -emacs -logfile -logger \
3306 -listener -buildfile -f -D -find' -- $cur ) )
3308 # available targets completion
3309 # find which buildfile to use
3311 for (( i=1; i < COMP_CWORD; i++ )); do
3312 if [[ "${COMP_WORDS[i]}" == -buildfile ]]; then
3313 buildfile=${COMP_WORDS[i+1]}
3317 [ ! -f $buildfile ] && return 0
3319 # parse buildfile for targets
3320 COMPREPLY=( $( awk -F'"' '/<target name="/ {print $2}' \
3321 $buildfile | grep "^$cur" )
3322 $( awk -F"'" "/<target name='/ "'{print $2}' \
3323 $buildfile | grep "^$cur" )
3324 $( awk -F'"' '/<target [^n]/ {if ($1 ~ /name=/) { print $2 } else if ($3 ~ /name=/) {print $4} else if ($5 ~ /name=/) {print $6}}' \
3325 $buildfile | grep "^$cur" ) )
3328 have complete-ant-cmd.pl && \
3329 complete -C complete-ant-cmd.pl -F _ant $filenames ant || \
3330 complete -F _ant $filenames ant
3339 cur=${COMP_WORDS[COMP_CWORD]#-}
3341 COMPREPLY=( $( compgen -P '-' -W 'all class= debug d2 domain= \
3342 srchlist= defname search port= querytype= \
3343 type= recurse retry root timeout vc \
3344 ignoretc' -- $cur ) )
3346 complete -F _nslookup nslookup
3348 # mysqladmin(1) completion
3357 prev=${COMP_WORDS[COMP_CWORD-1]}
3361 COMPREPLY=( $( compgen -u -- $cur ) )
3368 COMPREPLY=( $( compgen -W '-# -f -? -C -h -p -P -i -r -E -s -S -t -u \
3369 -v -V -w' -- $cur ) )
3371 COMPREPLY=( "${COMPREPLY[@]}" \
3372 $( compgen -W 'create drop extended-status flush-hosts \
3373 flush-logs flush-status flush-tables \
3374 flush-threads flush-privileges kill \
3375 password ping processlist reload refresh \
3376 shutdown status variables version' \
3379 complete -F _mysqladmin mysqladmin
3381 # gzip(1) completion
3386 local cur prev xspec IFS=$'\t\n'
3390 prev=${COMP_WORDS[COMP_CWORD-1]}
3392 if [[ "$cur" == -* ]]; then
3393 COMPREPLY=( $( compgen -W '-c -d -f \
3394 -h -l -L -n -N -q -r -S -t -v -V \
3395 -1 -2 -3 -4 -5 -6 -7 -8 -9 \
3396 --stdout --decompress --force --help --list \
3397 --license --no-name --name --quiet --recursive \
3398 --suffix --test --verbose --version --fast \
3404 if [[ "$prev" == --* ]]; then
3405 [[ "$prev" == --decompress || \
3406 "$prev" == --list || \
3407 "$prev" == --test ]] && xspec="!"$xspec
3408 [[ "$prev" == --force ]] && xspec=
3409 elif [[ "$prev" == -* ]]; then
3410 [[ "$prev" == -*[dlt]* ]] && xspec="!"$xspec
3411 [[ "$prev" == -*f* ]] && xspec=
3412 elif [ "$prev" = '>' ]; then
3414 elif [ "$prev" = '<' ]; then
3420 COMPREPLY=( $( compgen -f -X "$xspec" -- $cur ) \
3421 $( compgen -d -- $cur ) )
3423 complete -F _gzip $filenames gzip
3425 # bzip2(1) completion
3430 local cur prev xspec IFS=$'\t\n'
3434 prev=${COMP_WORDS[COMP_CWORD-1]}
3436 if [[ "$cur" == -* ]]; then
3437 COMPREPLY=( $( compgen -W '-c -d -f -h -k -L -q -s \
3438 -t -v -V -z -1 -2 -3 -4 -5 -6 -7 -8 -9 \
3439 --help --decompress --compress --keep --force \
3440 --test --stdout --quiet --verbose --license \
3441 --version --small --fast --best' -- $cur ) )
3446 if [[ "$prev" == --* ]]; then
3447 [[ "$prev" == --decompress || \
3448 "$prev" == --list || \
3449 "$prev" == --test ]] && xspec="!"$xspec
3450 [[ "$prev" == --compress ]] && xspec=
3451 elif [[ "$prev" == -* ]]; then
3452 [[ "$prev" == -*[dt]* ]] && xspec="!"$xspec
3453 [[ "$prev" == -*z* ]] && xspec=
3458 COMPREPLY=( $( compgen -f -X "$xspec" -- $cur ) \
3459 $( compgen -d -- $cur ) )
3461 complete -F _bzip2 $filenames bzip2
3463 # openssl(1) completion
3470 config=/etc/ssl/openssl.cnf
3471 [ ! -f $config ] && config=/usr/share/ssl/openssl.cnf
3472 for (( i=2; i < COMP_CWORD; i++ )); do
3473 if [[ "${COMP_WORDS[i]}" == -config ]]; then
3474 config=${COMP_WORDS[i+1]}
3478 [ ! -f $config ] && return 0
3480 COMPREPLY=( $( awk '/\[.*\]/ {print $2} ' $config | grep "^$cur" ) )
3490 if [ $COMP_CWORD -eq 1 ]; then
3491 COMPREPLY=( $( compgen -W 'asn1parse ca ciphers crl crl2pkcs7 \
3492 dgst dh dhparam dsa dsaparam enc errstr gendh gendsa \
3493 genrsa nseq passwd pkcs12 pkcs7 pkcs8 rand req rsa \
3494 rsautl s_client s_server s_time sess_id smime speed \
3495 spkac verify version x509 md2 md4 md5 mdc2 rmd160 sha \
3496 sha1 base64 bf bf-cbc bf-cfb bf-ecb bf-ofb cast \
3497 cast-cbc cast5-cbc cast5-cfb cast5-ecb cast5-ofb des \
3498 des-cbc des-cfb des-ecb des-ede des-ede-cbc \
3499 des-ede-cfb des-ede-ofb des-ede3 des-ede3-cbc \
3500 des-ede3-cfb des-ede3-ofb des-ofb des3 desx rc2 \
3501 rc2-40-cbc rc2-64-cbc rc2-cbc rc2-cfb rc2-ecb rc2-ofb \
3502 rc4 rc4-40' -- $cur ) )
3504 prev=${COMP_WORDS[COMP_CWORD-1]}
3505 case ${COMP_WORDS[1]} in
3509 COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
3518 if [[ "$cur" == -* ]]; then
3519 COMPREPLY=( $( compgen -W '-inform -in -out -noout -offset \
3520 -length -i -oid -strparse' -- $cur ) )
3525 -@(config|revoke|cert|in|out|spkac|ss_cert))
3533 -@(name|crlexts|extensions))
3539 if [[ "$cur" == -* ]]; then
3540 COMPREPLY=( $( compgen -W '-verbose -config -name \
3541 -gencrl -revoke -crldays -crlhours -crlexts \
3542 -startdate -enddate -days -md -policy -keyfile \
3543 -key -passin -cert -in -out -notext -outdir \
3544 -infiles -spkac -ss_cert -preserveDN -batch \
3545 -msie_hack -extensions' -- $cur ) )
3549 if [[ "$cur" == -* ]]; then
3550 COMPREPLY=( $( compgen -W '-v -ssl2 -ssl3 -tls1' -- $cur ) )
3556 COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
3569 if [[ "$cur" == -* ]]; then
3570 COMPREPLY=( $( compgen -W '-inform -outform -text -in -out -noout \
3571 -hash -issuer -lastupdate -nextupdate -CAfile -CApath' -- $cur ) )
3577 COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
3586 if [[ "$cur" == -* ]]; then
3587 COMPREPLY=( $( compgen -W '-inform -outform -in -out -print_certs' -- $cur ) )
3592 -@(out|sign|verify|prvrify|signature))
3598 if [[ "$cur" == -* ]]; then
3599 COMPREPLY=( $( compgen -W '-md5 -md4 -md2 -sha1 -sha -mdc2 -ripemd160 -dss1 \
3600 -c -d -hex -binary -out -sign -verify -prverify -signature' -- $cur ) )
3608 COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
3617 if [[ "$cur" == -* ]]; then
3618 COMPREPLY=( $( compgen -W '-inform -outform -in -passin -out -passout -des -des3 -idea -text -noout \
3619 -modulus -pubin -pubout' -- $cur ) )
3625 COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
3634 if [[ "$cur" == -* ]]; then
3635 COMPREPLY=( $( compgen -W '-inform -outform -in -out -noout \
3636 -text -C -rand -genkey' -- $cur ) )
3647 if [[ "$cur" == -* ]]; then
3648 COMPREPLY=( $( compgen -W '-ciphername -in -out -pass \
3649 -e -d -a -A -k -kfile -S -K -iv -p -P -bufsize -debug' -- $cur ) )
3655 COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
3664 if [[ "$cur" == -* ]]; then
3665 COMPREPLY=( $( compgen -W '-inform -outform -in -out -dsaparam -noout \
3666 -text -C -2 -5 -rand' -- $cur ) )
3677 if [[ "$cur" == -* ]]; then
3678 COMPREPLY=( $( compgen -W '-out -des -des3 -idea -rand' -- $cur ) )
3691 if [[ "$cur" == -* ]]; then
3692 COMPREPLY=( $( compgen -W '-out -passout -des -des3 -idea -f4 -3 -rand' -- $cur ) )
3698 COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
3707 if [[ "$cur" == -* ]]; then
3708 COMPREPLY=( $( compgen -W '-inform -outform -in -out -print_certs -text -noout' -- $cur ) )
3719 if [[ "$cur" == -* ]]; then
3720 COMPREPLY=( $( compgen -W '-out -rand -base64' -- $cur ) )
3726 COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
3730 -@(in|out|rand|key|keyout|config))
3740 if [[ "$cur" == -* ]]; then
3741 COMPREPLY=( $( compgen -W '-inform -outform -in \
3742 -passin -out -passout -text -noout -verify \
3743 -modulus -new -rand -newkey -newkey -nodes \
3744 -key -keyform -keyout -md5 -sha1 -md2 -mdc2 \
3745 -config -x509 -days -asn1-kludge -newhdr \
3746 -extensions -reqexts section' -- $cur ) )
3752 COMPREPLY=( $( compgen -W 'DER NET PEM' -- $cur ) )
3761 if [[ "$cur" == -* ]]; then
3762 COMPREPLY=( $( compgen -W '-inform -outform -in -passin -out -passout \
3763 -sgckey -des -des3 -idea -text -noout -modulus -check -pubin \
3764 -pubout -engine' -- $cur ) )
3775 if [[ "$cur" == -* ]]; then
3776 COMPREPLY=( $( compgen -W '-in -out -inkey -pubin -certin -sign -verify \
3777 -encrypt -decrypt -pkcs -ssl -raw -hexdump -asn1parse' -- $cur ) )
3786 -@(cert|key|CAfile|rand))
3796 if [[ "$cur" == -* ]]; then
3797 COMPREPLY=( $( compgen -W '-connect -verify -cert -key -CApath -CAfile \
3798 -reconnect -pause -showcerts -debug -msg -nbio_test -state -nbio \
3799 -crlf -ign_eof -quiet -ssl2 -ssl3 -tls1 -no_ssl2 -no_ssl3 -no_tls1 \
3800 -bugs -cipher -starttls -engine -rand' -- $cur ) )
3805 -@(cert|key|dcert|dkey|dhparam|CAfile|rand))
3815 if [[ "$cur" == -* ]]; then
3816 COMPREPLY=( $( compgen -W '-accept -context -verify -Verify -cert -key \
3817 -dcert -dkey -dhparam -nbio -nbio_test -crlf -debug -msg -state -CApath \
3818 -CAfile -nocert -cipher -quiet -no_tmp_rsa -ssl2 -ssl3 -tls1 -no_ssl2 \
3819 -no_ssl3 -no_tls1 -no_dhe -bugs -hack -www -WWW -HTTP -engine -id_prefix \
3829 -@(cert|key|CAfile))
3839 if [[ "$cur" == -* ]]; then
3840 COMPREPLY=( $( compgen -W '-connect -www -cert -key -CApath -CAfile -reuse \
3841 -new -verify -nbio -time -ssl2 -ssl3 -bugs -cipher' -- $cur ) )
3848 COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
3858 if [[ "$cur" == -* ]]; then
3859 COMPREPLY=( $( compgen -W '-inform -outform -in -out -text -noout \
3860 -context ID' -- $cur ) )
3866 COMPREPLY=( $( compgen -W 'SMIME DER PEM' -- $cur ) )
3869 -@(in|out|certfile|signer|recip|inkey|content|rand))
3875 if [[ "$cur" == -* ]]; then
3876 COMPREPLY=( $( compgen -W '-encrypt -decrypt -sign -verify -pk7out -des -des3 \
3877 -rc2-40 -rc2-64 -rc2-128 -aes128 -aes192 -aes256 -in -certfile -signer \
3878 -recip -inform -passin -inkey -out -outform -content -to -from -subject \
3879 -text -rand' -- $cur ) )
3885 if [[ "$cur" == -* ]]; then
3886 COMPREPLY=( $( compgen -W '-engine' -- $cur ) )
3888 COMPREPLY=( $( compgen -W 'md2 mdc2 md5 hmac sha1 rmd160 idea-cbc \
3889 rc2-cbc rc5-cbc bf-cbc des-cbc des-ede3 rc4 rsa512 rsa1024 rsa2048 \
3890 rsa4096 dsa512 dsa1024 dsa2048 idea rc2 des rsa blowfish' -- $cur ) )
3895 -@(CAfile|untrusted))
3905 if [[ "$cur" == -* ]]; then
3906 COMPREPLY=( $( compgen -W '-CApath -CAfile -purpose -untrusted -help -issuer_checks \
3907 -verbose -certificates' -- $cur ) )
3914 -@(in|out|CA|CAkey|CAserial|extfile))
3919 COMPREPLY=( $( compgen -W 'DER PEM NET' -- $cur ) )
3922 -@(key|CA|CAkey)form)
3923 COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
3932 if [[ "$cur" == -* ]]; then
3933 COMPREPLY=( $( compgen -W '-inform -outform \
3934 -keyform -CAform -CAkeyform -in -out \
3935 -serial -hash -subject -issuer -nameopt \
3936 -email -startdate -enddate -purpose \
3937 -dates -modulus -fingerprint -alias \
3938 -noout -trustout -clrtrust -clrreject \
3939 -addtrust -addreject -setalias -days \
3940 -set_serial -signkey -x509toreq -req \
3941 -CA -CAkey -CAcreateserial -CAserial \
3942 -text -C -md2 -md5 -sha1 -mdc2 -clrext \
3943 -extfile -extensions -engine' -- $cur ) )
3946 @(md5|md4|md2|sha1|sha|mdc2|ripemd160))
3947 if [[ "$cur" == -* ]]; then
3948 COMPREPLY=( $( compgen -W '-c -d' -- $cur ) )
3958 complete -F _openssl $default openssl
3961 # screen(1) completion
3966 local cur prev preprev
3970 prev=${COMP_WORDS[COMP_CWORD-1]}
3972 [ "$COMP_CWORD" -ge 2 ] && preprev=${COMP_WORDS[COMP_CWORD-2]}
3974 if [ "$preprev" = "-d" -o "$preprev" = "-D" -a "$prev" = "-r" -o \
3975 "$prev" = "-R" ]; then
3977 COMPREPLY=( $( command screen -ls | \
3978 sed -ne 's|^['$'\t'']\+\('$cur'[0-9]\+\.[^'$'\t'']\+\).*$|\1|p' ) )
3983 COMPREPLY=( $( command screen -ls | \
3984 sed -ne 's|^['$'\t'']\+\('$cur'[0-9]\+\.[^'$'\t'']\+\).*Detached.*$|\1|p' ) )
3988 COMPREPLY=( $( command screen -ls | \
3989 sed -ne 's|^['$'\t'']\+\('$cur'[0-9]\+\.[^'$'\t'']\+\).*Attached.*$|\1|p' ) )
3993 COMPREPLY=( $( grep ^${cur:-[^#]} /etc/shells ) )
4002 complete -F _screen $default screen
4004 # lftp(1) bookmark completion
4014 if [ $COMP_CWORD -eq 1 ] && [ -f ~/.lftp/bookmarks ]; then
4015 COMPREPLY=( $( compgen -W '$( sed -ne "s/^\(.*\)'$'\t''.*$/\1/p" \
4016 ~/.lftp/bookmarks )' -- $cur ) )
4021 complete -F _lftp $default lftp
4023 # ncftp(1) bookmark completion
4033 if [ $COMP_CWORD -eq 1 ] && [ -f ~/.ncftp/bookmarks ]; then
4034 COMPREPLY=( $( compgen -W '$( sed -ne "s/^\([^,]\{1,\}\),.*$/\1/p" \
4035 ~/.ncftp/bookmarks )' -- $cur ) )
4040 complete -F _ncftp $default ncftp
4051 prev=${COMP_WORDS[COMP_CWORD-1]}
4053 if [ $COMP_CWORD -eq 1 ]; then
4054 COMPREPLY=( $( compgen -c -- $cur ) )
4055 elif [ $COMP_CWORD -eq 2 ]; then
4057 COMPREPLY=( $( compgen -fW "$( command ps axo comm,pid | \
4058 awk '{if ($1 ~ /^'"$prev"'/) print $2}' ) )" \
4062 complete -F _gdb $filenames gdb
4064 # Postgresql completion
4070 COMPREPLY=( $( psql -l 2>/dev/null | \
4071 sed -e '1,/^-/d' -e '/^(/,$d' | \
4072 awk '{print $1}' | grep "^$cur" ) )
4077 #COMPREPLY=( $( psql -qtc 'select usename from pg_user' template1 2>/dev/null | \
4079 #[ ${#COMPREPLY[@]} -eq 0 ] &&
4080 COMPREPLY=( $( compgen -u -- $cur ) )
4083 # createdb(1) completion
4091 prev=${COMP_WORDS[COMP_CWORD-1]}
4104 if [[ "$cur" == -* ]]; then
4105 COMPREPLY=( $( compgen -W '-D -T -E -h -p -U -W -e -q \
4106 --location= --template= --encoding= --host= --port= \
4107 --username= --password --echo --quiet --help' -- $cur ))
4112 complete -F _createdb $default createdb
4114 # dropdb(1) completion
4122 prev=${COMP_WORDS[COMP_CWORD-1]}
4135 if [[ "$cur" == -* ]]; then
4136 COMPREPLY=( $( compgen -W '-h -p -U -W -e -q \
4137 --host= --port= --username= --password \
4138 --interactive --echo --quiet --help' -- $cur ) )
4143 complete -F _dropdb $default dropdb
4145 # psql(1) completion
4153 prev=${COMP_WORDS[COMP_CWORD-1]}
4168 -@(o|f)|--output|--file)
4174 if [[ "$cur" == -* ]]; then
4175 # return list of available options
4176 COMPREPLY=( $( compgen -W '-a --echo-all -A --no-align \
4177 -c --command -d --dbname -e --echo-queries \
4178 -E --echo-hidden -f --file -F --filed-separator \
4179 -h --host -H --html -l --list -n -o --output \
4180 -p --port -P --pset -q -R --record-separator \
4181 -s --single-step -S --single-line -t --tuples-only \
4182 -T --table-attr -U --username -v --variable \
4183 -V --version -W --password -x --expanded -X --nopsqlrc \
4184 -? --help ' -- $cur ) )
4186 # return list of available databases
4190 complete -F _psql $default psql
4199 if [[ "$cur" == --*=* ]]; then
4201 # cut backslash that gets inserted before '=' sign
4205 COMPREPLY=( $( compgen -P "$opt=" -W '${COMPREPLY[@]}' -- $cur))
4209 if [[ "$cur" == -* ]]; then
4210 COMPREPLY=( $( $1 --help 2>&1 | sed -e '/--/!d' \
4211 -e 's/.*\(--[-A-Za-z0-9]\+=\?\).*/\1/' | \
4212 command grep "^$cur" | sort -u ) )
4213 elif [[ "$1" == @(mk|rm)dir ]]; then
4219 # makeinfo and texi2dvi are defined elsewhere.
4220 for i in a2ps autoconf automake bc gprof ld nm objcopy objdump readelf strip \
4221 bison cpio diff patch enscript cp df dir du ln ls mkfifo mknod mv rm \
4222 touch vdir awk gperf grep grub indent less m4 sed shar date \
4223 tee who texindex cat csplit cut expand fmt fold head \
4224 md5sum nl od paste pr ptx sha1sum sort split tac tail tr unexpand \
4225 uniq wc ldd bash id irb mkdir rmdir; do
4226 have $i && complete -F _longopt $filenames $i
4229 # These commands use filenames, so '-o filenames' is not needed.
4230 for i in env netstat seq uname units wget; do
4231 have $i && complete -F _longopt $default $i
4237 # The only unusual feature is that we don't parse "gcc --help -v" output
4238 # directly, because that would include the options of all the other backend
4239 # tools (linker, assembler, preprocessor, etc) without any indication that
4240 # you cannot feed such options to the gcc driver directly. (For example, the
4241 # linker takes a -z option, but you must type -Wl,-z for gcc.) Instead, we
4242 # ask the driver ("g++") for the name of the compiler ("cc1"), and parse the
4243 # --help output of the compiler.
4248 local cur cc backend
4266 backend=cc1 # (near-)universal backend
4270 if [[ "$cur" == -* ]]; then
4271 cc=$( $1 -print-prog-name=$backend )
4273 # for C/C++/ObjectiveC it's useless
4274 # for FORTRAN/Java it's an error
4275 COMPREPLY=( $( $cc --help 2>/dev/null | tr '\t' ' ' | \
4276 sed -e '/^ *-/!d' -e 's/ *-\([^ ]*\).*/-\1/' | \
4277 command grep "^$cur" | sort -u ) )
4282 complete $filenames -F _gcc gcc g++ c++ g77 gcj gpc
4283 [ $UNAME = GNU -o $UNAME = Linux -o $UNAME = Cygwin ] && \
4284 [ -n "${have:-}" ] && complete $filenames -F _gcc cc
4286 # Linux cardctl(8) completion
4296 if [ $COMP_CWORD -eq 1 ]; then
4297 COMPREPLY=( $( compgen -W 'status config ident suspend \
4298 resume reset eject insert scheme' \
4302 complete -F _cardctl cardctl
4304 # This function is required by _dpkg() and _dpkg-reconfigure()
4307 _comp_dpkg_installed_packages()
4309 grep -A 1 "Package: $1" /var/lib/dpkg/status | \
4310 grep -B 1 -E "ok installed|half-installed|unpacked| \
4311 half-configured|config-files" | \
4312 grep "Package: $1" | cut -d\ -f2
4315 # Debian dpkg(8) completion
4323 prev=${COMP_WORDS[COMP_CWORD-1]}
4328 # find the last option flag
4329 if [[ $cur != -* ]]; then
4330 while [[ $prev != -* && $i != 1 ]]; do
4332 prev=${COMP_WORDS[i-1]}
4337 -@(c|i|A|I|f|e|x|X|-@(install|unpack|record-avail|contents|info|fsys-tarfile|field|control|extract)))
4345 -@(s|p|l|-@(status|print-avail|list)))
4346 COMPREPLY=( $( apt-cache pkgnames $cur 2>/dev/null ) )
4353 -@(r|L|P|-@(remove|purge|listfiles)))
4354 COMPREPLY=( $( _comp_dpkg_installed_packages $cur ) )
4359 COMPREPLY=( $( compgen -W '-i --install --unpack -A --record-avail \
4360 --configure -r --remove -P --purge --get-selections \
4361 --set-selections --update-avail --merge-avail \
4362 --clear-avail --command-fd --forget-old-unavail -s \
4363 --status -p --print-avail -L --listfiles -l --list \
4364 -S --search -C --audit --print-architecture \
4365 --print-gnu-build-architecture \
4366 --print-installation-architecture \
4367 --compare-versions --help --version --force-help \
4368 --force-all --force-auto-select --force-downgrade \
4369 --force-configure-any --force-hold --force-bad-path \
4370 --force-not-root --force-overwrite \
4371 --force-overwrite-diverted --force-bad-verify \
4372 --force-depends-version --force-depends \
4373 --force-confnew --force-confold --force-confdef \
4374 --force-confmiss --force-conflicts --force-architecture\
4375 --force-overwrite-dir --force-remove-reinstreq \
4376 --force-remove-essential -Dh \
4377 --debug=help --licence --admindir= --root= --instdir= \
4378 -O --selected-only -E --skip-same-version \
4379 -G --refuse-downgrade -B --auto-deconfigure \
4380 --no-debsig --no-act -D --debug= --status-fd \
4381 -b --build -I --info -f --field -c --contents \
4382 -x --extract -X --vextract --fsys-tarfile -e --control \
4383 --ignore-depends= --abort-after' -- $cur ) )
4389 complete -F _dpkg $filenames dpkg dpkg-deb
4392 # Debian GNU dpkg-reconfigure(8) completion
4394 have dpkg-reconfigure &&
4401 prev=${COMP_WORDS[COMP_CWORD-1]}
4406 opt=( $( echo /usr/share/perl5/Debconf/FrontEnd/* ) )
4407 opt=( ${opt[@]##*/} )
4408 opt=( ${opt[@]%.pm} )
4409 COMPREPLY=( $( compgen -W '${opt[@]}' -- $cur ) )
4413 COMPREPLY=( $( compgen -W 'low medium high critical' -- $cur ) )
4418 if [[ "$cur" == -* ]]; then
4419 COMPREPLY=( $( compgen -W '-f --frontend -p --priority -a --all \
4420 -u --unseen-only -h --help -s --showold \
4421 --force --terse' -- $cur ) )
4423 COMPREPLY=( $( _comp_dpkg_installed_packages $cur ) )
4426 complete -F _dpkg_reconfigure $default dpkg-reconfigure
4428 # Debian dpkg-source completion
4433 local cur prev options work i action packopts unpackopts
4435 packopts="-c -l -F -V -T -D -U -W -E -sa -i -I -sk -sp -su -sr -ss -sn -sA -sK -sP -sU -sR"
4436 unpackopts="-sp -sn -su"
4437 options=`echo "-x -b $packopts $unpackopts" | xargs echo | sort -u | xargs echo`
4440 if [ "$1" != "dpkg-source" ]; then
4444 prev=${COMP_WORDS[COMP_CWORD-1]}
4446 for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
4447 if [[ ${COMP_WORDS[$i]} == "-x" ]]; then
4449 elif [[ ${COMP_WORDS[$i]} == "-b" ]]; then
4451 elif [[ ${COMP_WORDS[$i]} == "-h" ]]; then
4455 # if currently seeing a complete option, return just itself.
4456 for i in $options; do
4457 if [ "$cur" = "$i" ]; then
4458 COMPREPLY=( "$cur" )
4464 if [ "$cur" = "-" -o "$cur" = "-s" ]; then
4465 COMPREPLY=( $unpackots )
4470 COMPREPLY=( $( compgen -d -- "$cur" ) \
4471 $( compgen -f -X '!*.dsc' -- "$cur" ) )
4475 COMPREPLY=( $unpackopts $(compgen -d -f -- "$cur" ) )
4482 if [ "$cur" = "-" ]; then
4483 COMPREPLY=( $packopts )
4486 if [ "$cur" = "-s" ]; then
4487 COMPREPLY=( "-sa" "-sk" "-sp" "-su" "-sr" "-ss" "-sn" \
4488 "-sA" "-sK" "-sP" "-sU" "-sR" )
4493 COMPREPLY=( $( compgen -d -- "$cur" ) )
4496 "-c"|"-l"|"-T"|"-i"|"-I")
4497 # -c: get controlfile
4498 # -l: get per-version info from this file
4499 # -T: read variables here, not debian/substvars
4500 # -i: <regexp> filter out files to ignore diffs of.
4501 # -I: filter out files when building tarballs.
4502 # return directory names and file names
4503 COMPREPLY=( $( compgen -d -f ) )
4507 # -F: force change log format
4508 COMPREPLY=( $( ( cd /usr/lib/dpkg/parsechangelog; compgen -f "$cur" ) ) )
4512 # -V: set a substitution variable
4513 # we don't know anything about possible variables or values
4514 # so we don't try to suggest any completion.
4519 # -D: override or add a .dsc field and value
4520 # if $cur doesn't contain a = yet, suggest variable names
4521 if echo -- "$cur" | grep -q "="; then
4522 # $cur contains a "="
4526 COMPREPLY=( Format Source Version Binary Maintainer Uploader Architecture Standards-Version Build-Depends Files )
4531 # -U: remove a field
4532 # Suggest possible fieldnames
4533 COMPREPLY=( Format Source Version Binary Maintainer Uploader Architecture Standards-Version Build-Depends Files )
4537 COMPREPLY=( $packopts )
4544 # if seeing a partial option, return possible completions.
4545 if [ "$cur" = "-s" ]; then
4546 COMPREPLY=( "-sa" "-sk" "-sp" "-su" "-sr" "-ss" "-sn" \
4547 "-sA" "-sK" "-sP" "-sU" "-sR" )
4550 # else return all possible options.
4551 COMPREPLY=( $options )
4556 complete -F _dpkg_source dpkg-source
4558 # Debian Linux dselect(8) completion.
4567 prev=${COMP_WORDS[COMP_CWORD-1]}
4581 if [[ "$cur" == -* ]]; then
4582 COMPREPLY=( $( compgen -W '--admindir --help --version --licence \
4583 --license --expert --debug' -- $cur ) )
4585 COMPREPLY=( $( compgen -W 'access update select install config \
4586 remove quit' -- $cur ) )
4592 complete -F _dselect $filenames dselect
4597 # available path elements completion
4602 _filedir '@(jar|zip)'
4605 # exact classpath determination
4606 _java_find_classpath()
4610 # search first in current options
4611 for (( i=1; i < COMP_CWORD; i++ )); do
4612 if [[ "${COMP_WORDS[i]}" == -@(cp|classpath) ]]; then
4613 classpath=${COMP_WORDS[i+1]}
4618 # default to environment
4619 [ -z "$classpath" ] && classpath=$CLASSPATH
4621 # default to current directory
4622 [ -z "$classpath" ] && classpath=.
4625 # exact sourcepath determination
4626 _java_find_sourcepath()
4630 # search first in current options
4631 for (( i=1; i < COMP_CWORD; i++ )); do
4632 if [[ "${COMP_WORDS[i]}" == -sourcepath ]]; then
4633 sourcepath=${COMP_WORDS[i+1]}
4638 # default to classpath
4639 [ -z "$sourcepath" ] && _java_find_classpath
4640 sourcepath=$classpath
4643 # available classes completion
4648 # find which classpath to use
4649 _java_find_classpath
4651 # convert package syntax to path syntax
4653 # parse each classpath element for classes
4654 for i in ${classpath//:/ }; do
4655 if [ -r $i ] && [[ "$i" == *.@(jar|zip) ]]; then
4656 if type zipinfo &> /dev/null; then
4657 COMPREPLY=( "${COMPREPLY[@]}" $( zipinfo -1 \
4658 "$i" | grep "^$cur" | grep '\.class$' | \
4661 COMPREPLY=( "${COMPREPLY[@]}" $( jar tf "$i" \
4662 "$cur" | grep "\.class$" | grep -v "\\$" ) )
4665 elif [ -d $i ]; then
4667 COMPREPLY=( "${COMPREPLY[@]}" $( find "$i" -type f \
4668 -path "$i/$cur*.class" 2>/dev/null | \
4669 grep -v "\\$" | sed -e "s|^$i/||" ) )
4673 # remove class extension
4674 COMPREPLY=( ${COMPREPLY[@]%.class} )
4675 # convert path syntax to package syntax
4676 COMPREPLY=( ${COMPREPLY[@]//\//.} )
4679 # available packages completion
4684 # find wich sourcepath to use
4685 _java_find_sourcepath
4687 # convert package syntax to path syntax
4689 # parse each sourcepath element for packages
4690 for i in ${sourcepath//:/ }; do
4692 COMPREPLY=( "${COMPREPLY[@]}" $( command ls -F -d \
4693 $i/$cur* 2>/dev/null | sed -e 's|^'$i'/||' ) )
4696 # keep only packages
4697 COMPREPLY=( $( echo "${COMPREPLY[@]}" | tr " " "\n" | grep "/$" ) )
4698 # remove packages extension
4699 COMPREPLY=( ${COMPREPLY[@]%/} )
4700 # convert path syntax to package syntax
4701 cur=${COMPREPLY[@]//\//.}
4712 prev=${COMP_WORDS[COMP_CWORD-1]}
4714 for ((i=1; i < $COMP_CWORD; i++)); do
4715 case ${COMP_WORDS[$i]} in
4717 ((i++)) # skip the classpath string.
4720 # this is an option, not a class/jarfile name.
4723 # once we've seen a class, just do filename completion
4737 if [[ "$cur" == -* ]]; then
4738 # relevant options completion
4739 COMPREPLY=( $( compgen -W '-client -hotspot -server -classic \
4740 -cp -classpath -D -verbose -verbose:class \
4741 -verbose:gc -version:jni -version \
4742 -showversion -? -help -X -jar \
4743 -ea -enableassertions -da -disableassertions \
4744 -esa -enablesystemassertions \
4745 -dsa -disablesystemassertions ' -- $cur ) )
4747 if [[ "$prev" == -jar ]]; then
4748 # jar file completion
4751 # classes completion
4756 complete -F _java $filenames java
4759 # javadoc completion
4768 prev=${COMP_WORDS[COMP_CWORD-1]}
4771 -@(overview|helpfile|stylesheetfile))
4779 -@(classpath|bootclasspath|docletpath|sourcepath|extdirs))
4785 if [[ "$cur" == -* ]]; then
4786 # relevant options completion
4787 COMPREPLY=( $( compgen -W '-overview -public -protected \
4788 -package -private -help -doclet -docletpath \
4789 -sourcepath -classpath -exclude -subpackages \
4790 -breakiterator -bootclasspath -source -extdirs \
4791 -verbose -locale -encoding -J -d -use -version \
4792 -author -docfilessubdirs -splitindex \
4793 -windowtitle -doctitle -header -footer -bottom \
4794 -link -linkoffline -excludedocfilessubdir \
4795 -group -nocomment -nodeprecated -noqualifier \
4796 -nosince -nodeprecatedlist -notree -noindex \
4797 -nohelp -nonavbar -quiet -serialwarn -tag \
4798 -taglet -tagletpath -charset -helpfile \
4799 -linksource -stylesheetfile -docencoding' -- \
4802 # source files completion
4804 # packages completion
4808 complete -F _javadoc $filenames javadoc
4819 prev=${COMP_WORDS[COMP_CWORD-1]}
4826 -@(classpath|bootclasspath|sourcepath|extdirs))
4832 if [[ "$cur" == -* ]]; then
4833 # relevant options completion
4834 COMPREPLY=( $( compgen -W '-g -g:none -g:lines -g:vars\
4835 -g:source -O -nowarn -verbose -deprecation -classpath\
4836 -sourcepath -bootclasspath -extdirs -d -encoding -source\
4837 -target -help' -- $cur ) )
4839 # source files completion
4843 complete -F _javac $filenames javac
4845 # PINE address-book completion
4855 COMPREPLY=( $( compgen -W '$( awk "{print \$1}" ~/.addressbook 2>/dev/null)' \
4858 complete -F _pineaddr $default pine
4862 # Mutt doesn't have an "addressbook" like Pine, but it has aliases and
4863 # a "query" function to retrieve addresses, so that's what we use here.
4864 have mutt || have muttng && {
4875 local -a newconffiles
4879 while [[ "$1" ]]; do
4880 newconffiles=( $(sed -rn 's|^source[[:space:]]+([^[:space:]]+).*$|\1|p' $(eval echo $1) ) )
4881 for file in "${newconffiles[@]}"; do
4882 [[ ! "$file" ]] || [[ "${sofar/ ${file} / }" != "$sofar" ]] &&
4884 sofar="$sofar $file"
4885 sofar=" $(eval _muttconffiles \"$sofar\" $file) "
4895 local -a conffiles aliases
4898 [ -f ~/.${muttcmd}/${muttcmd}rc ] && muttrc="~/.${muttcmd}/${muttcmd}rc"
4899 [ -f ~/.${muttcmd}rc ] && muttrc="~/.${muttcmd}rc"
4900 [ -z "$muttrc" ] && return 0
4902 conffiles=( $(eval _muttconffiles $muttrc $muttrc) )
4903 aliases=( $( sed -rn 's|^alias[[:space:]]+([^[:space:]]+).*$|\1|p' \
4904 $(eval echo "${conffiles[@]}") ) )
4905 COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "${aliases[*]}" -- $cur ) )
4913 local -a queryresults
4916 querycmd="$( $muttcmd -Q query_command | sed -r 's|^query_command=\"(.*)\"$|\1|; s|%s|'$cur'|' )"
4917 if [ -z "$cur" -o -z "$querycmd" ]; then
4920 queryresults=( $( $querycmd | \
4921 sed -nr '2,$s|^([^[:space:]]+).*|\1|p' ) )
4924 COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "${queryresults[*]}" \
4932 local cur folder spoolfile
4935 # This is currently not working so well. Perhaps this function should
4936 # just call _filedir() for the moment.
4937 if [[ $cur == [=+]* ]]; then
4938 folder="$( $muttcmd -Q folder | sed -r 's|^folder=\"(.*)\"$|\1|' )"
4941 # Match any file in $folder beginning with $cur
4942 # (minus the leading '=' sign).
4943 COMPREPLY=( $( compgen -f -- "$folder/${cur:1}" ) )
4944 COMPREPLY=( ${COMPREPLY[@]#$folder/} )
4946 elif [ "$cur" == !* ]; then
4947 spoolfile="$( $muttcmd -Q spoolfile | sed -r 's|^spoolfile=\"(.*)\"$|\1|' )"
4948 [ ! -z "$spoolfile" ] && eval cur="${cur/^!/$spoolfile}";
4959 prev=${COMP_WORDS[COMP_CWORD-1]}
4963 [ ${COMP_WORDS[0]} == muttng ] && muttcmd="muttng" || muttcmd="mutt"
4967 COMPREPLY=( $( compgen -W '-A -a -b -c -e -f -F -H -i -m -n \
4968 -p -Q -R -s -v -x -y -z -Z -h' \
4982 -@(e|m|Q|s|h|p|R|v|y|z|Z))
4994 complete -F _mutt $default $filenames mutt muttng
5004 # if $COMP_CONFIGURE_HINTS is not null, then completions of the form
5005 # --option=SETTING will include 'SETTING' as a contextual hint
5006 [[ "$cur" != -* ]] && return 0
5008 if [ -n "$COMP_CONFIGURE_HINTS" ]; then
5009 COMPREPLY=( $( $1 --help | awk '/^ --[A-Za-z]/ { print $1; if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,].*//g' | grep ^$cur ) )
5012 COMPREPLY=( $( $1 --help | awk '/^ --[A-Za-z]/ { print $1; if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,=].*//g' | grep ^$cur ) )
5015 complete -F _configure_func $default configure
5017 # Debian reportbug(1) completion
5026 prev=${COMP_WORDS[COMP_CWORD-1]}
5029 -f|--filename|-i|--include|--mta|-o|--output)
5034 COMPREPLY=( $( compgen -W "debian guug kde mandrake help" -- \
5039 COMP_WORDS=(COMP_WORDS[0] $cur)
5045 COMPREPLY=( $( compgen -W "novice standard expert" -- $cur ) )
5049 COMPREPLY=( $( compgen -W "grave serious important normal \
5050 minor wishlist" -- $cur ) )
5053 -u|--ui|--interface)
5054 COMPREPLY=( $( compgen -W "newt text gnome" -- $cur ) )
5058 COMPREPLY=( $( compgen -W "gnats debbugs" -- $cur ) )
5062 COMPREPLY=( $( compgen -W "none patch security upstream sid \
5063 woody potato sarge fixed" -- $cur ))
5070 COMPREPLY=($( compgen -W '-h --help -v --version -a --af -b \
5071 --no-query-bts --query-bts -B --bts -c --configure \
5072 --no-config-files --check-available -d --debug \
5073 --no-check-available -e --editor --email -f \
5074 --filename -g --gnupg -H --header -i --include -j \
5075 --justification -l --ldap --no-ldap -L --list-cc -m \
5076 --maintonly --mode --mua --mta --mutt -n --mh --nmh \
5077 -o --output -p --print -P --pgp --proxy --http_proxy\
5078 -q --quiet -Q --query-only --realname --report-quiet \
5079 --reply-to --replyto -s --subject -S --severity \
5080 --smtphost -t --type -T --tags --template -V -x \
5081 --no-cc --package-version -z --no-compress \
5082 --ui --interface -u \
5083 wnpp boot-floppies kernel-image' -- $cur ) \
5084 $( apt-cache pkgnames -- $cur 2> /dev/null ) )
5088 complete -F _reportbug $filenames reportbug
5090 # Debian querybts(1) completion
5099 prev=${COMP_WORDS[COMP_CWORD-1]}
5103 COMPREPLY=( $( compgen -W "debian guug kde mandrake help" -- \
5107 -u|--ui|--interface)
5108 COMPREPLY=($( compgen -W "newt text gnome" -- $cur ))
5115 COMPREPLY=($( compgen -W '-h --help -v --version -A --archive \
5116 -B --bts -l --ldap --no-ldap --proxy= --http_proxy= \
5117 -s --source -w --web -u --ui --interface \
5118 wnpp boot-floppies' -- $cur ) \
5119 $( apt-cache pkgnames -- $cur 2> /dev/null ) )
5121 complete -F _querybts $filenames querybts
5123 # update-alternatives completion
5125 have update-alternatives && {
5126 installed_alternatives()
5129 # find the admin dir
5130 for i in alternatives dpkg/alternatives rpm/alternatives; do
5131 [ -d /var/lib/$i ] && admindir=/var/lib/$i && break
5133 for (( i=1; i < COMP_CWORD; i++ )); do
5134 if [[ "${COMP_WORDS[i]}" == --admindir ]]; then
5135 admindir=${COMP_WORDS[i+1]}
5139 COMPREPLY=( $( command ls $admindir | grep "^$cur" ) )
5142 _update_alternatives()
5144 local cur prev mode args i
5148 prev=${COMP_WORDS[COMP_CWORD-1]}
5151 --@(altdir|admindir))
5160 # find wich mode to use and how many real args used so far
5161 for (( i=1; i < COMP_CWORD; i++ )); do
5162 if [[ "${COMP_WORDS[i]}" == --@(install|remove|auto|display|config|remove-all) ]]; then
5163 mode=${COMP_WORDS[i]}
5164 args=$(($COMP_CWORD - i))
5176 installed_alternatives
5186 installed_alternatives
5194 installed_alternatives
5197 installed_alternatives
5200 installed_alternatives
5203 installed_alternatives
5206 COMPREPLY=( $( compgen -W '--verbose --quiet --help --version \
5207 --altdir --admindir' -- $cur ) \
5208 $( compgen -W '--install --remove --auto --display \
5209 --config' -- $cur ) )
5212 complete -F _update_alternatives update-alternatives
5224 prev=${COMP_WORDS[COMP_CWORD-1]##*/}
5228 COMPREPLY=( $( compgen -W "old new warn warnall" -- $cur ) )
5232 COMPREPLY=( $( compgen -W "ignore default all module once error" -- $cur ) )
5236 _filedir '@(py|pyc|pyo)'
5240 [[ ${COMP_WORDS[COMP_CWORD-2]} != -@(Q|W) ]] && _filedir
5245 # if '-c' is already given, complete all kind of files.
5246 for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
5247 if [[ ${COMP_WORDS[i]} == -c ]]; then
5253 if [[ "$cur" != -* ]]; then
5254 _filedir '@(py|pyc|pyo)'
5256 COMPREPLY=( $( compgen -W "- -d -E -h -i -O -Q -S -t -u \
5257 -U -v -V -W -x -c" -- $cur ) )
5264 complete -F _python $filenames python
5272 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 ) )
5277 local cur prev prefix temp
5281 prev=${COMP_WORDS[COMP_CWORD-1]}
5284 # completing an option (may or may not be separated by a space)
5285 if [[ "$cur" == -?* ]]; then
5292 # only handle module completion for now
5295 COMPREPLY=( $( compgen -d -P "$prev" -- "$cur" ) )
5304 # handle case where first parameter is not a dash option
5305 if [[ "${COMP_WORDS[COMP_CWORD]}" != -* ]]; then
5310 # complete using basic options
5311 COMPREPLY=( $( compgen -W '-C -s -T -u -U -W -X -h -v -V -c -w -d -D -p \
5312 -n -a -F -l -0 -I -m -M -P -S -x -i -e ' -- $cur ) )
5315 complete -F _perl $filenames perl
5319 local cur prev prefix temp
5323 prev=${COMP_WORDS[COMP_CWORD-1]}
5326 # completing an option (may or may not be separated by a space)
5327 if [[ "$cur" == -?* ]]; then
5334 # complete builtin perl functions
5337 COMPREPLY=( $( compgen -W 'chomp chop chr crypt hex index lc \
5338 lcfirst length oct ord pack q qq reverse rindex sprintf \
5339 substr tr uc ucfirst y m pos quotemeta s split study qr abs \
5340 atan2 cos exp hex int log oct rand sin sqrt srand pop push \
5341 shift splice unshift grep join map qw reverse sort unpack \
5342 delete each exists keys values binmode close closedir \
5343 dbmclose dbmopen die eof fileno flock format getc print \
5344 printf read readdir rewinddir seek seekdir select syscall \
5345 sysread sysseek syswrite tell telldir truncate warn write \
5346 pack read syscall sysread syswrite unpack vec -X chdir chmod \
5347 chown chroot fcntl glob ioctl link lstat mkdir open opendir \
5348 readlink rename rmdir stat symlink umask unlink utime caller \
5349 continue do dump eval exit goto last next redo return \
5350 sub wantarray caller import local my our package use defined \
5351 formline reset scalar undef \
5352 alarm exec fork getpgrp getppid getpriority kill pipe qx \
5353 setpgrp setpriority sleep system times wait waitpid \
5354 import no package require use bless dbmclose dbmopen package \
5355 ref tie tied untie use accept bind connect getpeername \
5356 getsockname getsockopt listen recv send setsockopt shutdown \
5357 socket socketpair msgctl msgget msgrcv msgsnd semctl semget \
5358 semop shmctl shmget shmread shmwrite endgrent endhostent \
5359 endnetent endpwent getgrent getgrgid getgrnam getlogin \
5360 getpwent getpwnam getpwuid setgrent setpwent endprotoent \
5361 endservent gethostbyaddr gethostbyname gethostent \
5362 getnetbyaddr getnetbyname getnetent getprotobyname \
5363 getprotobynumber getprotoent getservbyname getservbyport \
5364 getservent sethostent setnetent setprotoent setservent \
5365 gmtime localtime time times' -- $cur ) )
5372 COMPREPLY=( $( compgen -W '-h -v -t -u -m -l -F -X -f -q' -- $cur ))
5380 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 ) )
5386 complete -F _perldoc $default perldoc
5394 local cur prev file dir i
5398 prev=${COMP_WORDS[COMP_CWORD-1]}
5403 # deal with relative directory
5404 [ "$file" = "$dir" ] && dir=.
5406 COMPREPLY=( $( compgen -f "$dir/RCS/$file" ) )
5408 for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
5409 file=${COMPREPLY[$i]##*/}
5410 dir=${COMPREPLY[$i]%RCS/*}
5411 COMPREPLY[$i]=$dir$file
5414 COMPREPLY=( "${COMPREPLY[@]}" $( compgen -G "$dir/$file*,v" ) )
5416 for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
5417 COMPREPLY[$i]=${COMPREPLY[$i]%,v}
5420 # default to files if nothing returned and we're checking in.
5421 # otherwise, default to directories
5422 [ ${#COMPREPLY[@]} -eq 0 -a $1 = ci ] && _filedir || _filedir -d
5424 complete -F _rcs $filenames ci co rlog rcs rcsdiff
5426 # lilo(8) completion
5431 COMPREPLY=( $( awk -F'=' '/label/ {print $2}' \
5432 /etc/lilo.conf | sed -e 's/"//g' | grep "^$cur" ) )
5441 prev=${COMP_WORDS[COMP_CWORD-1]}
5465 COMPREPLY=( $( compgen -W 'help ChRul EBDA geom geom= \
5466 table= video' -- $cur ) )
5471 if [[ "$cur" == -* ]]; then
5472 # relevant options completion
5473 COMPREPLY=( $( compgen -W '-A -b -c -C -d -f -g -i -I -l -L -m \
5474 -M -p -P -q -r -R -s -S -t -T -u -U -v -V -w -x -z' -- \
5478 complete -F _lilo lilo
5493 COMPREPLY=( $( compgen -W '--help' -- $cur ) )
5496 COMPREPLY=( $( compgen -W '-async-dns -max-connections \
5497 -max-connections-to-host -retries \
5498 -receive-timeout -unrestartable-receive-timeout\
5499 -format-cache-size -memory-cache-size \
5500 -http-proxy -ftp-proxy -download-dir \
5501 -assume-codepage -anonymous -dump -no-connect \
5502 -source -version -help' -- $cur ) )
5505 if [ -r ~/.links/links.his ]; then
5506 COMPREPLY=( $( compgen -W '$( < ~/.links/links.his )' \
5509 _filedir '@(htm|html)'
5516 complete -F _links $filenames links
5518 [ $UNAME = FreeBSD ] && {
5519 # FreeBSD package management tool completion
5523 local cur pkgdir prev
5525 pkgdir=${PKG_DBDIR:-/var/db/pkg}/
5527 prev=${COMP_WORDS[COMP_CWORD-1]}
5529 [ "$prev" = "-o" -o "$prev" = "-p" -o "$prev" = "-W" ] && return 0
5531 COMPREPLY=( $( compgen -d $pkgdir$cur ) )
5532 COMPREPLY=( ${COMPREPLY[@]#$pkgdir} )
5536 complete -F _pkg_delete $dirnames pkg_delete pkg_info
5537 have pkg_deinstall && complete -F _pkg_delete $dirnames pkg_deinstall
5539 # FreeBSD kernel module commands
5546 [ -d $moddir ] || moddir=/boot/kernel/
5549 COMPREPLY=( $( compgen -f $moddir$cur ) )
5550 COMPREPLY=( ${COMPREPLY[@]#$moddir} )
5551 COMPREPLY=( ${COMPREPLY[@]%.ko} )
5555 complete -F _kldload $filenames kldload
5561 COMPREPLY=( $(kldstat | sed -ne "s/^.*[ \t]\+\($cur[a-z_]\+\).ko$/\1/p") )
5563 complete -F _kldunload $filenames kldunload
5566 # FreeBSD portupgrade completion
5571 local cur pkgdir prev
5573 pkgdir=${PKG_DBDIR:-/var/db/pkg}/
5575 prev=${COMP_WORDS[COMP_CWORD-1]}
5577 [ "$prev" = "-l" -o "$prev" = "-L" -o "$prev" = "-o" ] && return 0
5579 COMPREPLY=( $( compgen -d $pkgdir$cur ) )
5580 COMPREPLY=( ${COMPREPLY[@]#$pkgdir} )
5581 COMPREPLY=( ${COMPREPLY[@]%-*} )
5585 complete -F _portupgrade $dirnames portupgrade
5587 # FreeBSD portinstall completion
5592 local cur portsdir prev indexfile
5595 portsdir=${PORTSDIR:-/usr/ports}/
5597 prev=${COMP_WORDS[COMP_CWORD-1]}
5599 indexfile=$portsdir/INDEX-5
5600 # Then INDEX if INDEX-5 does not exist or system is not FreeBSD 5.x
5601 [ "${OSTYPE%.*}" = "freebsd5" -a -f $indexfile ] ||
5602 indexfile=$portsdir/INDEX
5604 [ "$prev" = "-l" -o "$prev" = "-L" -o "$prev" = "-o" ] && return 0
5606 COMPREPLY=( $( egrep "^$cur" < $indexfile | cut -d'|' -f1 ) )
5607 COMPREPLY2=( $( egrep "^[^\|]+\|$portsdir$cur" < $indexfile | \
5609 COMPREPLY2=( ${COMPREPLY2[@]#$portsdir} )
5610 COMPREPLY=( "${COMPREPLY[@]}" "${COMPREPLY2[@]}" )
5614 complete -F _portinstall $dirnames portinstall
5616 # Slackware Linux removepkg completion
5618 have removepkg && [ -f /etc/slackware-version ] &&
5626 COMPREPLY=( $( (cd /var/log/packages; compgen -f -- "$cur") ) )
5628 complete -F _removepkg $filenames removepkg &&
5629 complete $dirnames -f -X '!*.tgz' installpkg upgradepkg explodepkg
5631 # look(1) completion
5641 if [ $COMP_CWORD = 1 ]; then
5642 COMPREPLY=( $( compgen -W '$(look $cur)' ) )
5645 complete -F _look $default look
5647 # ypcat(1) and ypmatch(1) completion
5657 [ $1 = ypcat ] && [ $COMP_CWORD -gt 1 ] && return 0
5658 [ $1 = ypmatch ] && [ $COMP_CWORD -gt 2 ] && return 0
5660 if [ $1 = ypmatch ] && [ $COMP_CWORD -eq 1 ] && \
5661 [ ${#COMP_WORDS[@]} -eq 3 ]; then
5662 map=${COMP_WORDS[2]}
5663 COMPREPLY=( $( compgen -W '$( ypcat $map | \
5664 cut -d':' -f 1 )' -- $cur) )
5666 [ $1 = ypmatch ] && [ $COMP_CWORD -ne 2 ] && return 0
5667 COMPREPLY=( $( compgen -W \
5668 '$( echo $(ypcat -x | cut -d"\"" -f 2))' -- $cur))
5673 complete -F _ypmatch ypmatch ypcat
5675 # mplayer(1) completion
5678 _mplayer_options_list()
5681 COMPREPLY=( $( $1 $2 help 2> /dev/null | \
5682 sed -e '1,/^Available/d' | awk '{print $1}' | \
5683 sed -e 's/:$//' -e 's/^'${2#-}'$//' -e 's/<.*//' | \
5689 local cmd cur prev skinsdir IFS=$' \t\n' i j k=0
5692 cmd=${COMP_WORDS[0]}
5694 prev=${COMP_WORDS[COMP_CWORD-1]}
5697 -@(ac|afm|vc|vfm|ao|vo|vop|fstype))
5698 _mplayer_options_list mplayer $prev
5702 _mplayer_options_list mencoder $prev
5706 _filedir '@(mp3|MP3|mpg|MPG|ogg|OGG|wav|WAV|mid|MID|flac|FLAC|mka|MKA)'
5710 _filedir '@(desc|ttf)'
5714 _filedir '@(srt|SRT|sub|SUB|txt|TXT|utf|UTF|rar|RAR|mpsub|smi|js|ssa|SSA|aas|AAS)'
5718 _filedir '@(idx|IDX|ifo|IFO|sub|SUB)'
5720 COMPREPLY=( $( for i in "${COMPREPLY[@]}"; do
5721 if [ -f $i -a -r $i ]; then
5731 _filedir '@(ifo|IFO)'
5735 _filedir '@(bin|BIN|cue|CUE)'
5739 # if you don't have installed mplayer in /usr you
5740 # may want to set the MPLAYER_SKINS_DIR global variable
5741 if [ -n "$MPLAYER_SKINS_DIR" ]; then
5742 skinsdir=$MPLAYER_SKINS_DIR
5744 skinsdir=/usr/share/mplayer/Skin
5748 for i in ~/.mplayer/Skin $skinsdir; do
5749 if [ -d $i -a -r $i ]; then
5750 for j in $( compgen -d $i/$cur ); do
5751 COMPREPLY[$k]=${j#$i/}
5759 -@(mixer|@(cdrom|dvd)-device|dvdauth|fb|zrdev))
5764 -@(edl?(out)|lircconf|menu-cfg|playlist|csslib|dumpfile)| \
5765 -@(subfile|vobsub|aofile|fbmodeconfig|include|o|dvdkey)| \
5770 -@(auto@(q|sync)|loop|menu-root|speed|sstep|aid|alang)| \
5771 -@(?(@(audio|sub)-)demuxer|bandwidth|cache|chapter)| \
5772 -@(dvd?(angle)|fps|frames|mc|passwd|user|sb|srate|ss|vcd)| \
5773 -@(vi?(d|vo)|ffactor|sid|slang|spu@(align|aa|gauss))| \
5774 -@(vobsubid|delay|bpp|brightness|contrast|dfbopts|display)| \
5775 -@(fbmode|geometry|guiwid|hue|icelayer|screen[wh]|wid)| \
5776 -@(monitor@(aspect|-@(dotclock|[hv]freq))|panscan|saturation)| \
5777 -@(xineramascreen|zr@(crop|norm|quality|[xy]doff|[vh]dec))| \
5778 -@(aspect|pp|x|y|xy|z|stereo|audio-@(density|delay|preload))| \
5779 -@(endpos|osdlevel|ffourcc|sws|channels|skiplimit|format)| \
5780 -@(ofps|aa@(driver|@(osd|sub)color)|vobsubout?(i@(ndex|d)))| \
5781 -sub@(-bg-@(alpha|color)|cp|delay|fps|pos|align|width)| \
5782 -sub@(font-@(blur|outline|autoscale|encoding|@(osd|text)-scale)))
5786 COMPREPLY=( $( compgen -W 'ec er= bug= idct= gray' \
5791 COMPREPLY=( $( compgen -W 'vcodec= vqmin= vqscale= \
5792 vqmax= mbqmin= mbqmax= vqdiff= \
5793 vmax_b_frames= vme= vhq v4mv \
5794 keyint= vb_strategy= vpass= \
5795 aspect= vbitrate= vratetol= \
5796 vrc_maxrate= vrc_minrate= \
5797 vrc_buf_size= vb_qfactor= vi_qfactor= \
5798 vb_qoffset= vi_qoffset= vqblur= \
5799 vqcomp= vrc_eq= vrc_override= \
5800 vrc_init_cplx= vqsquish= vlelim= \
5801 vcelim= vstrict= vdpart vpsize= gray \
5802 vfdct= idct= lumi_mask= dark_mask= \
5803 tcplx_mask= scplx_mask= naq ildct \
5804 format= pred qpel precmp= cmp= \
5805 subcmp= predia= dia= trell last_pred= \
5806 preme= subq= psnr mpeg_quant aic umv' \
5811 COMPREPLY=( $( compgen -W 'lgb= cgb= ls= cs= chs= \
5816 COMPREPLY=( $( compgen -W 'noprogressive progressive \
5817 nobaseline baseline optimize= \
5818 smooth= quality= outdir=' -- $cur ) )
5822 COMPREPLY=( $( compgen -W 'dr2 nodr2' -- $cur ) )
5826 COMPREPLY=( $( compgen -W 'pass= bitrate= \
5827 fixed_quant= me_quality= 4mv \
5828 rc_reaction_delay_factor= \
5829 rc_averaging_period= rc_buffer= \
5830 quant_range= min_key_interval= \
5831 max_key_interval= mpeg_quant \
5832 mod_quant lumi_mask hintedme \
5833 hintfile debug keyframe_boost= \
5834 kfthreshold= kfreduction=' -- $cur ) )
5838 COMPREPLY=( $( compgen -W 'br= key= deinterlace q= \
5839 min_quant= max_quant= rc_period= \
5840 rc_reaction_period= crispness= \
5841 rc_reaction_ratio= pass= vbrpass= \
5846 COMPREPLY=( $( compgen -W 'name= artist= genre= \
5847 subject= copyright= srcform= \
5848 comment= help' -- $cur ) )
5852 COMPREPLY=( $( compgen -W 'vbr= abr cbr br= q= aq= \
5853 ratio= vol= mode= padding= fast \
5854 preset= help' -- $cur ) )
5858 COMPREPLY=( $( compgen -W 'on channels= rate= \
5859 samplesize= format=' -- $cur ) )
5863 COMPREPLY=( $( compgen -W 'on fps= sqcif qcif cif \
5864 4cif pal ntsc w= h= y420 yv12 yuy2 \
5865 y8 format= size=' -- $cur ) )
5869 COMPREPLY=( $( compgen -W 'list= delay= format= fout= \
5870 volume= mul= softclip' -- $cur ) )
5874 COMPREPLY=( $( compgen -W 'ar-mode= iec958-encoded \
5875 iec958-decoded mute ucode= 75ire bw \
5876 color interlaced macrovision= norm= \
5877 square-pixel ccir601-pixel cr-left= \
5878 cr-right= cr-top= cr-bot= ck-rmin= \
5879 ck-gmin= ck-bmin= ck-rmax= ck-gmax= \
5880 ck-bmax= ck-r= ck-g= ck-b= \
5881 ignore-cache= ol-osd= olh-cor= \
5882 olw-cor= olx-cor= oly-cor= overlay \
5883 overlay-ratio= update-cache' -- $cur ))
5887 COMPREPLY=( $( compgen -W 'on noaudio driver= device= \
5888 input= freq= outfmt= width= height= \
5889 buffersize= norm= channel= chanlist= \
5890 audiorate= forceaudio alsa amode= \
5891 forcechan= adevice= audioid= volume= \
5892 bass= treble= balance= fps= \
5893 channels= immediatemode=' -- $cur ) )
5897 COMPREPLY=( $( compgen -W 'on w= h= fps= type=' \
5902 COMPREPLY=( $( compgen -W 'speed= paranoia= \
5903 generic-dev= sector-size= overlap= \
5904 toc-bias toc-offset= skip noskip' \
5909 COMPREPLY=( $( compgen -W 'conf= ar-delay ar-rate \
5910 keylist cmdlist js-dev file' -- $cur ) )
5914 COMPREPLY=( $( compgen -W 'resample resample= \
5915 channels channels= format format= \
5916 volume volume= delay delay= pan \
5917 pan= sub sub= surround surround=' \
5922 COMPREPLY=( $( compgen -W 'force= list=' -- $cur ) )
5929 COMPREPLY=( $( compgen -W '-aid -alang -audio-demuxer \
5930 -audiofile -cdrom-device -cache -cdda \
5931 -channels -chapter -csslib -demuxer \
5932 -dvd -dvd-device -dvdangle -dvdauth \
5933 -dvdkey -dvdnav -forceidx -fps -frames \
5934 -hr-mp3-seek -idx -mc -mf -ni -nobps \
5935 -passwd -rawaudio -rtsp-stream-over-tcp\
5936 -skipopening -sb -srate -ss -tv -user \
5937 -vcd -vid -vivo -ifo -ffactor -font \
5938 -noautosub -nooverlapsub -sid -slang \
5939 -sub -subcc -subcp -sub-demuxer \
5940 -subdelay -subfont-autoscale \
5941 -subfont-blur -subfont-encoding \
5942 -subfont-osd-scale -subfont-outline \
5943 -subfont-text-scale -subfps -subfile \
5944 -subpos -unicode -utf8 -vobsub \
5945 -vobsubid -ac -afm -aspect -flip \
5946 -lavdopts -noaspect -nosound -pp -ssf \
5947 -stereo -sws -vc -vfm -vop -xvidopts\
5948 -xy -zoom -bandwidth -cuefile \
5949 -noextbased -rawvideo -overlapsub \
5950 -sub-bg-alpha -sub-bg-color -subalign \
5951 -subwidth -sub-no-text-pp -spualign \
5952 -spuaa -spugauss -pphelp -verbose -v \
5953 -noni -noidx -nohr-mp3-seek -extbased \
5954 -bps -oldpp -nozoom -noflip -nounicode \
5955 -noutf8' -- $cur ) )
5956 # add mplayer specific options
5957 [[ "$cmd" == @(?(g)mplayer) ]] && COMPREPLY=( "${COMPREPLY[@]}" \
5958 $(compgen -W '-autoq -autosync -benchmark \
5959 -framedrop -h -help -hardframedrop \
5960 -identify -input -lircconf -loop \
5961 -nojoystick -nolirc -nortc -playlist \
5962 -quiet -really-quiet -rnd -sdp -skin \
5963 -slave -softsleep -speed -sstep \
5964 -use-stdin -dumpaudio -dumpfile \
5965 -dumpstream -dumpvideo -dumpmicrodvdsub\
5966 -dumpmpsub -dumpsrtsub -dumpjacosub \
5967 -dumpsami -dumpsub -osdlevel -af \
5968 -af-adv -ao -aofile -aop -delay -mixer \
5969 -nowaveheader -bpp -brightness \
5970 -contrast -display -double -dr -dxr2 \
5971 -fb -fbmode -fbmodeconfig -forcexv -fs \
5972 -geometry -hue -icelayer -jpeg \
5973 -monitor-dotclock -monitor-hfreq \
5974 -monitor-vfreq -monitoraspect \
5975 -nograbpointer -noslices -panscan \
5976 -rootwin -saturation -screenw -screenh \
5977 -stop-xscreensaver -vm -vo -vsync -wid \
5978 -xineramascreen -z -zrbw -zrcrop \
5979 -zrdev -zrfd -zrhelp -zrnorm -zrquality \
5980 -zrvdec -zrhdec -zrxdoff -zrydoff -y \
5981 -edl -edlout -enqueue -fixed-vo \
5982 -menu -menu-root -menu-cfg -shuffle \
5983 -format -aahelp -dfbopts -fstype \
5984 -guiwid -nokeepaspect -x --help \
5985 -aaosdcolor -aasubcolor -aadriver \
5986 -aaextended -aaeight' -- $cur) )
5987 # add mencoder specific options
5988 [[ "$cmd" = mencoder ]] && COMPREPLY=( "${COMPREPLY[@]}" \
5989 $(compgen -W '-audio-density -audio-delay \
5990 -audio-preload -divx4opts -endpos \
5991 -ffourcc -include -info -lameopts \
5992 -lavcopts -noskip -o -oac -ofps -ovc \
5993 -passlogfile -skiplimit -vobsubout \
5994 -vobsuboutindex -vobsuboutid \
5995 -xvidencopts -of --verbose' -- $cur) )
5998 _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)'
6004 complete $filenames -F _mplayer mplayer mencoder gmplayer kplayer
6007 # KDE dcop completion
6016 if [ -z $cur ]; then
6017 compstr=${COMP_WORDS[*]}
6019 compstr=$( command echo ${COMP_WORDS[*]} | sed "s/ $cur$//" )
6021 COMPREPLY=( $( compgen -W '$( command $compstr | sed s/\(.*\)// )' -- $cur ) )
6023 complete -F _dcop dcop
6025 # wvdial(1) completion
6030 local cur prev config i IFS=$'\t\n'
6034 prev=${COMP_WORDS[COMP_CWORD-1]}
6045 COMPREPLY=( $( compgen -W '--config --chat \
6046 --remotename --help --version --no-syslog' \
6050 # start with global and personal config files
6051 config="/etc/wvdial.conf"$'\t'"$HOME/.wvdialrc"
6052 # replace with command line config file if present
6053 for (( i=1; i < COMP_CWORD; i++ )); do
6054 if [[ "${COMP_WORDS[i]}" == "--config" ]]; then
6055 config=${COMP_WORDS[i+1]}
6059 # parse config files for sections and
6060 # remove default section
6061 COMPREPLY=( $( sed -ne \
6062 "s|^\[Dialer \($cur.*\)\]$|\1|p" \
6063 $config 2>/dev/null |grep -v '^Defaults$'))
6065 COMPREPLY=${COMPREPLY// /\\ }
6070 complete -F _wvdial wvdial
6081 prev=${COMP_WORDS[COMP_CWORD-1]}
6084 -@(s|-sign|-clearsign|-decrypt-files|-load-extension))
6088 --@(export|@(?(l|nr|nrl)sign|edit)-key))
6089 # return list of public keys
6090 COMPREPLY=( $( compgen -W "$( gpg --list-keys 2>/dev/null | sed -ne 's@^pub.*/\([^ ]*\).*\(<\([^>]*\)>\).*$@\1 \3@p')" -- "$cur" ))
6094 COMPREPLY=( $( compgen -W "$( gpg --list-keys 2>/dev/null | sed -ne 's@^pub.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ))
6095 if [ -e ~/.gnupg/gpg.conf ]; then
6096 COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$( sed -ne 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' ~/.gnupg/gpg.conf )" -- "$cur") )
6102 if [[ "$cur" == -* ]]; then
6103 COMPREPLY=( $( compgen -W '-s -b -e -f -c -d -a -r -u -Z -o -v\
6104 -q -n -N $(gpg --dump-options)' -- $cur ) )
6108 complete -F _gpg $default gpg
6110 # iconv(1) completion
6119 prev=${COMP_WORDS[COMP_CWORD-1]}
6122 -@(f|t|-@(from|to)-code))
6123 COMPREPLY=( $( compgen -W \
6124 '$( iconv --list | sed -e "s@//@@;" )' -- "$cur" ) )
6130 if [[ "$cur" = -* ]]; then
6131 COMPREPLY=( $( compgen -W '--from-code -f --to-code -t --list
6132 --output -o --verbose' -- "$cur" ) )
6136 complete -F _iconv $default iconv
6138 # dict(1) completion
6140 { have dict || have rdict; } && {
6143 dict $host $port $1 2>/dev/null | sed -ne \
6144 's/^['$'\t '']['$'\t '']*\([^'$'\t '']*\).*$/\1/p'
6149 local cur prev host port db dictfile
6153 prev=${COMP_WORDS[COMP_CWORD-1]}
6154 dictfile=/usr/share/dict/words
6156 for (( i=1; i < COMP_CWORD; i++ )); do
6157 case "${COMP_WORDS[i]}" in
6159 host=${COMP_WORDS[i+1]}
6160 [ -n "$host" ] && host="-h $host"
6164 port=${COMP_WORDS[i+1]}
6165 [ -n "$port" ] && port="-p $port"
6169 db=${COMP_WORDS[i+1]}
6170 [ -n "$db" ] && host="-d $db"
6178 if [[ "$cur" = -* ]]; then
6179 COMPREPLY=( $( compgen -W '-h --host -p --port -d --database \
6180 -m --match -s --strategy -c --config -C \
6181 --nocorrect -D --dbs -S --strats -H \
6182 --serverhelp -i --info -I --serverinfo \
6183 -a --noauth -u --user -k --key -V --version \
6184 -L --license --help -v --verbose -r --raw \
6185 -P --pager --debug --html --pipesize --client' \
6191 -@(d|-database|i|info))
6192 COMPREPLY=( $( compgen -W '$( _dictdata -D )' -- "$cur" ) )
6196 COMPREPLY=( $( compgen -W '$( _dictdata -S )' -- "$cur" ) )
6203 [ -r $dictfile ] && \
6204 COMPREPLY=( $( compgen -W '$( cat $dictfile )' -- "$cur" ) )
6206 complete -F _dict $default dict rdict
6209 # cdrecord(1) completion
6214 local cur prev i generic_options track_options track_mode
6218 prev=${COMP_WORDS[COMP_CWORD-1]}
6220 # foo=bar style option
6221 if [[ "$cur" == *=* ]]; then
6230 COMPREPLY=( $( compgen -W 'help all fast \
6231 track unreserve trtail unclose session' \
6236 COMPREPLY=( $( compgen -W 'burnfree noburnfree\
6237 varirec= audiomaster forcespeed noforcespeed\
6238 speedread nospeedread singlesession \
6239 nosinglesession hidecdr nohidecdr tattooinfo\
6240 tattoofile=' -- $cur ) )
6246 generic_options=(-version -v -V -d -silent -s -force -immed -dummy \
6247 -dao -raw -raw96r -raw96p -raw16 -multi -msinfo -toc \
6248 -atip -fix -nofix -waiti -load -lock -eject -format \
6249 -setdropts -checkdrive -prcap -inq -scanbus -reset \
6250 -abort -overburn -ignsize -useinfo -packet -noclose \
6251 -text debug= kdebug= kd= minbuf= speed= blank= fs= \
6252 dev= gracetime= timeout= driver= driveropts= \
6253 defpregap= pktsize= mcn= textfile= cuefile=)
6254 track_options=(-audio -swab -data -mode2 -xa -xa1 -xa2 -xamix -cdi \
6255 -isosize -pad padsize= -nopad -shorttrack -noshorttrack\
6256 pregap= -preemp -nopreemp -copy -nocopy -scms tcsize= \
6258 # look if previous was either a file or a track option
6260 if [ $COMP_CWORD -gt 1 ]; then
6261 if [ -f "$prev" ]; then
6264 for (( i=0; i < ${#track_options[@]}; i++ )); do
6265 if [[ "${track_options[i]}" == "$prev" ]]; then
6273 # files are always eligible completion
6275 # track options are always available
6276 COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W '${track_options[@]}' -- $cur ) )
6277 # general options are no more available after file or track option
6278 if [ $track_mode -eq 0 ]; then
6279 COMPREPLY=( "${COMPREPLY[@]}" \
6280 $( compgen -W '${generic_options[@]}' -- $cur ) )
6284 complete -F _cdrecord $filenames cdrecord
6286 # mkisofs(8) completion
6295 prev=${COMP_WORDS[COMP_CWORD-1]}
6298 -@(o|abstract|biblio|check-session|copyright|log-file|root-info|prep-boot|*-list))
6303 COMPREPLY=( $( mkisofs -input-charset help 2>&1 | \
6304 tail +3 | grep "^$cur") )
6317 if [[ "$cur" == -* ]]; then
6318 COMPREPLY=( $( compgen -W '-abstract -A -allow-lowercase \
6319 -allow-multidot -biblio -cache-inodes \
6320 -no-cache-inodes -b -eltorito-alt-boot -B -G \
6321 -hard-disk-boot -no-emul-boot -no-boot \
6322 -boot-load-seg -boot-load-size \
6323 -boot-info-table -C -c -check-oldname \
6324 -check-session -copyright -d -D -dir-mode \
6325 -dvd-video -f -file-mode -gid -gui \
6326 -graft-points -hide -hide-list -hidden \
6327 -hidden-list -hide-joliet -hide-joliet-list \
6328 -hide-joliet-trans-tbl -hide-rr-moved \
6329 -input-charset -output-charset -iso-level -J \
6330 -joliet-long -jcharset -l -L -log-file -m \
6331 -exclude-list -max-iso9660-filenames -M -N \
6332 -new-dir-mode -nobak -no-bak -force-rr -no-rr \
6333 -no-split-symlink-components \
6334 -no-split-symlink-fields -o -pad -no-pad \
6335 -path-list -P -p -print-size -quiet -R -r \
6336 -relaxed-filenames -sort -split-output \
6337 -stream-media-size -stream-file-name -sysid -T\
6338 -table-name -ucs-level -udf -uid \
6339 -use-fileversion -U -no-iso-translate -V \
6340 -volset -volset-size -volset-seqno -v -x -z \
6341 -hfs -apple -map -magic -hfs-creator \
6342 -hfs-type -probe -no-desktop -mac-name \
6343 -boot-hfs-file -part -auto -cluster-size \
6344 -hide-hfs -hide-hfs-list -hfs-volid \
6345 -icon-position -root-info -prep-boot \
6346 -input-hfs-charset -output-hfs-charset \
6347 -hfs-unlock -hfs-bless -hfs-parms --cap \
6348 --netatalk --double --ethershare --ushare \
6349 --exchange --sgi --xinet --macbin --single \
6350 --dave --sfm --osx-double --osx-hfs' -- $cur ))
6356 complete -F _mkisofs $filenames mkisofs
6367 prev=${COMP_WORDS[COMP_CWORD-1]}
6369 # -name value style option
6377 # --name=value style option
6378 if [[ "$cur" == *=* ]]; then
6382 --@(edit|view|ftplog|printwd))
6389 if [[ "$cur" == -* ]]; then
6390 COMPREPLY=( $( compgen -W '-a --stickchars -b --nocolor -c \
6391 --color -C --colors= -d --nomouse -e --edit= -f \
6392 --datadir -k --resetsoft -l --ftplog= -P --printwd= \
6393 -s --slow -t --termcap -u --nosubshell -U --subshell \
6394 -v --view= -V --version -x --xterm -h --help' -- $cur ) )
6399 complete -F _mc $filenames mc
6406 local cur prev special
6410 prev=${COMP_WORDS[COMP_CWORD-1]}
6412 for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
6413 if [[ ${COMP_WORDS[i]} == @(install|update|upgrade|remove|erase|deplist) ]]; then
6414 special=${COMP_WORDS[i]}
6418 if [ -n "$special" ]; then
6421 COMPREPLY=( $( compgen -W '$( yum -C list | cut -d" " -f1 )' -- $cur ) )
6425 _rpm_installed_packages
6433 COMPREPLY=( $( compgen -W '--installroot --version --help --enablerepo --disablerepo --exclude --obsoletes --noplugins' -- $cur ) )
6437 COMPREPLY=( $( compgen -W '-c -e -d -y -t -R -C -h' -- $cur ) )
6444 COMPREPLY=( $( compgen -W 'all available updates installed extras obsoletes recent' -- $cur ) )
6447 COMPREPLY=( $( compgen -W 'packages headers metadata cache dbcache all' -- $cur ) )
6459 COMPREPLY=( $( compgen -W 'install update check-update upgrade remove list \
6460 search info provides clean groupinstall groupupdate \
6461 grouplist deplist erase groupinfo groupremove \
6462 localinstall localupdate makecache resolvedep \
6463 shell whatprovides' -- $cur ) )
6467 complete -F _yum $filenames yum
6469 # yum-arch(8) completion
6479 COMPREPLY=( $( compgen -W '-d -v -vv -n -c -z -s -l -q' -- $cur ) )
6489 complete -F _yum_arch $filenames yum-arch
6492 # ImageMagick completion
6498 prev=${COMP_WORDS[COMP_CWORD-1]}
6502 COMPREPLY=( $( compgen -W 'Red Green Blue Opacity \
6503 Matte Cyan Magenta Yellow Black' -- $cur ) )
6507 COMPREPLY=( $( compgen -W 'shared private' -- $cur ) )
6511 COMPREPLY=( $( compgen -W 'GRAY OHTA RGB Transparent \
6512 XYZ YCbCr YIQ YPbPr YUV CMYK' -- $cur ) )
6516 COMPREPLY=( $( compgen -W 'Over In Out Atop Xor Plus \
6517 Minus Add Subtract Difference Multiply Bumpmap\
6518 Copy CopyRed CopyGreen CopyBlue CopyOpacity' \
6523 COMPREPLY=( $( compgen -W 'None BZip Fax Group4 JPEG \
6524 Lossless LZW RLE Zip' -- $cur ) )
6528 COMPREPLY=( $( compgen -W 'Undefined None Background \
6529 Previous' -- $cur ) )
6533 COMPREPLY=( $( compgen -W 'AdobeCustom AdobeExpert \
6534 AdobeStandard AppleRoman BIG5 GB2312 Latin2 \
6535 None SJIScode Symbol Unicode Wansung' -- $cur))
6539 COMPREPLY=( $( compgen -W 'MSB LSB' -- $cur ) )
6543 COMPREPLY=( $( compgen -W 'Point Box Triangle Hermite \
6544 Hanning Hamming Blackman Gaussian Quadratic \
6545 Cubic Catrom Mitchell Lanczos Bessel Sinc' \
6550 COMPREPLY=( $( convert -list format | \
6551 awk '/ [r-][w-][+-] / {print $1}' | \
6552 tr -d '*' | tr [:upper:] [:lower:] | \
6557 COMPREPLY=( $( compgen -W 'Northwest North NorthEast \
6558 West Center East SouthWest South SouthEast' \
6563 COMPREPLY=( $( compgen -W 'Absolute Perceptual \
6564 Relative Saturation' -- $cur ) )
6568 COMPREPLY=( $( compgen -W 'None Line Plane Partition' \
6573 COMPREPLY=( $( compgen -W 'Disk File Map Memory' \
6578 COMPREPLY=( $( compgen -W 'Delegate Format Magic \
6579 Module Resource Type' -- $cur ) )
6583 COMPREPLY=( $( compgen -W 'best default gray red \
6584 green blue' -- $cur ) )
6589 COMPREPLY=( $( compgen -W 'Uniform Gaussian \
6591 Impulse Laplacian Poisson' -- $cur ) )
6595 COMPREPLY=( $( compgen -W 'Rotate Shear Roll Hue \
6596 Saturation Brightness Gamma Spiff \
6597 Dull Grayscale Quantize Despeckle \
6598 ReduceNoise AddNoise Sharpen Blur \
6599 Treshold EdgeDetect Spread Shade \
6600 Raise Segment Solarize Swirl Implode \
6601 Wave OilPaint CharcoalDrawing JPEG' \
6605 -@(mask|profile|texture|tile|write))
6610 COMPREPLY=( $( compgen -W 'Bilevel Grayscale Palette \
6611 PaletteMatte TrueColor TrueColorMatte \
6612 ColorSeparation ColorSeparationlMatte \
6613 Optimize' -- $cur ) )
6617 COMPREPLY=( $( compgen -W 'Undefined PixelsPerInch \
6618 PixelsPerCentimeter' -- $cur ) )
6622 COMPREPLY=( $( compgen -W 'Constant Edge mirror tile' \
6627 COMPREPLY=( $( compgen -W 'StaticGray GrayScale \
6628 StaticColor PseudoColor TrueColor \
6629 DirectColor defaut visualid' -- $cur ))
6644 if [[ "$cur" == -* ]]; then
6645 COMPREPLY=( $( compgen -W '-adjoin -affine -antialias -append \
6646 -authenticate -average -background -black-threshold \
6647 -blue-primary -blur -border -bordercolor -channel \
6648 -charcoal -chop -clip -coalesce -colorize -colors \
6649 -colorspace -comment -compress -contrast -convolve \
6650 -crop -cycle -debug -deconstruct -delay -density \
6651 -depth -despeckle -display -dispose -dither -draw \
6652 -edge -emboss -encoding -endian -enhance -equalize \
6653 -extract -fill -filter -flatten -flip -flop -font \
6654 -frame -fuzz -gamma -gaussian -geometry \
6655 -green-primary -gravity -help -implode -intent \
6656 -interlace -label -lat -level -limit -list -log -loop \
6657 -map -mask -matte -median -modulate -monochrome \
6658 -morph -mosaic -negate -noop -noise -normalize \
6659 -opaque -ordered-dither -page -paint -ping -pointsize \
6660 -preview -profile -quality -raise -random-threshold \
6661 -region -raise -red-primary -render -resize -resample \
6662 -roll -rotate -sample -sampling-factor -scale -scene \
6663 -seed -segment -shade -sharpen -shave -shear -size \
6664 -solarize -spread -stroke -strokewidth -swirl \
6665 -texture -threshold -thumbnail -tile -transform \
6666 -transparent -treedepth -trim -type -undercolor \
6667 -units -unsharp -verbose -version -view \
6668 -virtual-pixel -wave -white-point -white-threshold \
6670 elif [[ "$cur" == +* ]]; then
6671 COMPREPLY=( $( compgen -W '+adjoin +append +compress \
6672 +contrast +debug +dither +endian +gamma +label +map \
6673 +mask +matte +negate +noise +page +raise +render \
6679 complete -F _convert $filenames convert
6690 if [[ "$cur" == -* ]]; then
6691 COMPREPLY=( $( compgen -W '-affine -antialias -authenticate \
6692 -background -black-threshold -blue-primary -blur \
6693 -border -bordercolor -channel -charcoal -chop \
6694 -colorize -colors -colorspace -comment -compress \
6695 -contrast -convolve -crop -cycle -debug -delay \
6696 -density -depth -despeckle -display -dispose -dither \
6697 -draw -edge -emboss -encoding -endian -enhance \
6698 -equalize -extract -fill -filter -flip -flop -font \
6699 -format -frame -fuzz -gamma -gaussian -geometry \
6700 -green-primary -implode -interlace -help -label -lat \
6701 -level -limit -list -log -loop -map -mask -matte \
6702 -median -modulate -monochrome -negate -noop \
6703 -normalize -opaque -page -paint -fill -ordered-dither \
6704 -pointsize -profile -quality -raise -random-threshold \
6705 -red-primary -region -resample -resize -roll -rotate \
6706 -sample -sampling-factor -scale -scene -seed -segment \
6707 -shade -sharpen -shear -size -solarize -spread \
6708 -stroke -strokewidth -swirl -texture -threshold \
6709 -thumbnail -tile -transform -transparent -treedepth \
6710 -trim -type -undercolor -units -unsharp -verbose \
6711 -version -view -virtual-pixel -wave -white-point \
6712 -white-threshold' -- $cur ) )
6713 elif [[ "$cur" == +* ]]; then
6714 COMPREPLY=( $( compgen -W '+compress +contrast +debug +dither \
6715 +endian +gamma +label +map +mask +matte +negate +page \
6721 complete -F _mogrify $filenames mogrify
6732 if [[ "$cur" == -* ]]; then
6733 COMPREPLY=( $( compgen -W '-authenticate -backdrop -border \
6734 -colormap -colors -colorspace -comment -compress \
6735 -contrast -crop -debug -delay -density -depth \
6736 -despeckle -display -dispose -dither -edge -endian \
6737 -enhance -extract -filter -flip -flop -frame -gamma \
6738 -geometry -help -immutable -interlace -label -limit \
6739 -log -map -matte -monochrome -negate -noop -page \
6740 -quality -raise -remote -roll -rotate -sample \
6741 -sampling-factor -scene -segment -sharpen -size \
6742 -texture -treedepth -trim -update -verbose -version \
6743 -virtual-pixel -window -window_group -write' -- $cur))
6744 elif [[ "$cur" == +* ]]; then
6745 COMPREPLY=( $( compgen -W '+compress +contrast +debug +dither \
6746 +endian +gamma +label +map +matte +negate +page \
6747 +raise +write' -- $cur ) )
6752 complete -F _display $filenames display
6763 if [[ "$cur" == -* ]]; then
6764 COMPREPLY=( $( compgen -W '-authenticate -backdrop -colormap \
6765 -colors -colorspace -crop -debug -delay -density \
6766 -depth -display -dither -extract -gamma -geometry \
6767 -help -interlace -limit -log -matte -map -monochrome \
6768 -noop -pause -remote -rotate -sampling-factor -scene \
6769 -size -treedepth -trim -verbose -version -visual \
6770 -virtual-pixel -window' -- $cur ) )
6771 elif [[ "$cur" == +* ]]; then
6772 COMPREPLY=( $( compgen -W '+debug +dither +gamma +map +matte' -- $cur ) )
6777 complete -F _animate $filenames animate
6788 if [[ "$cur" == -* ]]; then
6789 COMPREPLY=( $( compgen -W '-authenticate -debug -density \
6790 -depth -extract -format -help -interlace -limit -list \
6791 -log -size -sampling-factor -verbose -version \
6792 -virtual-pixel' -- $cur ) )
6793 elif [[ "$cur" == +* ]]; then
6794 COMPREPLY=( $( compgen -W '+debug ' -- $cur ) )
6799 complete -F _identify $filenames identify
6810 if [[ "$cur" == -* ]]; then
6811 COMPREPLY=( $( compgen -W '-adjoin -affine -authenticate \
6812 -blue-primary -blur -colors -colorspace -comment \
6813 -compose -compress -crop -debug -density -depth \
6814 -display -dispose -dither -draw -encoding -endian \
6815 -extract -fill -filter -flip -flop -frame -gamma \
6816 -geometry -gravity -green-primary -interlace -help \
6817 -label -limit -log -matte -mode -monochrome -noop \
6818 -page -pointsize -quality -red-primary -resize \
6819 -rotate -sampling-factor -scene -shadow -size \
6820 -stroke -texture -thumbnail -tile -transform \
6821 -transparent -treedepth -trim -type -verbose \
6822 -version -virtual-pixel -white-point' -- $cur ) )
6823 elif [[ "$cur" == +* ]]; then
6824 COMPREPLY=( $( compgen -W '+adjoin +compress +debug +dither \
6825 +endian +gamma +label +matte +page' -- $cur ) )
6830 complete -F _montage $filenames montage
6841 if [[ "$cur" == -* ]]; then
6842 COMPREPLY=( $( compgen -W '-affine -authenticate \
6843 -blue-primary -colors -colorspace -comment -compose \
6844 -compress -debug -density -depth -displace -display \
6845 -dispose -dissolve -dither -encoding -endian -extract \
6846 -filter -font -geometry -gravity -green-primary -help \
6847 -interlace -label -limit -log -matte -monochrome \
6848 -negate -page -profile -quality -red-primary -rotate \
6849 -resize -sampling-factor -scene -sharpen -size \
6850 -stegano -stereo -thumbnail -tile -transform \
6851 -treedepth -type -units -unsharp -verbose -version \
6852 -virtual-pixel -watermark -white-point -write' \
6854 elif [[ "$cur" == +* ]]; then
6855 COMPREPLY=( $( compgen -W '+compress +debug +dither +endian +label \
6856 +matte +negate +page +write' -- $cur ) )
6861 complete -F _composite $filenames composite
6882 COMPREPLY=( $( compgen -W 'ascii ebcdic ibm block unblock \
6883 lcase notrunc ucase swab noerror sync' \
6891 COMPREPLY=( $( compgen -W '--help --version' -- $cur ) \
6892 $( compgen -W 'bs cbs conv count ibs if obs of seek skip'\
6895 complete -F _dd $nospace $filenames dd
6897 # CUPS cancel(1) completion
6907 COMPREPLY=( $( lpstat | cut -d' ' -f1 | grep "^$cur" ) )
6909 complete -F _cancel $filenames cancel
6911 # aspell(1) completion
6914 _aspell_dictionary()
6917 datadir=/usr/lib/aspell
6918 COMPREPLY=( $( command ls $datadir/*.@(multi|alias) ) )
6919 COMPREPLY=( ${COMPREPLY[@]%.@(multi|alias)} )
6920 COMPREPLY=( $( compgen -W '${COMPREPLY[@]#$datadir/}' -- $cur ) )
6929 prev=${COMP_WORDS[COMP_CWORD-1]}
6931 # --name value style option
6937 @(dump|create|merge))
6938 COMPREPLY=( $( compgen -W 'master personal repl' -- $cur ) )
6947 # --name=value style option
6948 if [[ "$cur" == *=* ]]; then
6952 --@(conf|personal|repl|per-conf))
6956 --@(conf-dir|data-dir|dict-dir|home-dir|local-data-dir|prefix))
6965 COMPREPLY=( $( compgen -W 'none url email sgml tex' -- $cur ) )
6969 COMPREPLY=( $( compgen -W 'ultra fast normal bad-speller' -- $cur ) )
6973 COMPREPLY=( $( compgen -W 'aspell ispell' -- $cur ) )
6979 if [[ "$cur" == -* ]]; then
6980 COMPREPLY=( $( compgen -W '--conf= --conf-dir= --data-dir= --dict-dir= \
6981 --encoding= --add-filter= --rem-filter= --mode= -e \
6982 -H -t --add-extra-dicts= --rem-extra-dicts= \
6983 --home-dir= -W --ignore= --ignore-accents \
6984 --dont-ignore-accents --ignore-case --dont-ignore-case \
6985 --ignore-repl --dont-ignore-repl --jargon= --keyboard= \
6986 --lang= --language-tag= --local-data-dir= -d --master= \
6987 --module= --add-module-search-order= \
6988 --rem-module-search-order= --per-conf= -p --personal= \
6989 --prefix= --repl= -C -B --run-together --dont-run-together \
6990 --run-together-limit= --run-together-min= --save-repl \
6991 --dont-save-repl --set-prefix --dont-set-prefix --size= \
6992 --spelling= --strip-accents --dont-strip-accents \
6993 --sug-mode= --add-word-list-path= --rem-word-list-path= \
6994 -b -x --backup -b|-x --dont-backup --reverse --dont-reverse \
6995 --time --dont-time --keymapping= --add-email-quote= \
6996 --rem-email-quote= --email-margin= --add-tex-command= \
6997 --rem-tex-command= --tex-check-comments \
6998 --dont-tex-check-comments --add-tex-extension= \
6999 --rem-tex-extension= --add-sgml-check= --rem-sgml-check= \
7000 --add-sgml-extension= --rem-sgml-extension=' -- $cur ) )
7002 COMPREPLY=( $( compgen -W '-? help -c check -a pipe -l list \
7003 config config soundslike filter -v version dump \
7004 create merge' -- $cur ) )
7008 complete -F _aspell $filenames aspell
7011 # xmms(1) completion
7021 if [[ "$cur" == -* ]]; then
7022 COMPREPLY=( $( compgen -W '-h --help -r --rew -p --play \
7023 -u --pause -s --stop -t --play-pause -f --fwd -e \
7024 --enqueue -m --show-main-window -i --sm-client-id \
7025 -v --version' -- $cur ) )
7027 _filedir '@(mp[23]|MP[23]|ogg|OGG|wav|WAV|pls|m3u|xm|mod|s[3t]m|it|mtm|ult|flac)'
7032 complete -F _xmms $filenames xmms
7034 # info(1) completion
7039 local cur infopath UNAME
7046 # default completion if parameter contains /
7047 if [[ "$cur" == */* ]]; then
7052 infopath='/usr/share/info'
7054 if [ "${INFOPATH: -1:1}" == ':' ]; then
7055 infopath=${INFOPATH}${infopath}
7056 elif [ ${INFOPATH:+set} ]; then
7061 if [ -n "$cur" ]; then
7062 infopath="${infopath//://$cur* }"
7064 infopath="${infopath//:// }"
7067 # redirect stderr for when path doesn't exist
7068 COMPREPLY=( $( eval command ls "$infopath" 2>/dev/null ) )
7069 # weed out directory path names and paths to info pages
7070 COMPREPLY=( ${COMPREPLY[@]##*/?(:)} )
7071 # weed out info dir file
7072 for (( i=0 ; i < ${#COMPREPLY[@]} ; ++i )); do
7073 if [ "${COMPREPLY[$i]}" == 'dir' ]; then
7074 unset COMPREPLY[$i];
7077 # strip suffix from info pages
7078 COMPREPLY=( ${COMPREPLY[@]%.@(gz|bz2)} )
7079 COMPREPLY=( $( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" ) )
7083 complete -F _info $filenames info
7085 # dhclient(1) completion
7087 have dhclient && _dhclient()
7093 prev=${COMP_WORDS[COMP_CWORD-1]}
7106 if [[ "$cur" == -* ]]; then
7107 COMPREPLY=( $( compgen -W '-p -d -q -1 -r -lf -pf \
7108 -cf -sf -s -g -n -nw -w' -- $cur ) )
7110 _available_interfaces
7113 complete -F _dhclient dhclient
7120 COMPREPLY=( $(compgen -W "$( vgscan 2>/dev/null | \
7121 sed -n -e 's|.*Found.*"\(.*\)".*$|\1|p' )" -- $cur ) )
7126 COMPREPLY=( $(compgen -W "$( pvscan 2>/dev/null | \
7127 sed -n -e 's|^.*PV \(.*\) VG.*$|\1|p' )" -- $cur ) )
7132 COMPREPLY=( $(compgen -W "$( lvscan 2>/dev/null | \
7133 sed -n -e "s|^.*'\(.*\)'.*$|\1|p" )" -- $cur ) )
7138 COMPREPLY=( $( compgen -W 'h s b k m g t H K M G T' -- $cur ) )
7143 COMPREPLY=( $( compgen -W 'k K m M g G t T' -- $cur ) )
7149 if [[ "${COMP_WORDS[0]}" == lvm ]]; then
7154 for (( i=$offset; i < COMP_CWORD; i++ )); do
7155 if [[ "${COMP_WORDS[i]}" != -* ]]; then
7168 if [[ "$cur" == -* ]]; then
7169 COMPREPLY=( $( compgen -W '-d --debug -h -? --help -l \
7170 --lvmpartition -v --verbose --version' -- $cur ) )
7173 complete -F _lvmdiskscan lvmdiskscan
7182 if [[ "$cur" == -* ]]; then
7183 COMPREPLY=( $( compgen -W '-d --debug -e \
7184 --exported -n --novolumegroup -h -? \
7185 --help --ignorelockingfailure -P \
7186 --partial -s --short -u --uuid -v \
7187 --verbose --version' -- $cur ) )
7190 complete -F _pvscan pvscan
7198 prev=${COMP_WORDS[COMP_CWORD-1]}
7201 -@(o|O|-options|-sort))
7202 COMPREPLY=( $( compgen -W 'pv_fmt pv_uuid \
7203 pv_size pv_free pv_used pv_name \
7204 pv_attr pv_pe_count \
7205 pv_pe_alloc_count' -- $cur ) )
7214 if [[ "$cur" == -* ]]; then
7215 COMPREPLY=( $( compgen -W '--aligned -a --all -d --debug \
7216 -h -? --help --ignorelockingfailure --noheadings \
7217 --nosuffix -o --options -O --sort \
7218 --separator --unbuffered --units \
7219 -v --verbose --version' -- $cur ) )
7224 complete -F _pvs pvs
7232 prev=${COMP_WORDS[COMP_CWORD-1]}
7241 if [[ "$cur" == -* ]]; then
7242 COMPREPLY=( $( compgen -W '-c --colon -C --columns --units \
7243 -v --verbose -d --debug -h --help --version' -- $cur ) )
7248 complete -F _pvdisplay pvdisplay
7256 prev=${COMP_WORDS[COMP_CWORD-1]}
7259 -@(A|x|-autobackup|--allocatable))
7260 COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
7265 if [[ "$cur" == -* ]]; then
7266 COMPREPLY=( $( compgen -W '-a --all -A --autobackup \
7267 -d --debug -h --help -t --test -u --uuid -x \
7268 --allocatable -v --verbose --addtag --deltag \
7269 --version' -- $cur ) )
7274 complete -F _pvchange pvchange
7282 prev=${COMP_WORDS[COMP_CWORD-1]}
7289 -@(M|-metadatatype))
7290 COMPREPLY=( $( compgen -W '1 2' -- $cur ) )
7294 COMPREPLY=( $( compgen -W '0 1 2' -- $cur ) )
7297 --@(metadatasize|setphysicalvolumesize))
7303 if [[ "$cur" == -* ]]; then
7304 COMPREPLY=( $( compgen -W '--restorefile -d --debug -f \
7305 --force -h -? --help --labelsector -M --metadatatype \
7306 --metadatacopies --metadatasize \
7307 --setphysicalvolumesize -t --test -u --uuid uuid -v \
7308 --verbose -y --yes --version' -- $cur ) )
7313 complete -F _pvcreate pvcreate
7321 prev=${COMP_WORDS[COMP_CWORD-1]}
7325 COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
7333 if [[ "$cur" == -* ]]; then
7334 COMPREPLY=( $( compgen -W '--abort -A --autobackup \
7335 -b --background -d --debug -f --force -h -? \
7336 --help -i --interval -t --test -v --verbose \
7337 --version -n --name' -- $cur ) )
7342 complete -F _pvmove pvmove
7351 if [[ "$cur" == -* ]]; then
7352 COMPREPLY=( $( compgen -W '-d --debug -f --force -h -? \
7353 --help -y --yes -t --test -v --verbose \
7354 --version' -- $cur ) )
7359 complete -F _pvremove pvremove
7368 if [[ "$cur" == -* ]]; then
7369 COMPREPLY=( $( compgen -W '-d --debug -h --help \
7370 --ignorelockingfailure --mknodes -P \
7371 --partial -v --verbose --version' -- $cur ) )
7374 complete -F _vgscan vgscan
7382 prev=${COMP_WORDS[COMP_CWORD-1]}
7385 -@(o|O|-options|-sort))
7386 COMPREPLY=( $( compgen -W 'vg_fmt vg_uuid vg_name \
7387 vg_attr vg_size vg_free vg_sysid \
7388 vg_extent_size vg_extent_count vg_free_count \
7389 max_lv max_pv pv_count lv_count snap_count \
7390 vg_seqno' -- $cur ) )
7399 if [[ "$cur" == -* ]]; then
7400 COMPREPLY=( $( compgen -W '--aligned -d --debug \
7401 -h --help --ignorelockingfailure --noheadings \
7402 --nosuffix -o --options -O --sort -P --partial \
7403 --separator --unbuffered --units \
7404 -v --verbose --version' -- $cur ) )
7409 complete -F _vgs vgs
7417 prev=${COMP_WORDS[COMP_CWORD-1]}
7426 if [[ "$cur" == -* ]]; then
7427 COMPREPLY=( $( compgen -W '-c --colon -C --columns --units \
7428 -P --partial -A --activevolumegroups -v --verbose \
7429 -d --debug -h --help --version' -- $cur ) )
7434 complete -F _vgdisplay vgdisplay
7442 prev=${COMP_WORDS[COMP_CWORD-1]}
7445 -@(a|A|x|-available|-autobackup|-resizeable))
7446 COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
7451 if [[ "$cur" == -* ]]; then
7452 COMPREPLY=( $( compgen -W '-A --autobackup --alloc -P \
7453 --partial -d --debug -h --help --ignorelockingfailure \
7454 -t --test -u --uuid -v --verbose --version -a \
7455 --available -x --resizeable -l --logicalvolume \
7456 --addtag --deltag' -- $cur ) )
7461 complete -F _vgchange vgchange
7469 prev=${COMP_WORDS[COMP_CWORD-1]}
7473 COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
7476 -@(M|-metadatatype))
7477 COMPREPLY=( $( compgen -W '1 2' -- $cur ) )
7480 -@(s|-physicalextentsize))
7486 if [[ "$cur" == -* ]]; then
7487 COMPREPLY=( $( compgen -W '-A --autobackup --addtag \
7488 --alloc -d --debug -h --help -l --maxlogicalvolumes \
7489 -M --metadatatype -p --maxphysicalvolumes -s \
7490 --physicalextentsize -t --test -v --verbose \
7491 --version' -- $cur ) )
7494 if [ $args -eq 0 ]; then
7501 complete -F _vgcreate vgcreate
7510 if [[ "$cur" == -* ]]; then
7511 COMPREPLY=( $( compgen -W '-d --debug -h --help -t --test \
7512 -v --verbose --version' -- $cur ) )
7517 complete -F _vgremove vgremove
7525 prev=${COMP_WORDS[COMP_CWORD-1]}
7529 COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
7534 if [[ "$cur" == -* ]]; then
7535 COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -h \
7536 -? --help -t --test -v --verbose --version' -- $cur ) )
7541 complete -F _vgrename vgrename
7549 prev=${COMP_WORDS[COMP_CWORD-1]}
7553 COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
7558 if [[ "$cur" == -* ]]; then
7559 COMPREPLY=( $( compgen -W '-a --all -A --autobackup -d \
7560 --debug -h --help --removemissing -t --test -v \
7561 --verbose --version' -- $cur ) )
7565 if [ $args -eq 0 ]; then
7572 complete -F _vgreduce vgreduce
7580 prev=${COMP_WORDS[COMP_CWORD-1]}
7584 COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
7593 if [[ "$cur" == -* ]]; then
7594 COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -h \
7595 -? --help -t --test -v --verbose --version' -- $cur ) )
7598 if [ $args -eq 0 ]; then
7605 complete -F _vgextend vgextend
7614 if [[ "$cur" == -* ]]; then
7615 COMPREPLY=( $( compgen -W '-a --all -d --debug -h \
7616 -? --help -v --verbose --version' -- $cur ) )
7621 complete -F _vgport vgimport vgexport
7630 if [[ "$cur" == -* ]]; then
7631 COMPREPLY=( $( compgen -W '-d --debug -h \
7632 -? --help -v --verbose --version' -- $cur ) )
7637 complete -F _vgck vgck
7645 prev=${COMP_WORDS[COMP_CWORD-1]}
7648 -@(M|-metadatatype))
7649 COMPREPLY=( $( compgen -W '1 2' -- $cur ) )
7653 COMPREPLY=( $( compgen -W '0 1 2' -- $cur ) )
7662 if [[ "$cur" == -* ]]; then
7663 COMPREPLY=( $( compgen -W '-d --debug -h --help --labelsector \
7664 -M --metadatatype --metadatacopies --metadatasize \
7665 -t --test -v --verbose --version' -- $cur ) )
7670 complete -F _vgconvert vgconvert
7678 prev=${COMP_WORDS[COMP_CWORD-1]}
7687 if [[ "$cur" == -* ]]; then
7688 COMPREPLY=( $( compgen -W '-d --debug -f --file -h --help \
7689 --ignorelockingfailure -P --partial -v --verbose \
7690 --version' -- $cur ) )
7695 complete -F _vgcfgbackup vgcfgbackup
7703 prev=${COMP_WORDS[COMP_CWORD-1]}
7710 -@(M|-metadatatype))
7711 COMPREPLY=( $( compgen -W '1 2' -- $cur ) )
7720 if [[ "$cur" == -* ]]; then
7721 COMPREPLY=( $( compgen -W '-d --debug -f --file -l --list \
7722 -h --help -M --Metadatatype -n --name -t --test \
7723 -v --verbose --version' -- $cur ) )
7728 complete -F _vgcfgrestore vgcfgrestore
7736 prev=${COMP_WORDS[COMP_CWORD-1]}
7740 COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
7745 if [[ "$cur" == -* ]]; then
7746 COMPREPLY=( $( compgen -W '-A --autobackup -d --debug \
7747 -h --help -l --list -t --test -v --verbose \
7748 --version' -- $cur ) )
7753 complete -F _vgmerge vgmerge
7761 prev=${COMP_WORDS[COMP_CWORD-1]}
7765 COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
7768 -@(M|-metadatatype))
7769 COMPREPLY=( $( compgen -W '1 2' -- $cur ) )
7774 if [[ "$cur" == -* ]]; then
7775 COMPREPLY=( $( compgen -W '-A --autobackup -d --debug \
7776 -h --help -l --list -M --metadatatype -t --test \
7777 -v --verbose --version' -- $cur ) )
7780 if [ $args -eq 0 -o $args -eq 1 ]; then
7787 complete -F _vgsplit vgsplit
7796 if [[ "$cur" == -* ]]; then
7797 COMPREPLY=( $( compgen -W '-d --debug -h --help -v --verbose \
7798 --version' -- $cur ) )
7803 complete -F _vgmknodes vgmknodes
7812 if [[ "$cur" == -* ]]; then
7813 COMPREPLY=( $( compgen -W '-b --blockdevice -d --debug \
7814 -h -? --help --ignorelockingfailure -P \
7815 --partial -v --verbose --version' -- $cur ) )
7818 complete -F _lvscan lvscan
7826 prev=${COMP_WORDS[COMP_CWORD-1]}
7829 -@(o|O|-options|-sort))
7830 COMPREPLY=( $( compgen -W 'lv_uuid lv_name \
7831 lv_attr lv_minor lv_size seg_count \
7832 origin snap_percent segtype stripes \
7833 stripesize chunksize seg_start \
7834 seg_size' -- $cur ) )
7843 if [[ "$cur" == -* ]]; then
7844 COMPREPLY=( $( compgen -W '--aligned -d --debug \
7845 -h --help --ignorelockingfailure --noheadings \
7846 --nosuffix -o --options -O --sort -P --partial \
7847 --segments --separator --unbuffered --units \
7848 -v --verbose --version' -- $cur ) )
7853 complete -F _lvs lvs
7861 prev=${COMP_WORDS[COMP_CWORD-1]}
7870 if [[ "$cur" == -* ]]; then
7871 COMPREPLY=( $( compgen -W '-c --colon -C --columns --units \
7872 -P --partial -m --maps -v --verbose -d --debug -h \
7873 --help --version' -- $cur ) )
7878 complete -F _lvdisplay lvdisplay
7886 prev=${COMP_WORDS[COMP_CWORD-1]}
7889 -@(a|A|C|M|-available|-autobackup|-continguous|-persistent))
7890 COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
7894 COMPREPLY=( $( compgen -W 'r rw' -- $cur ) )
7899 if [[ "$cur" == -* ]]; then
7900 COMPREPLY=( $( compgen -W '-A --autobackup -a --available \
7901 --addtag --alloc -C --contiguous -d --debug --deltag \
7902 -f --force -h --help --ignorelockingfailure -M \
7903 --persistent --major major --minor minor -P --partial \
7904 -p --permission -r --readahead --refresh -t --test \
7905 -v --verbose --version' -- $cur ) )
7910 complete -F _lvchange lvchange
7918 prev=${COMP_WORDS[COMP_CWORD-1]}
7921 -@(A|C|M|Z|-autobackup|-continguous|-persistent|-zero))
7922 COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
7930 COMPREPLY=( $( compgen -W 'r rw' -- $cur ) )
7939 if [[ "$cur" == -* ]]; then
7940 COMPREPLY=( $( compgen -W '-A --autobackup --addtag --alloc \
7941 -C --contiguous -d --debug -h -? --help -i --stripes \
7942 -I --stripesize -l --extents -L --size -M --persistent \
7943 --major --minor -n --name -p --permission -r \
7944 --readahead -t --test --type -v --verbose -Z --zero \
7945 --version' -- $cur ) )
7948 if [ $args -eq 0 ]; then
7955 complete -F _lvcreate lvcreate
7963 prev=${COMP_WORDS[COMP_CWORD-1]}
7967 COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
7972 if [[ "$cur" == -* ]]; then
7973 COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -f \
7974 --force -h -? --help -t --test -v --verbose \
7975 --version' -- $cur ) )
7980 complete -F _lvremove lvremove
7988 prev=${COMP_WORDS[COMP_CWORD-1]}
7992 COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
7997 if [[ "$cur" == -* ]]; then
7998 COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -h \
7999 -? --help -t --test -v --verbose --version' -- $cur ) )
8004 complete -F _lvrename lvrename
8012 prev=${COMP_WORDS[COMP_CWORD-1]}
8016 COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
8025 if [[ "$cur" == -* ]]; then
8026 COMPREPLY=( $( compgen -W '-A --autobackup -d \
8027 --debug -f --force -h --help -l --extents \
8028 -L --size -n --nofsck -r --resizefs -t --test \
8029 -v --verbose --version' -- $cur ) )
8034 complete -F _lvreduce lvreduce
8042 prev=${COMP_WORDS[COMP_CWORD-1]}
8046 COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
8055 if [[ "$cur" == -* ]]; then
8056 COMPREPLY=( $( compgen -W '-A --autobackup --alloc -d \
8057 --debug -h --help -i --stripes -I --stripesize \
8058 -l --extents -L --size -n --nofsck -r --resizefs \
8059 -t --test --type -v --verbose --version' -- $cur ) )
8062 if [ $args -eq 0 ]; then
8069 complete -F _lvresize lvresize
8077 prev=${COMP_WORDS[COMP_CWORD-1]}
8081 COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
8090 if [[ "$cur" == -* ]]; then
8091 COMPREPLY=( $( compgen -W '-A --autobackup --alloc -d \
8092 --debug -h --help -i --stripes -I --stripesize \
8093 -l --extents -L --size -n --nofsck -r --resizefs \
8094 -t --test --type -v --verbose --version' -- $cur ) )
8097 if [ $args -eq 0 ]; then
8104 complete -F _lvextend lvextend
8113 if [ $COMP_CWORD -eq 1 ]; then
8114 COMPREPLY=( $( compgen -W 'dumpconfig help lvchange \
8115 lvcreate lvdisplay lvextend lvmchange \
8116 lvmdiskscan lvmsadc lvmsar lvreduce \
8117 lvremove lvrename lvresize lvs lvscan \
8118 pvchange pvcreate pvdata pvdisplay pvmove \
8119 pvremove pvresize pvs pvscan vgcfgbackup \
8120 vgcfgrestore vgchange vgck vgconvert \
8121 vgcreate vgdisplay vgexport vgextend \
8122 vgimport vgmerge vgmknodes vgreduce \
8123 vgremove vgrename vgs vgscan vgsplit \
8124 version' -- $cur ) )
8126 case ${COMP_WORDS[1]} in
8238 complete -F _lvm lvm
8241 # mkinitrd(8) completion
8250 prev=${COMP_WORDS[COMP_CWORD-1]}
8252 # --name value style option
8260 # --name=value style option
8261 if [[ "$cur" == *=* ]]; then
8281 if [[ "$cur" == -* ]]; then
8282 COMPREPLY=( $( compgen -W '--version -v -f --preload \
8283 --with= --omit-scsi-modules --omit-raid-modules \
8284 --images-version --fstab= --nocompress --builtin= \
8285 --nopivot --noudev --allow-missing --tmpdir= \
8286 --initrdfs= --dsdt= --lvm-version= --froce-usb' \
8296 COMPREPLY=( $( command ls /lib/modules | grep "^$cur" ) )
8302 complete -F _mkinitrd mkinitrd
8304 # pkgconfig(1) completion
8314 if [[ "$cur" == -* ]]; then
8315 # return list of available options
8316 COMPREPLY=( $( compgen -W '-version --modversion \
8317 --atleast-pkgconfig-version= --libs --libs-only-l \
8318 --libs-only-other --libs-only-L --cflags \
8319 --cflags-only-I --cflags-only-other --variable= \
8320 --define-variable= --exists --uninstalled \
8321 --atleast-version= --exact-version= --max-version= \
8322 --list-all --debug --print-errors --silence-errors \
8323 --errors-to-stdout -? --help --usage' -- $cur))
8325 COMPREPLY=( $( pkg-config --list-all 2>/dev/null | \
8326 awk '{print $1}' | grep "^$cur" ) )
8329 complete -F _pkg_config pkg-config
8332 # cpio(1) completion
8337 COMPREPLY=( $( compgen -W 'bin odc newc crc tar ustar hpbin hpodc' -- $cur ) )
8346 prev=${COMP_WORDS[COMP_CWORD-1]}
8348 # --name value style option
8364 # --name=value style option
8365 if [[ "$cur" == *=* ]]; then
8373 --@(file|pattern-file))
8382 COMPREPLY=( $( compgen -c -- $cur ) )
8388 if [ $COMP_CWORD -eq 1 ]; then
8389 COMPREPLY=( $( compgen -W '-o --create -i --extract -p --pass-through' -- $cur) )
8391 case ${COMP_WORDS[1]} in
8393 if [[ "$cur" == -* ]]; then
8394 COMPREPLY=( $( compgen -W '-0 -a -c -v -A -B\
8395 -L -V -C -H -M -O -F --file= --format=\
8396 --message= --null --reset-access-time\
8397 --verbose --dot --append --block-size=\
8398 --dereference --io-size= --quiet\
8399 --force-local --rsh-command= --help\
8400 --version' -- $cur ) )
8404 if [[ "$cur" == -* ]]; then
8405 COMPREPLY=( $( compgen -W '-b -c -d -f -m -n -r\
8406 -t -s -u -v -B -S -V -C -E -H -M -R -I\
8407 -F --file= --make-directories\
8409 --preserve-modification-time\
8410 --numeric-uid-gid --rename -t --list\
8411 --swap-bytes --swap --dot\
8412 --unconditional --verbose --block-size=\
8413 --swap-halfwords --io-size=\
8414 --pattern-file= --format= --owner=\
8415 --no-preserve-owner --message=\
8416 --force-local --no-absolute-filenames\
8417 --sparse --only-verify-crc --quiet\
8418 --rsh-command= --help\
8419 --version' -- $cur ) )
8422 -@(p|-pass-through))
8423 if [[ "$cur" == -* ]]; then
8424 COMPREPLY=( $( compgen -W '-0 -a -d -l -m -u -v\
8425 -L -V -R --null --reset-access-time\
8426 --make-directories --link --quiet\
8427 --preserve-modification-time\
8428 --unconditional --verbose --dot\
8429 --dereference --owner=\
8430 --no-preserve-owner --sparse --help\
8431 --version' -- $cur ) )
8439 complete -F _cpio cpio
8452 if [[ "$cur" == -* ]]; then
8453 COMPREPLY=( $( compgen -W '-a -g --group -G --groups -n --name\
8454 -r --real -u --user --help --version' -- $cur ) )
8456 COMPREPLY=( $( compgen -u $cur ) )
8461 # getent(1) completion
8470 prev=${COMP_WORDS[COMP_CWORD-1]}
8474 COMPREPLY=( $( compgen -u $cur ) )
8478 COMPREPLY=( $( compgen -g $cur ) )
8482 COMPREPLY=( $( compgen -s $cur ) )
8486 COMPREPLY=( $( compgen -A hostname $cur ) )
8490 COMPREPLY=( $( getent protocols | awk '{print $1}' | grep "^$cur" ) )
8494 COMPREPLY=( $( getent networks | awk '{print $1}' | grep "^$cur" ) )
8500 if [ $COMP_CWORD -eq 1 ]; then
8501 COMPREPLY=( $( compgen -W 'passwd group hosts services protocols networks' -- $cur ) )
8504 complete -F _getent getent
8506 # ntpdate(1) completion
8515 prev=${COMP_WORDS[COMP_CWORD-1]}
8523 COMPREPLY=( $( compgen -u $cur ) )
8528 if [[ "$cur" == -* ]]; then
8529 COMPREPLY=( $( compgen -W '-4 -6 -b -B -d -Q -q -s -u -v -a\
8530 -e -k -p -o -r -t' -- $cur ) )
8535 complete -F _ntpdate ntpdate
8537 # smartctl(8) completion
8540 _smartctl_quietmode()
8542 COMPREPLY=( $( compgen -W 'errorsonly silent' -- $cur ) )
8546 COMPREPLY=( $( compgen -W 'ata scsi 3ware' -- $cur ) )
8548 _smartctl_tolerance()
8550 COMPREPLY=( $( compgen -W 'warn exit ignore' -- $cur ) )
8554 COMPREPLY=( $( compgen -W 'normal conservative permissive verypermissive' -- $cur ) )
8558 COMPREPLY=( $( compgen -W 'ioctl ataioctl scsiioctl' -- $cur ) )
8562 COMPREPLY=( $( compgen -W 'on off' -- $cur ) )
8566 COMPREPLY=( $( compgen -W 'error selftest selective directory' -- $cur ) )
8568 _smartctl_vendorattribute()
8570 COMPREPLY=( $( compgen -W 'help 9,minutes 9,seconds 9,halfminutes \
8571 9,temp 192,emergencyretractcyclect 193,loadunload \
8572 194,10xCelsius 194,unknown 198,offlinescanuncsectorct \
8573 200,writeerrorcount 201,detectedtacount 220,temp' -- $cur ) )
8575 _smartctl_firmwarebug()
8577 COMPREPLY=( $( compgen -W 'none samsung samsung2' -- $cur ) )
8581 COMPREPLY=( $( compgen -W 'use ignore show showall' -- $cur ) )
8585 COMPREPLY=( $( compgen -W 'offline short long conveyance select afterselect,on afterselect,off pending' -- $cur ) )
8594 prev=${COMP_WORDS[COMP_CWORD-1]}
8596 # --name value style option
8634 _smartctl_vendorattribute
8638 _smartctl_firmwarebug
8651 # --name=value style option
8652 if [[ "$cur" == *=* ]]; then
8693 _smartctl_vendorattribute
8697 _smartctl_firmwarebug
8712 if [[ "$cur" == -* ]]; then
8713 COMPREPLY=( $( compgen -W '-h --help --usage -V --version \
8714 --copyright --license-i --info -a --all -q \
8715 --quietmode= -d --device= -T --tolerance= -b --badsum= \
8716 -r --report= -s --smart= -o --offlineauto= -S \
8717 --saveauto= -H --health -c --capabilities -A \
8718 --attributes -l --log= -v --vendorattribute= -F \
8719 --firmwarebug= -P --presets= -t --test= -C \
8720 --captive -X --abort' -- $cur ) )
8726 complete -F _smartctl smartctl
8729 # vncviewer(1) completion
8739 prev=${COMP_WORDS[COMP_CWORD-1]}
8746 # ssh into the the server, find and ping the broadcast address, then
8747 # sort and show the results.
8748 COMPREPLY=( $( ssh -o 'Batchmode yes' $prev \
8749 "ping -bnc 4 255.255.255.255" 2>/dev/null | \
8750 awk -F ' ' '{print $4}' | \
8751 sort -n | uniq | egrep '[0-9]+\.[0-9]+\.' 2>/dev/null ) )
8756 complete -F _vncviewer vncviewer
8758 # sysctl(8) completion
8768 COMPREPLY=( $( compgen -W "$(sysctl -N -a 2>/dev/null)" -- $cur ) )
8772 complete -F _sysctl sysctl
8774 # update-rc.d(8) completion
8776 # Copyright (C) 2004 Servilio Afre Puentes <servilio@gmail.com>
8781 local cur prev sysvdir services options valid_options
8784 prev=${COMP_WORDS[COMP_CWORD-1]}
8786 [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \
8787 || sysvdir=/etc/init.d
8789 services=( $(echo $sysvdir/!(README*|*.sh|*.dpkg*|*.rpm*)) )
8790 services=( ${services[@]#$sysvdir/} )
8793 if [[ $COMP_CWORD -eq 1 || "$prev" == -* ]]; then
8794 valid_options=( $( \
8795 echo "${COMP_WORDS[@]} ${options[@]}" \
8797 | sed -ne "/$( echo "${options[@]}" | sed "s/ /\\|/g" )/p" \
8800 COMPREPLY=( $( compgen -W '${options[@]} ${services[@]}' \
8801 -X '$( echo ${COMP_WORDS[@]} | tr " " "|" )' -- $cur ) )
8802 elif [[ "$prev" == ?($( echo ${services[@]} | tr " " "|" )) ]]; then
8803 COMPREPLY=( $( compgen -W 'remove defaults start stop' -- $cur ) )
8804 elif [[ "$prev" == defaults && "$cur" == [0-9] ]]; then
8805 COMPREPLY=( 0 1 2 3 4 5 6 7 8 9 )
8806 elif [[ "$prev" == defaults && "$cur" == [sk]?([0-9]) ]]; then
8807 COMPREPLY=( 0 1 2 3 4 5 6 7 8 9 )
8808 elif [[ "$prev" == defaults && -z "$cur" ]]; then
8809 COMPREPLY=( 0 1 2 3 4 5 6 7 8 9 s k )
8810 elif [[ "$prev" == ?(start|stop) ]]; then
8811 if [[ "$cur" == [0-9] || -z "$cur" ]]; then
8812 COMPREPLY=( 0 1 2 3 4 5 6 7 8 9 )
8813 elif [[ "$cur" == [0-9][0-9] ]]; then
8818 elif [[ "$prev" == ?([0-9][0-9]|[0-6S]) ]]; then
8819 if [[ -z "$cur" ]]; then
8820 if [[ $prev == [0-9][0-9] ]]; then
8821 COMPREPLY=( 0 1 2 3 4 5 6 S )
8823 COMPREPLY=( 0 1 2 3 4 5 6 S . )
8825 elif [[ "$cur" == [0-6S.] ]]; then
8830 elif [[ "$prev" == "." ]]; then
8831 COMPREPLY=( $(compgen -W "start stop" -- $cur) )
8838 complete -F _update_rc_d update-rc.d
8840 # invoke-rc.d(8) completion
8842 # Copyright (C) 2004 Servilio Afre Puentes <servilio@gmail.com>
8847 local cur prev sysvdir services options valid_options
8850 prev=${COMP_WORDS[COMP_CWORD-1]}
8852 [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \
8853 || sysvdir=/etc/init.d
8855 services=( $(echo $sysvdir/!(README*|*.sh|*.dpkg*|*.rpm*)) )
8856 services=( ${services[@]#$sysvdir/} )
8857 options=( --help --quiet --force --try-anyway --disclose-deny --query --no-fallback )
8859 if [[ ($COMP_CWORD -eq 1) || ("$prev" == --* ) ]]; then
8860 valid_options=( $( \
8861 echo ${COMP_WORDS[@]} ${options[@]} \
8863 | sed -ne "/$( echo ${options[@]} | sed "s/ /\\\\|/g" )/p" \
8866 COMPREPLY=( $( compgen -W '${valid_options[@]} ${services[@]}' -- \
8868 elif [ -x $sysvdir/$prev ]; then
8869 COMPREPLY=( $( compgen -W '`sed -ne "y/|/ /; \
8870 s/^.*Usage:[ ]*[^ ]*[ ]*{*\([^}\"]*\).*$/\1/p" \
8871 $sysvdir/$prev`' -- \
8879 complete -F _invoke_rc_d invoke-rc.d
8881 # minicom(1) completion
8890 prev=${COMP_WORDS[COMP_CWORD-1]}
8894 COMPREPLY=( $( compgen -W 'on off' -- $cur ) )
8902 COMPREPLY=( $( command ls /dev/tty* ) )
8903 COMPREPLY=( $( compgen -W '${COMPREPLY[@]} ${COMPREPLY[@]#/dev/}' -- $cur ) )
8909 if [[ "$cur" == -* ]]; then
8910 COMPREPLY=( $( compgen -W '-s -o -m -M -z -l -L -w -a -t \
8911 -c -S -d -p -C -T -8' -- $cur ) )
8913 COMPREPLY=( $( command ls /etc/minicom/minirc.* 2>/dev/null | sed -e 's|/etc/minicom/minirc.||' | grep "^$cur" ) )
8916 complete -F _minicom minicom
8924 local cur prev commands options command
8929 commands='add blame praise annotate ann cat checkout co cleanup commit \
8930 ci copy cp delete del remove rm diff di export help ? h import \
8931 info list ls lock log merge mkdir move mv rename ren \
8932 propdel pdel pd propedit pedit pe propget pget pg \
8933 proplist plist pl propset pset ps resolved revert \
8934 status stat st switch sw unlock update up'
8936 if [[ $COMP_CWORD -eq 1 ]] ; then
8937 if [[ "$cur" == -* ]]; then
8938 COMPREPLY=( $( compgen -W '--version' -- $cur ) )
8940 COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
8944 prev=${COMP_WORDS[COMP_CWORD-1]}
8950 -@(F|-file|-targets))
8955 COMPREPLY=( $( compgen -W \
8956 '$( iconv --list | sed -e "s@//@@;" )' \
8960 --@(editor|diff|diff3)-cmd)
8961 COMP_WORDS=(COMP_WORDS[0] $cur)
8968 command=${COMP_WORDS[1]}
8970 if [[ "$cur" == -* ]]; then
8971 # possible options for the command
8974 options='--auto-props --no-auto-props \
8975 --force --targets --no-ignore \
8976 --non-recursive -N -q --quiet'
8978 @(blame|annotate|ann|praise))
8979 options='-r --revisions --username \
8980 --password --no-auth-cache \
8981 --non-interactive -v \
8982 --verbose --incremental --xml'
8985 options='-r --revision --username \
8986 --password --no-auth-cache \
8990 options='-r --revision -q --quiet -N \
8991 --non-recursive --username \
8992 --password --no-auth-cache \
8997 options='--diff3-cmd'
9000 options='-m --message -F --file \
9001 --encoding --force-log -q \
9002 --quiet --non-recursive -N \
9003 --targets --editor-cmd \
9004 --username --password \
9006 --non-interactive --no-unlock'
9009 options='-m --message -F --file \
9010 --encoding --force-log -r \
9011 --revision -q --quiet \
9012 --editor-cmd -username \
9013 --password --no-auth-cache \
9016 @(delete|del|remove|rm))
9017 options='--force -m --message -F \
9018 --file --encoding --force-log \
9019 -q --quiet --targets \
9020 --editor-cmd -username \
9021 --password --no-auth-cache \
9025 options='-r --revision -x --extensions \
9026 --diff-cmd --no-diff-deleted \
9027 -N --non-recursive --username \
9028 --password --no-auth-cache \
9029 --non-interactive --force \
9030 --old --new --notice-ancestry'
9033 options='-r --revision -q --quiet \
9034 --username --password \
9036 --non-interactive -N \
9037 --non-recursive --force \
9038 --native-eol --ignore-externals'
9041 options='--auto-props --no-auto-props \
9042 -m --message -F --file \
9043 --encoding --force-log -q \
9044 --quiet --non-recursive \
9045 --no-ignore --editor-cmd \
9046 --username --password \
9051 options='--username --password \
9053 --non-interactive -r \
9054 --revision --xml --targets \
9055 -R --recursive --incremental'
9058 options='-r --revision -v --verbose -R \
9059 --recursive --username \
9060 --password --no-auth-cache \
9062 --incremental --xml'
9065 options='-m --message -F --file \
9066 --encoding --force-log \
9067 --targets --force --username \
9068 --password --no-auth-cache \
9072 options='-r --revision -v --verbose \
9073 --targets --username \
9074 --password --no-auth-cache \
9076 --stop-on-copy --incremental \
9077 --xml -q --quiet --limit'
9080 options='-r --revision -N \
9081 --non-recursive -q --quiet \
9082 --force --dry-run --diff3-cmd \
9083 --username --password \
9089 options='-m --message -F --file \
9090 --encoding --force-log -q \
9091 --quiet --editor-cmd \
9092 --username --password \
9096 @(move|mv|rename|ren))
9097 options='-m --message -F --file \
9098 --encoding --force-log -r \
9099 --revision -q --quiet \
9100 --force --editor-cmd \
9101 --username --password \
9106 options='-q --quiet -R --recursive -r \
9107 --revision --revprop \
9108 --username --password \
9112 @(propedit|pedit|pe))
9113 options='-r --revision --revprop \
9114 --encoding --editor-cmd \
9115 --username --password \
9117 --non-interactive --force'
9120 options='-R --recursive -r --revision \
9121 --revprop --strict --username \
9122 --password --no-auth-cache \
9125 @(proplist|plist|pl))
9126 options='-v --verbose -R --recursive \
9127 -r --revision --revprop -q \
9128 --quiet --username --password \
9133 options='-F --file -q --quiet \
9134 --targets -R --recursive \
9135 --revprop --encoding \
9136 --username --password \
9138 --non-interactive -r \
9142 options='--targets -R --recursive -q \
9146 options='--targets -R --recursive -q \
9150 options='-u --show-updates -v \
9151 --verbose -N --non-recursive \
9152 -q --quiet --username \
9153 --password --no-auth-cache \
9154 --non-interactive --no-ignore \
9155 --ignore-externals \
9156 --incremental --xml'
9159 options='--relocate -r --revision -N \
9160 --non-recursive -q --quiet \
9161 --username --password \
9163 --non-interactive --diff3-cmd'
9166 options='--targets --force --username \
9167 --password --no-auth-cache \
9171 options='-r --revision -N \
9172 --non-recursive -q --quiet \
9173 --username --password \
9176 --diff3-cmd --ignore-externals'
9179 options="$options --help -h --config-dir"
9181 COMPREPLY=( $( compgen -W "$options" -- $cur ) )
9183 if [[ "$command" == @(help|h|\?) ]]; then
9184 COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
9193 complete -F _svn $default svn
9197 local cur prev commands options mode
9202 commands='create deltify dump help ? hotcopy list-dblogs \
9203 list-unused-dblogs load lslocks lstxns recover rmlocks \
9204 rmtxns setlog verify'
9206 if [[ $COMP_CWORD -eq 1 ]] ; then
9207 if [[ "$cur" == -* ]]; then
9208 COMPREPLY=( $( compgen -W '--version' -- $cur ) )
9210 COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
9213 prev=${COMP_WORDS[COMP_CWORD-1]}
9220 COMPREPLY=( $( compgen -W 'fsfs bdb' -- $cur ) )
9225 command=${COMP_WORDS[1]}
9227 if [[ "$cur" == -* ]]; then
9228 # possible options for the command
9231 options='--bdb-txn-nosync \
9232 --bdb-log-keep --config-dir \
9236 options='-r --revision -q --quiet'
9239 options='-r --revision --incremental \
9240 -q --quiet --deltas'
9243 options='--clean-logs'
9246 options='--ignore-uuid --force-uuid \
9247 --parent-dir -q --quiet \
9248 --use-pre-commit-hook \
9249 --use-post-commit-hook'
9252 options='-q --quiet'
9255 options='-r --revision --bypass-hooks'
9259 options="$options --help -h"
9260 COMPREPLY=( $( compgen -W "$options" -- $cur ) )
9262 if [[ "$command" == @(help|h|\?) ]]; then
9263 COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
9272 complete -F _svnadmin $default svnadmin
9276 local cur prev commands options mode
9281 commands='author cat changed date diff dirs-changed help ? h history \
9282 info lock log propget pget pg proplist plist pl tree uuid \
9285 if [[ $COMP_CWORD -eq 1 ]] ; then
9286 if [[ "$cur" == -* ]]; then
9287 COMPREPLY=( $( compgen -W '--version' -- $cur ) )
9289 COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
9292 command=${COMP_WORDS[1]}
9294 if [[ "$cur" == -* ]]; then
9295 # possible options for the command
9297 @(author|cat|date|dirs-changed|info|log))
9298 options='-r --revision -t \
9302 options='-r --revision -t \
9303 --transaction --copy-info'
9306 options='-r --revision -t \
9313 options='-r --revision --show-ids'
9316 options='-r --revision -t \
9317 --transaction --revprop'
9320 options='-r --revision -t \
9321 --transaction --show-ids \
9326 options="$options --help -h"
9327 COMPREPLY=( $( compgen -W "$options" -- $cur ) )
9329 if [[ "$command" == @(help|h|\?) ]]; then
9330 COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
9339 complete -F _svnlook $default svnlook
9352 # get first exclusion compspec that matches this command
9353 xspec=$( sed -ne $'/^complete .*[ \t]'${1##*/}$'\([ \t]\|$\)/{p;q;}' \
9355 # prune to leave nothing but the -X spec
9361 while read -r tmp; do
9362 [[ -n $tmp ]] && toks[${#toks[@]}]=$tmp
9363 done < <( compgen -d -- "$(quote_readline "$cur")" )
9365 while read -r tmp; do
9366 [[ -n $tmp ]] && toks[${#toks[@]}]=$tmp
9367 done < <( eval compgen -f -X $xspec -- "\$(quote_readline "\$cur")" )
9369 COMPREPLY=( "${toks[@]}" )
9371 list=( $( sed -ne '/^# START exclude/,/^# FINISH exclude/p' \
9372 $BASH_COMPLETION | \
9373 # read exclusion compspecs
9377 # ignore compspecs that are commented out
9378 if [ "${line#\#}" != "$line" ]; then continue; fi
9379 line=${line%# START exclude*}
9380 line=${line%# FINISH exclude*}
9382 list=( "${list[@]}" $line )
9387 # remove previous compspecs
9388 if [ ${#list[@]} -gt 0 ]; then
9389 eval complete -r ${list[@]}
9390 # install new compspecs
9391 eval complete -F _filedir_xspec $filenames "${list[@]}"
9395 # source completion directory definitions
9396 if [ -d $BASH_COMPLETION_DIR -a -r $BASH_COMPLETION_DIR -a \
9397 -x $BASH_COMPLETION_DIR ]; then
9398 for i in $BASH_COMPLETION_DIR/*; do
9399 [[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|.rpm*) ]] &&
9400 [ \( -f $i -o -h $i \) -a -r $i ] && . $i
9405 # source user completion file
9406 [ $BASH_COMPLETION != ~/.bash_completion -a -r ~/.bash_completion ] \
9407 && . ~/.bash_completion
9409 unset UNAME RELEASE default dirnames filenames have nospace bashdefault \
9412 set $BASH_COMPLETION_ORIGINAL_V_VALUE
9413 unset BASH_COMPLETION_ORIGINAL_V_VALUE
9415 ### Local Variables:
9416 ### mode: shell-script