AUTO_SYMLINK=no BASH=/bin/bash BASH_COMPLETION=/etc/bash_completion BASH_COMPLETION_DIR=/etc/bash_completion.d BASH_VERSINFO=([0]="2" [1]="05b" [2]="0" [3]="1" [4]="release" [5]="i686-pc-linux-gnu") BASH_VERSION='2.05b.0(1)-release' CC=gcc CG_COMPILER_EXE=/usr/bin/cgc CLASSPATH=. COLORFGBG='15;0' COLORTERM=rxvt-xpm COLUMNS=110 CONFIG_PROTECT='/usr/lib/mozilla/defaults/pref /usr/X11R6/lib/X11/xkb /usr/kde/3.2/share/config /usr/share/config' CONFIG_PROTECT_MASK='/etc/gconf /etc/terminfo' CVS_RSH=ssh CXX=g++ DCCC_PATH=/usr/lib/distcc/bin DESKTOP_SESSION=XFCE4 DIRSTACK=() DISPLAY=:0.0 DISTCC_LOG= DISTCC_VERBOSE=0 EDITOR=/usr/bin/vim EUID=1000 GDK_USE_XFT=1 GDMSESSION=XFCE4 GLIBC_SSP_CHECKED=1 GROUPS=() GUILE_LOAD_PATH=/usr/share/guile/1.6 G_BROKEN_FILENAMES=1 HISTFILE=/home/egore/.bash_history HISTFILESIZE=500 HISTSIZE=500 HOME=/home/egore HOSTNAME=egore913 HOSTTYPE=i686 IFS=$' \t\n' INFODIR=/usr/share/info:/usr/X11R6/info INFOPATH=/usr/share/info:/usr/share/gcc-data/i686-pc-linux-gnu/3.3/info INPUTRC=/etc/inputrc JAVAC=/opt/blackdown-jdk-1.4.1/bin/javac JAVA_HOME=/opt/blackdown-jdk-1.4.1 JDK_HOME=/opt/blackdown-jdk-1.4.1 KBUILD_OUTPUT_PREFIX= KDEDIR=/usr/kde/3.2 KDEDIRS=/usr KSPLASH=/usr/bin/ksplash LANG=de_DE@euro LESS=-R LESSOPEN='|lesspipe.sh %s' LINES=25 LINGUAS=de LINUX_PORTAGE_WRITABLE=no LOGNAME=egore LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.png=01;35:*.mpg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:' MACHTYPE=i686-pc-linux-gnu MAILCHECK=60 MANPATH=/usr/share/man:/usr/local/share/man:/usr/share/gcc-data/i686-pc-linux-gnu/3.3/man:/usr/X11R6/man:/usr/share/man:/usr/local/share/man:/usr/share/gcc-data/i686-pc-linux-gnu/3.3/man:/usr/X11R6/man::/opt/blackdown-jdk-1.4.1/man:/usr/qt/3/doc/man:/opt/perforce/man:/opt/insight/man:/opt/blackdown-jdk-1.4.1/man:/usr/qt/3/doc/man:/opt/perforce/man:/opt/insight/man MOZILLA_FIVE_HOME=/usr/lib/mozilla OMNIORB_CONFIG=/etc/omniorb/omniORB.cfg OPTERR=1 OPTIND=1 OSTYPE=linux-gnu PAGER=/usr/bin/less PATH=/bin:/usr/bin:/usr/local/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/3.3:/opt/ati/bin:/opt/sourcenav/bin:/usr/X11R6/bin:/opt/blackdown-jdk-1.4.1/bin:/opt/blackdown-jdk-1.4.1/jre/bin:/usr/qt/3/bin:/usr/kde/3.2/bin:/opt/perforce/bin:/usr/games/bin:/usr/share/omniORB/bin/scripts:/opt/insight/bin:/usr/share/karamba/bin PIPESTATUS=([0]="0") PPID=8243 PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"' PS1='\s-\v\$ ' PS2='> ' PS4='+ ' PWD=/home/egore QMAKESPEC=linux-g++ QTDIR=/usr/qt/3 SHELL=/bin/bash SHELLOPTS=braceexpand:emacs:hashall:histexpand:interactive-comments:monitor SHLVL=2 SSH_AGENT_PID=7529 SSH_AUTH_SOCK=/tmp/ssh-IVwtSE7508/agent.7508 TERM=rxvt UID=1000 USER=egore USERNAME=egore WINDOWID=27262978 XAUTHORITY=/home/egore/.Xauthority XGUILOADPATH=/usr/share/doc/snns-4.2-r4/ XINITRC=/etc/X11/xinit/xinitrc _=set bash205='2.05b.0(1)-release' bash205b='2.05b.0(1)-release' _ImageMagick () { local prev; prev=${COMP_WORDS[COMP_CWORD-1]}; case "$prev" in -channel) COMPREPLY=($( compgen -W 'Red Green Blue Opacity \ Matte Cyan Magenta Yellow Black' -- $cur )); return 0 ;; -colormap) COMPREPLY=($( compgen -W 'shared private' -- $cur )); return 0 ;; -colorspace) COMPREPLY=($( compgen -W 'GRAY OHTA RGB Transparent \ XYZ YCbCr YIQ YPbPr YUV CMYK' -- $cur )); return 0 ;; -compose) COMPREPLY=($( compgen -W 'Over In Out Atop Xor Plus \ Minus Add Subtract Difference Multiply Bumpmap\ Copy CopyRed CopyGreen CopyBlue CopyOpacity' -- $cur )); return 0 ;; -compress) COMPREPLY=($( compgen -W 'None BZip Fax Group4 JPEG \ Lossless LZW RLE Zip' -- $cur )); return 0 ;; -dispose) COMPREPLY=($( compgen -W 'Undefined None Background \ Previous' -- $cur )); return 0 ;; -encoding) COMPREPLY=($( compgen -W 'AdobeCustom AdobeExpert \ AdobeStandard AppleRoman BIG5 GB2312 Latin2 \ None SJIScode Symbol Unicode Wansung' -- $cur)); return 0 ;; -endian) COMPREPLY=($( compgen -W 'MSB LSB' -- $cur )); return 0 ;; -filter) COMPREPLY=($( compgen -W 'Point Box Triangle Hermite \ Hanning Hamming Blackman Gaussian Quadratic \ Cubic Catrom Mitchell Lanczos Bessel Sinc' -- $cur )); return 0 ;; -format) COMPREPLY=($( convert -list format | awk '/ [r-][w-][+-] / {print $1}' | tr -d '*' | tr [:upper:] [:lower:] | grep "^$cur" )); return 0 ;; -gravity) COMPREPLY=($( compgen -W 'Northwest North NorthEast \ West Center East SouthWest South SouthEast' -- $cur )); return 0 ;; -intent) COMPREPLY=($( compgen -W 'Absolute Perceptual \ Relative Saturation' -- $cur )); return 0 ;; -interlace) COMPREPLY=($( compgen -W 'None Line Plane Partition' -- $cur )); return 0 ;; -limit) COMPREPLY=($( compgen -W 'Disk File Map Memory' -- $cur )); return 0 ;; -list) COMPREPLY=($( compgen -W 'Delegate Format Magic \ Module Resource Type' -- $cur )); return 0 ;; -map) COMPREPLY=($( compgen -W 'best default gray red \ green blue' -- $cur )); _filedir; return 0 ;; -noise) COMPREPLY=($( compgen -W 'Uniform Gaussian \ Multiplicative \ Impulse Laplacian Poisson' -- $cur )); return 0 ;; -preview) COMPREPLY=($( compgen -W 'Rotate Shear Roll Hue \ Saturation Brightness Gamma Spiff \ Dull Grayscale Quantize Despeckle \ ReduceNoise AddNoise Sharpen Blur \ Treshold EdgeDetect Spread Shade \ Raise Segment Solarize Swirl Implode \ Wave OilPaint CharcoalDrawing JPEG' -- $cur )); return 0 ;; -@(mask|profile|texture|tile|write)) _filedir; return 0 ;; -type) COMPREPLY=($( compgen -W 'Bilevel Grayscale Palette \ PaletteMatte TrueColor TrueColorMatte \ ColorSeparation ColorSeparationlMatte \ Optimize' -- $cur )); return 0 ;; -units) COMPREPLY=($( compgen -W 'Undefined PixelsPerInch \ PixelsPerCentimeter' -- $cur )); return 0 ;; -virtual-pixel) COMPREPLY=($( compgen -W 'Constant Edge mirror tile' -- $cur )); return 0 ;; -visual) COMPREPLY=($( compgen -W 'StaticGray GrayScale \ StaticColor PseudoColor TrueColor \ DirectColor defaut visualid' -- $cur )); return 0 ;; esac } _alias () { local cur; COMPREPLY=(); cur=${COMP_WORDS[$COMP_CWORD]}; case "$COMP_LINE" in *[^=]) COMPREPLY=($( compgen -A alias -S '=' -- $cur )) ;; *=) COMPREPLY=("$( alias ${cur%=} 2>/dev/null | sed -e 's|^alias '$cur'\(.*\)$|\1|' )") ;; esac } _animate () { local cur; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; _ImageMagick; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-authenticate -backdrop -colormap \ -colors -colorspace -crop -debug -delay -density \ -depth -display -dither -extract -gamma -geometry \ -help -interlace -limit -log -matte -map -monochrome \ -noop -pause -remote -rotate -sampling-factor -scene \ -size -treedepth -trim -verbose -version -visual \ -virtual-pixel -window' -- $cur )); else if [[ "$cur" == +* ]]; then COMPREPLY=($( compgen -W '+debug +dither +gamma +map +matte' -- $cur )); else _filedir; fi; fi } _ant () { local cur prev buildfile i; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; case "$prev" in -buildfile | -f) _filedir 'xml'; return 0 ;; -logfile) _filedir; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-help -projecthelp -version -quiet \ -verbose -debug -emacs -logfile -logger \ -listener -buildfile -f -D -find' -- $cur )); else buildfile=build.xml; for (( i=1 ; i < COMP_CWORD ; i++ )) do if [[ "${COMP_WORDS[i]}" == -buildfile ]]; then buildfile=${COMP_WORDS[i+1]}; break; fi; done; [ ! -f $buildfile ] && return 0; COMPREPLY=($( awk -F'"' '//dev/null )); else _expand || return 0; fi; return 0 } _chown () { local user; local cur=${COMP_WORDS[COMP_CWORD]}; local prev=${COMP_WORDS[COMP_CWORD-1]}; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-c -h -f -R -v --changes \ --dereference --no-dereference --from= --silent --quiet \ --reference= --recursive --verbose --help --version' -- $cur )); return 0; fi; if (( " COMP_CWORD == 1 " )) || [[ "$prev" == -* ]]; then if [[ $cur = *@(\\:|.)* ]] && [ -n "$bash205" ]; then user=${cur%%*([^:.])}; COMPREPLY=($(compgen -P ${user/\\\\} -g -- ${cur##*[.:]})); else if [[ $cur = *:* ]] && [ -n "$bash205" ]; then COMPREPLY=($( compgen -g -- ${cur##*[.:]} )); else COMPREPLY=($( compgen -S : -u -- $cur )); fi; fi; else _filedir; fi } _chsh () { local cur prev; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; if [ "$prev" = "-s" ]; then COMPREPLY=($( chsh -l | grep "^$cur" )); else COMPREPLY=($( compgen -u -- $cur )); fi; return 0 } _command () { local cur func cline cspec noglob cmd _COMMAND_FUNC _COMMAND_FUNC_ARGS; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; cmd=${COMP_WORDS[1]}; if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=($( compgen -c -- $cur )); else if complete -p $cmd >&/dev/null; then cspec=$( complete -p $cmd ); if [ "${cspec#* -F }" != "$cspec" ]; then COMP_CWORD=$(( $COMP_CWORD - 1 )); func=${cspec#*-F }; func=${func%% *}; cline="${COMP_LINE#$1 }"; shopt -o noglob >/dev/null; noglob=$?; shopt -so noglob; COMP_WORDS=($cline); [ $noglob -eq 1 ] && shopt -uo noglob; $func $cline; COMP_CWORD=$(( $COMP_CWORD > 0 ? $COMP_CWORD : 1 )); cur=${COMP_WORDS[COMP_CWORD]}; _COMMAND_FUNC=$func; _COMMAND_FUNC_ARGS=($cmd $2 $3); COMP_LINE=$cline; COMP_POINT=$(( ${COMP_POINT} - ${#1} - 1 )); $func $cmd $2 $3; if [ "${cspec#*-o }" != "$cspec" ]; then cspec=${cspec#*-o }; cspec=${cspec%% *}; if [[ "$cspec" != @(dir|file)names ]]; then COMPREPLY=("${COMPREPLY[@]//\\\\:/:}"); fi; fi; else if [ -n "$cspec" ]; then cspec=${cspec#complete}; cspec=${cspec%%$cmd}; COMPREPLY=($( eval compgen "$cspec" -- "$cur" )); fi; fi; fi; fi; [ ${#COMPREPLY[@]} -eq 0 ] && _filedir } _complete () { local cur prev options; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; case $prev in -o) options="default dirnames filenames"; [ -n "$bash205b" ] && options="$options nospace"; [ -n "$bash3" ] && options="$options bashdefault plusdirs"; COMPREPLY=($( compgen -W "$options" -- $cur )); return 0 ;; -A) COMPREPLY=($( compgen -W 'alias arrayvar binding \ builtin command directory disabled enabled \ export file function group helptopic hostname \ job keyword running service setopt shopt \ signal stopped user variable' -- $cur )); return 0 ;; -C) COMPREPLY=($( compgen -A command -- $cur )); return 0 ;; -F) COMPREPLY=($( compgen -A function -- $cur )); return 0 ;; -@(p|r)) COMPREPLY=($( complete -p | sed -e 's|.* ||' | grep "^$cur" )); return 0 ;; esac; if [[ "$cur" == -* ]]; then options="-a -b -c -d -e -f -g -j -k -s -v -u -A -G -W -P -S -X -F -C"; [ -n "$bash205" ] && options="$options -o"; COMPREPLY=($( compgen -W "$options" -- $cur )); else COMPREPLY=($( compgen -A command -- $cur )); fi } _composite () { local cur; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; _ImageMagick; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-affine -authenticate \ -blue-primary -colors -colorspace -comment -compose \ -compress -debug -density -depth -displace -display \ -dispose -dissolve -dither -encoding -endian -extract \ -filter -font -geometry -gravity -green-primary -help \ -interlace -label -limit -log -matte -monochrome \ -negate -page -profile -quality -red-primary -rotate \ -resize -sampling-factor -scene -sharpen -size \ -stegano -stereo -thumbnail -tile -transform \ -treedepth -type -units -unsharp -verbose -version \ -virtual-pixel -watermark -white-point -write' -- $cur )); else if [[ "$cur" == +* ]]; then COMPREPLY=($( compgen -W '+compress +debug +dither +endian +label \ +matte +negate +page +write' -- $cur )); else _filedir; fi; fi } _configure_func () { local cur; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; [[ "$cur" != -* ]] && return 0; if [ -n "$COMP_CONFIGURE_HINTS" ]; then COMPREPLY=($( $1 --help | awk '/^ --[A-Za-z]/ { print $1; if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[,[].*//g' | grep ^$cur )); else COMPREPLY=($( $1 --help | awk '/^ --[A-Za-z]/ { print $1; if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[,=[].*//g' | grep ^$cur )); fi } _convert () { local cur; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; _ImageMagick; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-adjoin -affine -antialias -append \ -authenticate -average -background -black-threshold \ -blue-primary -blur -border -bordercolor -channel \ -charcoal -chop -clip -coalesce -colorize -colors \ -colorspace -comment -compress -contrast -convolve \ -crop -cycle -debug -deconstruct -delay -density \ -depth -despeckle -display -dispose -dither -draw \ -edge -emboss -encoding -endian -enhance -equalize \ -extract -fill -filter -flatten -flip -flop -font \ -frame -fuzz -gamma -gaussian -geometry \ -green-primary -gravity -help -implode -intent \ -interlace -label -lat -level -limit -list -log -loop \ -map -mask -matte -median -modulate -monochrome \ -morph -mosaic -negate -noop -noise -normalize \ -opaque -ordered-dither -page -paint -ping -pointsize \ -preview -profile -quality -raise -random-threshold \ -region -raise -red-primary -render -resize -resample \ -roll -rotate -sample -sampling-factor -scale -scene \ -seed -segment -shade -sharpen -shave -shear -size \ -solarize -spread -stroke -strokewidth -swirl \ -texture -threshold -thumbnail -tile -transform \ -transparent -treedepth -trim -type -undercolor \ -units -unsharp -verbose -version -view \ -virtual-pixel -wave -white-point -white-threshold \ -write' -- $cur )); else if [[ "$cur" == +* ]]; then COMPREPLY=($( compgen -W '+adjoin +append +compress \ +contrast +debug +dither +endian +gamma +label +map \ +mask +matte +negate +noise +page +raise +render \ +write' -- $cur )); else _filedir; fi; fi } _cvs () { local cur count mode i cvsroot cvsroots pwd; local -a flags miss files entries changed newremoved; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; count=0; for i in ${COMP_WORDS[@]}; do [ $count -eq $COMP_CWORD ] && break; if [ "${COMP_WORDS[((count))]}" == "$cvsroot" -a "$mode" == "cvsroot" ]; then mode=""; fi; if [ -z "$mode" ]; then case $i in -d) mode=cvsroot; cvsroot=${COMP_WORDS[((count+1))]} ;; @(add|new)) mode=add ;; @(admin|rcs)) mode=admin ;; @(checkout|co|get)) mode=checkout ;; @(commit|ci)) mode=commit ;; @(ex?(p?(ort)))) mode=export ;; @(annotate|diff|history|import|release|status|?(un)edit)) mode=$i ;; @(update|up)) mode=update ;; ?(r)log) mode=log ;; @(rdiff|patch)) mode=rdiff ;; @(remove|rm|delete)) mode=remove ;; @(rtag|rfreeze)) mode=rtag ;; @(tag|freeze)) mode=tag ;; *) ;; esac; else if [[ "$i" = -* ]]; then flags=(${flags[@]:-} $i); fi; fi; count=$((++count)); done; case "$mode" in add) if [[ "$cur" != -* ]]; then set_prefix; if [ $COMP_CWORD -gt 1 -a -r ${prefix:-}CVS/Entries ]; then get_entries; [ -z "$cur" ] && files=$( command ls -Ad !(CVS) ) || files=$( command ls -d ${cur}* 2>/dev/null ); for i in ${entries[@]:-}; do files=(${files[@]/#$i//}); done; COMPREPLY=($( compgen -W '${files[@]}' -- $cur )); fi; else COMPREPLY=($( compgen -W '-k -m' -- $cur )); fi ;; admin) if [[ "$cur" = -* ]]; then COMPREPLY=($( compgen -W '-i -a -A -e -b -c -k -l -u \ -L -U -m -M -n -N -o -q -I \ -s -t -t- -T -V -x -z' -- $cur )); fi ;; checkout) if [[ "$cur" != -* ]]; then [ -z "$cvsroot" ] && cvsroot=$CVSROOT; COMPREPLY=($( cvs -d "$cvsroot" co -c | awk '{print $1}' )); COMPREPLY=($( compgen -W '${COMPREPLY[@]}' -- $cur )); else COMPREPLY=($( compgen -W '-A -N -P -R -c -f -l -n -p \ -s -r -D -d -k -j' -- $cur )); fi ;; commit) set_prefix; if [[ "$cur" != -* ]] && [ -r ${prefix:-}CVS/Entries ]; then if [ -n "${COMP_CVS_REMOTE:-}" ]; then changed=($( cvs diff --brief 2>&1 | sed -ne 's/^Files [^ ]* and \([^ ]*\) differ$/\1/p' )); newremoved=($( cvs diff --brief 2>&1 | sed -ne 's/^cvs diff: \([^ ]*\) .*, no comparison available$/\1/p' )); COMPREPLY=($( compgen -W '${changed[@]:-} \ ${newremoved[@]:-}' -- $cur )); else COMPREPLY=($( compgen -f -- $cur )); fi; else COMPREPLY=($( compgen -W '-n -R -l -f -F -m -r' -- $cur )); fi ;; cvsroot) if [ -r ~/.cvspass ]; then cvsroots=$( sed 's/^[^ ]* //; s/:/\\:/g' ~/.cvspass ); COMPREPLY=($( compgen -W '$cvsroots' -- $cur )); fi ;; export) if [[ "$cur" != -* ]]; then [ -z "$cvsroot" ] && cvsroot=$CVSROOT; COMPREPLY=($( cvs -d "$cvsroot" co -c | awk '{print $1}' )); COMPREPLY=($( compgen -W '${COMPREPLY[@]}' -- $cur )); else COMPREPLY=($( compgen -W '-N -f -l -R -n \ -r -D -d -k' -- $cur )); fi ;; diff) if [[ "$cur" == -* ]]; then _longopt diff; else get_entries; COMPREPLY=(${entries[@]:-}); fi ;; remove) if [[ "$cur" != -* ]]; then set_prefix; if [ $COMP_CWORD -gt 1 -a -r ${prefix:-}CVS/Entries ]; then get_entries; for i in ${entries[@]}; do [ ! -r "$i" ] && miss=(${miss[@]:-} $i); done; COMPREPLY=($(compgen -W '${miss[@]:-}' -- $cur)); fi; else COMPREPLY=($( compgen -W '-f -l -R' -- $cur )); fi ;; import) if [[ "$cur" != -* ]]; then [ -z "$cvsroot" ] && cvsroot=$CVSROOT; prefix=${cur%/*}; if [ -r ${cvsroot}/${prefix} ]; then get_modules; COMPREPLY=(${COMPREPLY[@]#$cvsroot}); COMPREPLY=(${COMPREPLY[@]#\/}); fi; pwd=$( pwd ); pwd=${pwd##*/}; COMPREPLY=($( compgen -W '${COMPREPLY[@]} $pwd' -- $cur )); else COMPREPLY=($( compgen -W '-d -k -I -b -m -W' -- $cur )); fi ;; "") COMPREPLY=($( compgen -W 'add admin annotate checkout ci co \ commit diff delete edit export \ freeze get history import log new \ patch rcs rdiff release remove \ rfreeze rlog rm rtag status tag \ unedit up update -H -Q -q -b -d -e \ -f -l -n -t -r -v -w -x -z --help \ --version' -- $cur )) ;; *) ;; esac; return 0 } _dcop () { local cur compstr; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; if [ -z $cur ]; then compstr=${COMP_WORDS[*]}; else compstr=$( command echo ${COMP_WORDS[*]} | sed "s/ $cur$//" ); fi; COMPREPLY=($( compgen -W '$( command $compstr | sed s/\(.*\)// )' -- $cur )) } _dd () { local cur; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; case "$cur" in if=* | of=*) cur=${cur#*=}; _filedir; return 0 ;; conv=*) cur=${cur#*=}; COMPREPLY=($( compgen -W 'ascii ebcdic ibm block unblock \ lcase notrunc ucase swab noerror sync' -- $cur )); return 0 ;; esac; _expand || return 0; COMPREPLY=($( compgen -W '--help --version' -- $cur ) $( compgen -W 'bs cbs conv count ibs if obs of seek skip' -S '=' -- $cur )) } _dict () { local cur prev host port db dictfile; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; dictfile=/usr/share/dict/words; for (( i=1 ; i < COMP_CWORD ; i++ )) do case "${COMP_WORDS[i]}" in -@(h|--host)) host=${COMP_WORDS[i+1]}; [ -n "$host" ] && host="-h $host"; i=$((++i)) ;; -@(p|-port)) port=${COMP_WORDS[i+1]}; [ -n "$port" ] && port="-p $port"; i=$((++i)) ;; -@(d|-database)) db=${COMP_WORDS[i+1]}; [ -n "$db" ] && host="-d $db"; i=$((++i)) ;; *) ;; esac; done; if [[ "$cur" = -* ]]; then COMPREPLY=($( compgen -W '-h --host -p --port -d --database \ -m --match -s --strategy -c --config -C \ --nocorrect -D --dbs -S --strats -H \ --serverhelp -i --info -I --serverinfo \ -a --noauth -u --user -k --key -V --version \ -L --license --help -v --verbose -r --raw \ -P --pager --debug --html --pipesize --client' -- "$cur" )); return 0; fi; case "$prev" in -@(d|-database|i|info)) COMPREPLY=($( compgen -W '$( _dictdata -D )' -- "$cur" )); return 0 ;; -@(s|-strategy)) COMPREPLY=($( compgen -W '$( _dictdata -S )' -- "$cur" )); return 0 ;; *) ;; esac; [ -r $dictfile ] && COMPREPLY=($( compgen -W '$( cat $dictfile )' -- "$cur" )) } _dictdata () { dict $host $port $1 2>/dev/null | sed -ne 's/^['' '']['' '']*\([^'' '']*\).*$/\1/p' } _display () { local cur; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; _ImageMagick; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-authenticate -backdrop -border \ -colormap -colors -colorspace -comment -compress \ -contrast -crop -debug -delay -density -depth \ -despeckle -display -dispose -dither -edge -endian \ -enhance -extract -filter -flip -flop -frame -gamma \ -geometry -help -immutable -interlace -label -limit \ -log -map -matte -monochrome -negate -noop -page \ -quality -raise -remote -roll -rotate -sample \ -sampling-factor -scene -segment -sharpen -size \ -texture -treedepth -trim -update -verbose -version \ -virtual-pixel -window -window_group -write' -- $cur)); else if [[ "$cur" == +* ]]; then COMPREPLY=($( compgen -W '+compress +contrast +debug +dither \ +endian +gamma +label +map +matte +negate +page \ +raise +write' -- $cur )); else _filedir; fi; fi } _distccconfig () { local cur curword numwords opts; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; numwords=${#COMP_WORDS[*]}; curword=${COMP_CWORD}; if [ ${numwords} -gt 3 ]; then return 0; fi; if [[ "${cur}" == -* ]] || [ ${curword} -eq 1 ]; then if [ ${numwords} -le 2 ] && [ ${curword} -eq 1 ]; then opts="--get-hosts --get-verbose --get-log --set-hosts --set-verbose --set-log --add-path --no-path"; else opts=""; fi; else opts=""; fi; COMPREPLY=($(compgen -W "${opts}" | grep ^$cur)); return 0 } _ebuild () { local cur prev; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=($(compgen -o filenames)); else if [ $COMP_CWORD -eq 2 ]; then COMPREPLY=($( compgen -W 'check \ clean compile config \ depend digest \ fetch \ help \ install \ merge \ package postinst postrm preinst prerm \ qmerge \ rcheck remerge rpm \ setup \ touch \ unmerge unpack' $cur )); fi; fi; return 0 } _emerge () { local cur prev grepcmd sedcmd systemactions setsma setbig portagedir origdir; local mode words opts curword numwords pkgdbdir; origdir="${PWD}"; portagedir=/usr/portage; pkgdbdir=/var/db/pkg; COMPREPLY=(); cur="${COMP_WORDS[COMP_CWORD]}"; prev="${COMP_WORDS[COMP_CWORD-1]}"; words="${COMP_WORDS[*]}"; numwords=${#COMP_WORDS[*]}; curword=${COMP_CWORD}; mode='ALL'; if [ ${curword} -eq 1 ] && [ ${numwords} -eq 2 ]; then mode='ALL'; else if [[ " ${words} " == *" --unmerge "* ]]; then mode='UNMERGE'; else if [[ " ${words} " == *" --safe "* ]]; then mode='SAFE'; else if [[ " ${words} " == *" --search "* ]]; then mode='SEARCH'; else if [[ " ${words} " == *" --world "* ]]; then mode='WORLD'; else if [[ " ${words} " == *" --help "* ]]; then mode='HELP'; else if [[ " ${words} " == *" --clean "* ]]; then mode='CLEAN'; else if [[ " ${words} " == *" --pretend "* ]]; then mode='PRETEND'; else mode='NOCLEAN'; fi; fi; fi; fi; fi; fi; fi; fi; if [[ "${cur}" == -* ]]; then case "${mode}" in "ALL") opts='--clean --help --verbose --debug --fetchonly \ --onlydeps --noreplace --usepkg --buildpkg \ --autoclean --pretend --unmerge --safe \ --search --world' ;; "UNMERGE") opts='--clean --verbose --debug --pretend \ --unmerge --safe' ;; "SAFE") opts='--unmerge --verbose --debug' ;; "SEARCH") opts='--verbose --debug' ;; "WORLD") opts='--verbose --debug --pretend --world' ;; "HELP") opts='' ;; "CLEAN") opts='--verbose --debug --clean' ;; "PRETEND") opts='--verbose --debug --fetchonly --onlydeps \ --noreplace --usepkg --buildpkg \ --autoclean --pretend --unmerge --safe \ --world' ;; "NOCLEAN") opts='--help --verbose --debug --fetchonly \ --onlydeps --noreplace --usepkg --buildpkg \ --autoclean --pretend --unmerge --safe \ --search --world' ;; *) opts='--clean --help --verbose --debug --fetchonly \ --onlydeps --noreplace --usepkg --buildpkg \ --autoclean --pretend --unmerge --safe \ --search --world' ;; esac; COMPREPLY=($(compgen -W "${opts}" | grep ^$cur)); else if [ "${mode}" == "CLEAN" ]; then COMPREPLY=($(compgen -W 'rsync')); else if [ "${mode}" == "WORLD" ]; then COMPREPLY=($(compgen -W 'update' | grep ^${cur})); else if [ "${mode}" == "HELP" ]; then if [[ ! " ${words} " == *" "@(system|rsync)" "* ]]; then COMPREPLY=($(compgen -W 'rsync system' | grep ^${cur})); else COMPREPLY=''; fi; else if [ "${mode}" == "SEARCH" ]; then COMPREPLY=''; else if [ "${mode}" == "UNMERGE" ]; then sedcmd="sed -e s:=:: -e s:>:: -e s:<::"; cur=$(echo "${cur}" | ${sedcmd}); if [[ "${cur} " == @('/'|'.'|'~'|'$')* ]]; then COMPREPLY=''; else cd "${pkgdbdir}"; grepcmd="grep -E ^$cur.*"; if [ "${cur}" ]; then if [ $(echo "${cur}" | grep '/') ]; then setbig=$(compgen -G "${cur}*"); COMPREPLY=($(echo "${setbig}" | ${grepcmd})); else setsma=$(compgen -S '/' -G "${cur}*"); if [ $(echo "${setsma}" | ${grepcmd} | grep '/' | wc -l) = 1 ]; then setbig=$(compgen -G "*/*"); COMPREPLY=($(echo "${setbig}" | ${grepcmd})); else COMPREPLY=($(echo "${setsma}" | ${grepcmd})); fi; fi; else setsma=$(compgen -S '/' -G "${cur}*"); COMPREPLY=($(echo "${setsma}")); fi; cd "${origdir}"; fi; else if [ "${mode}" == "SAFE" ]; then COMPREPLY=($(compgen -W '--unmerge' | grep ^${cur})); else if [[ " ${words} " == *" "@(update|system|rsync)" "* ]]; then COMPREPLY=''; else if [[ " ${words} " == *" --usepkg "* ]] && [[ "${cur} " == @('/'|'.'|'~'|'$')* ]]; then COMPREPLY=''; else cd "${portagedir}"; grepcmd="grep -E ^${cur}.*"; sedcmd="sed -e /^[^-]*$/d"; if [ ${COMP_CWORD} -eq 1 ]; then systemactions=' '"system"' '"update"' '"rsync"; else if [[ ! " ${words} " == *" "*[/]*" "* ]]; then systemactions=' '"system"' '"update"; else systemactions=''; fi; fi; if [ "${cur}" ]; then if [[ "${cur} " == @('/'|'.'|'~'|'$')* ]]; then COMPREPLY=''; else if [ $(echo "${cur}" | grep '/') ]; then setbig=$(compgen -G "${cur}*" | ${sedcmd})"${systemactions}"; COMPREPLY=($(echo "${setbig}" | $grepcmd)); else setsma=$(compgen -S '/' -G "${cur}*" | ${sedcmd})"${systemactions}"; if [ $(echo "${setsma}" | ${grepcmd} | grep '/' | wc -l) = 1 ]; then setbig=$(compgen -G "*/*" | ${sedcmd})"${systemactions}"; COMPREPLY=($(echo "${setbig}" | ${grepcmd})); else COMPREPLY=($(echo "${setsma}" | ${grepcmd})); fi; fi; fi; else setsma=$(compgen -S '/' -G "${cur}*" | ${sedcmd})"${systemactions}"; COMPREPLY=($(echo "${setsma}")); fi; cd "${origdir}"; fi; fi; fi; fi; fi; fi; fi; fi; fi; COMPREPLY=($(echo "${COMP_WORDS[@]}" | (while read -d ' ' i; do [ "${i}" == "" ] && continue # flatten array with spaces on either side, # otherwise we cannot grep on word boundaries of # first and last word COMPREPLY=" ${COMPREPLY[@]} " # remove word from list of completions COMPREPLY=(${COMPREPLY/ ${i%% *} / }) done echo ${COMPREPLY[@]}))); return 0 } _expand () { [ "$cur" != "${cur%\\}" ] && cur="$cur\\"; if [[ "$cur" == \~*/* ]]; then eval cur=$cur; else if [[ "$cur" == \~* ]]; then cur=${cur#\~}; COMPREPLY=($( compgen -P '~' -u $cur )); return ${#COMPREPLY[@]}; fi; fi } _export () { local cur; COMPREPLY=(); cur=${COMP_WORDS[$COMP_CWORD]}; case "$COMP_LINE" in *=\$*) COMPREPLY=($( compgen -v -P '$' -- ${cur#*=\$} )) ;; *[^=]) COMPREPLY=($( compgen -v -S '=' -- $cur )) ;; *=) COMPREPLY=("$( eval echo -n \"$`echo ${cur%=}`\" | ( echo -n \' sed -e 's/'\''/'\''\\\'\'''\''/g' echo -n \' ) )") ;; esac } _filedir () { local IFS=' ' xspec; _expand || return 0; if [ "${1:-}" = -d ]; then COMPREPLY=(${COMPREPLY[@]:-} $( compgen -d -- $cur )); return 0; fi; xspec=${1:+"!*.$1"}; COMPREPLY=(${COMPREPLY[@]:-} $( compgen -f -X "$xspec" -- "$cur" ) $( compgen -d -- "$cur" )) } _filedir_xspec () { local IFS cur xspec; IFS=' '; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; _expand || return 0; xspec=$( grep '^complete ' $BASH_COMPLETION | sed -ne '/ '${1##*/}'/{p;q;}' ); xspec=${xspec#*-X }; xspec=${xspec%% *}; COMPREPLY=($( eval compgen -f -X "$xspec" -- \"${cur#[\`\"\']}\" 2>/dev/null ) $( compgen -d -- $cur )) } _find () { local cur prev i exprfound onlyonce; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; case "$prev" in -@(max|min)depth) COMPREPLY=($( compgen -W '0 1 2 3 4 5 6 7 8 9' -- $cur )); return 0 ;; -?(a|c)newer | -fls | -fprint?(0|f) | -?(i)?(l)name) _filedir; return 0 ;; -fstype) COMPREPLY=($( cut -d' ' -f 2 /proc/filesystems | grep "^$cur" )); return 0 ;; -gid) _gids; return 0 ;; -group) if [ -n "$bash205" ]; then COMPREPLY=($( compgen -g -- $cur 2>/dev/null)); fi; return 0 ;; -?(x)type) COMPREPLY=($( compgen -W 'b c d p f l s' -- $cur )); return 0 ;; -uid) _uids; return 0 ;; -user) COMPREPLY=($( compgen -u -- $cur )); return 0 ;; -exec | -ok) COMP_WORDS=(COMP_WORDS[0] $cur); COMP_CWORD=1; _command; return 0 ;; -[acm]min | -[acm]time | -?(i)?(l)name | -inum | -?(i)path | -?(i)regex | -links | -perm | -size | -used | -printf) return 0 ;; esac; _expand || return 0; for i in ${COMP_WORDS[@]}; do [[ "$i" = [-\(\),\!]* ]] && exprfound=1 && break; done; if [ "$exprfound" != 1 ] && [[ "$cur" != [-\(\),\!]* ]]; then _filedir -d; return 0; fi; COMPREPLY=($( compgen -W '-daystart -depth -follow -help -maxdepth \ -mindepth -mount -noleaf -version -xdev -amin -anewer \ -atime -cmin -cnewer -ctime -empty -false -fstype \ -gid -group -ilname -iname -inum -ipath -iregex \ -links -lname -mmin -mtime -name -newer -nouser \ -nogroup -perm -regex -size -true -type -uid -used \ -user -xtype -exec -fls -fprint -fprint0 -fprintf -ok \ -print -print0 -printf -prune -ls' -- $cur )); onlyonce=' -daystart -depth -follow -help -maxdepth -mindepth -mount \ -noleaf -version -xdev '; COMPREPLY=($( echo "${COMP_WORDS[@]}" | (while read -d ' ' i; do [ "$i" == "" ] || [ "${onlyonce/ ${i%% *} / }" == "$onlyonce" ] && continue # flatten array with spaces on either side, # otherwise we cannot grep on word boundaries of # first and last word COMPREPLY=" ${COMPREPLY[@]} " # remove word from list of completions COMPREPLY=( ${COMPREPLY/ ${i%% *} / } ) done echo ${COMPREPLY[@]}) )); _filedir; return 0 } _function () { local cur prev; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; if [[ $1 == @(declare|typeset) ]]; then if [ "$prev" = -f ]; then COMPREPLY=($( compgen -A function -- $cur )); else if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-a -f -F -i -r -x -p' -- $cur )); fi; fi; else if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=($( compgen -A function -- $cur )); else COMPREPLY=("() $( type -- ${COMP_WORDS[1]} | sed -e 1,2d )"); fi; fi } _gcc () { local cur cc backend; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; _expand || return 0; case "$1" in gcj) backend=jc1 ;; gpc) backend=gpc1 ;; *77) backend=f771 ;; *) backend=cc1 ;; esac; if [[ "$cur" == -* ]]; then cc=$( $1 -print-prog-name=$backend ); COMPREPLY=($( $cc --help 2>/dev/null | tr '\t' ' ' | sed -e '/^ *-/!d' -e 's/ *-\([^ ]*\).*/-\1/' | grep "^$cur" | sort -u )); else _filedir; fi } _gccconfig () { local cur curword numwords opts; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; numwords=${#COMP_WORDS[*]}; curword=${COMP_CWORD}; if [ ${numwords} -gt 3 ]; then return 0; fi; if [[ "${cur}" == -* ]] || [ ${curword} -eq 1 ]; then if [ ${numwords} -le 2 ] && [ ${curword} -eq 1 ]; then opts="--use-old --use-portage-chost --get-current-profile --list-profiles --print-environ --get-bin-path --get-lib-path --get-stdcxx-incdir"; else opts=""; fi; else if [ ${numwords} -le 3 ] && [ ${curword} -eq 2 ]; then case "${COMP_WORDS[1]}" in "--print-environ" | "--get-bin-path" | "--get-lib-path" | "--get-stdcxx-incdir") opts=$(gcc-config --list-profiles) ;; *) opts="" ;; esac; else opts=""; fi; fi; COMPREPLY=($(compgen -W "${opts}" | grep ^$cur)); return 0 } _gdb () { local cur prev; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=($( compgen -c -- $cur )); else if [ $COMP_CWORD -eq 2 ]; then prev=${prev##*/}; COMPREPLY=($( compgen -W "$( compgen -f core $( command ps axo comm,pid | awk '{if ($1 ~ /^'$prev'/) print $2}' ) )" -- "$cur" )); fi; fi } _gids () { if type perl >&/dev/null; then COMPREPLY=($( compgen -W '$( perl -e '"'"'while (($gid) = (getgrent)[2]) { print $gid . "\n" }'"'"' )' -- $cur )); else COMPREPLY=($( awk 'BEGIN {FS=":"} {if ($3 ~ /^'$cur'/) print $3}' /etc/group )); fi } _gpg () { local cur prev; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; case "$prev" in -@(s|-sign|-clearsign|-decrypt-files|-load-extension)) _filedir; return 0 ;; --@(export|@(?(l|nr|nrl)sign|edit)-key)) COMPREPLY=($( compgen -W "$( gpg --list-keys 2>/dev/null | sed -ne 's@^pub.*/\([^ ]*\).*\(<\([^>]*\)>\).*$@\1 \3@p')" -- "$cur" )); return 0 ;; -@(r|-recipient)) COMPREPLY=($( compgen -W "$( gpg --list-keys 2>/dev/null | sed -ne 's@^pub.*<\([^>]*\)>.*$@\1@p')" -- "$cur" )); if [ -e ~/.gnupg/gpg.conf ]; then COMPREPLY=(${COMPREPLY[@]} $( compgen -W "$( sed -ne 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' ~/.gnupg/gpg.conf )" -- "$cur")); fi; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-s -b -e -f -c -d -a -r -u -Z -o -v \ -q -n -N --sign --clearsign --detach-sign \ --encrypt --encrypt-files --symmetric --store \ --decrypt --decrypt-files --verify --list-keys \ --list-sigs --check-sigs --fingerprint \ --list-secret-keys --gen-key --delete-keys \ --delete-secret-keys --sign-key --lsign-key \ --nrsign-key --nrlsign-key --edit-key \ --gen-revoke --export --send-key --recv-keys \ --search-keys --refresh-keys --import \ --list-packets --export-ownertrust \ --import-ownertrust --update-trustdb \ --check-trustdb --fix-trustdb --dearmor \ --enarmor --print-md --armor --recipient \ --default-recipient --default-recipient-self \ --local-user --textmode --output --verbose \ --quiet --no-tty --force-v3-sigs \ --no-force-v3-sigs --force-v4-certs \ --no-force-v4-certs --force-mdc --disable-mdc \ --dry-run --use-agent --batch --yes --no \ --keyring --secret-keyring --show-keyring \ --default-key --keyserver --charset --options \ --status-fd --trusted-key --load-extension \ --rfc1991 --openpgp --pgp2 --s2k-mode \ --s2k-digest-algo --s2k-cipher-algo \ --cipher-algo --digest-algo --compress-algo \ --throw-keyid --show-photos --no-show-photos \ --photo-viewer --notation-data' -- $cur )); fi } _gzip () { local cur prev xspec; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-c -d -f \ -h -l -L -n -N -q -r -S -t -v -V \ -1 -2 -3 -4 -5 -6 -7 -8 -9 \ --stdout --decompress --force --help --list \ --license --no-name --name --quiet --recursive \ --suffix --test --verbose --version --fast \ --best' -- $cur )); return 0; fi; xspec="*.?(t)gz"; if [[ "$prev" == --* ]]; then [[ "$prev" == --decompress || "$prev" == --list || "$prev" == --test ]] && xspec="!"$xspec; [[ "$prev" == --force ]] && xspec=; else if [[ "$prev" == -* ]]; then [[ "$prev" == -*[dlt]* ]] && xspec="!"$xspec; [[ "$prev" == -*f* ]] && xspec=; else if [ "$prev" = '>' ]; then xspec=; fi; fi; fi; _expand || return 0; COMPREPLY=($( compgen -f -X "$xspec" -- $cur ) $( compgen -d -- $cur )) } _iconv () { local cur prev; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; if [[ "$cur" = -* ]]; then COMPREPLY=($( compgen -W '--from-code -f --to-code -t --list --output -o --verbose' -- "$cur" )); return 0; fi; if [[ "$prev" == -@(f|t|-@(from|to)-code) ]]; then COMPREPLY=($( compgen -W '$( iconv --list | sed "1,/^$/d; s@//@@;" )' -- "$cur" )); fi; return 0 } _identify () { local cur; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; _ImageMagick; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-authenticate -debug -density \ -depth -extract -format -help -interlace -limit -list \ -log -size -sampling-factor -verbose -version \ -virtual-pixel' -- $cur )); else if [[ "$cur" == +* ]]; then COMPREPLY=($( compgen -W '+debug ' -- $cur )); else _filedir; fi; fi } _ifconfig () { local cur; local -a keywords=(-a up down arp promisc allmulti metric mtu dstaddr netmask add del tunnel irq io_addr mem_start media broadcast pointopoint hw multicast address txqueuelen); _ifwconfig ifconfig -a; COMPREPLY=($( compgen -W '${COMPREPLY[@]}' -- $cur )) } _ifwconfig () { COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; case "${COMP_WORDS[1]}" in - | *[0-9]*) COMPREPLY=(${keywords[@]}); COMPREPLY=($( echo " ${COMP_WORDS[@]}" | (while read -d ' ' i; do [ "$i" == "" ] && continue # flatten array with spaces on either side, # otherwise we cannot grep on word # boundaries of first and last word COMPREPLY=" ${COMPREPLY[@]} " # remove word from list of completions COMPREPLY=( ${COMPREPLY/ $i / } ) done echo ${COMPREPLY[@]}) )); return 0 ;; esac; COMPREPLY=($( eval "$@" 2>/dev/null | sed -ne 's|^\('$cur'[^[:space:][:punct:]]\{1,\}\).*$|\1|p')) } _insmod () { local cur prev modpath; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; modpath=/lib/modules/`uname -r`; if [ $1 = "modprobe" ] && [ "${COMP_WORDS[1]}" = "-r" ]; then COMPREPLY=($( /sbin/lsmod | awk '{if (NR != 1 && $1 ~ /^'$cur'/) print $1}' )); return 0; fi; if [[ "$cur" == ?(.|..)/* ]]; then _filedir; return 0; fi; if [ $COMP_CWORD -gt 1 ] && [[ "${COMP_WORDS[COMP_CWORD-1]}" != -* ]]; then COMPREPLY=($( /sbin/modinfo -p ${COMP_WORDS[1]} 2>/dev/null | awk '{if ($1 ~ /^parm:/ && $2 ~ /^'$cur'/) { print $2 } \ else if ($1 !~ /:/ && $1 ~ /^'$cur'/) { print $1 }}' )); else if [ -r $modpath -a -x $modpath ]; then COMPREPLY=($( command ls -R $modpath | sed -ne 's/^\('$cur'.*\)\.k\?o\(\|.gz\)$/\1/p')); else _filedir; fi; fi; return 0 } _interfaces () { if [ -f /etc/debian_version ]; then COMPREPLY=($( sed -ne 's|^iface \([^ ]\+\).*$|\1|p' /etc/network/interfaces )); else COMPREPLY=($( command ls /etc/sysconfig/network-scripts/ifcfg-* | sed -ne 's|.*ifcfg-\('$cur'.*\)|\1|p' )); fi } _iptables () { local cur prev table chain; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; chain='s/^Chain \([^ ]\+\).*$/\1/p'; if [[ $COMP_LINE == *-t\ *filter* ]]; then table="-t filter"; else if [[ $COMP_LINE == *-t\ *nat* ]]; then table="-t nat"; else if [[ $COMP_LINE == *-t\ *mangle* ]]; then table="-t mangle"; fi; fi; fi; case "$prev" in -*[AIDRPFXLZ]) COMPREPLY=($( compgen -W '`iptables $table -nL | \ sed -ne "s/^Chain \([^ ]\+\).*$/\1/p"`' -- $cur )) ;; -*t) COMPREPLY=($( compgen -W 'nat filter mangle' -- $cur )) ;; -j) if [ "$table" = "-t filter" -o "$table" = "" ]; then COMPREPLY=($( compgen -W 'ACCEPT DROP LOG ULOG REJECT \ `iptables $table -nL | sed -ne "$chain" \ -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- $cur )); else if [ "$table" = "-t nat" ]; then COMPREPLY=($( compgen -W 'ACCEPT DROP LOG ULOG REJECT \ MIRROR SNAT DNAT MASQUERADE `iptables $table -nL | \ sed -ne "$chain" -e "s/OUTPUT|PREROUTING|POSTROUTING//"`' -- $cur )); else if [ "$table" = "-t mangle" ]; then COMPREPLY=($( compgen -W 'ACCEPT DROP LOG ULOG REJECT \ MARK TOS `iptables $table -nL | sed -ne "$chain" \ -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- $cur )); fi; fi; fi ;; *) if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-i -o -s -d -p -f -m --append \ --delete --insert --replace --list --flush --zero --new \ --delete-chain --policy --rename-chain --proto --source \ --destination --in-interface --jump --match --numeric \ --out-interface --table --verbose --line-numbers --exact \ --fragment --modprobe= --set-counters --version' -- "$cur")); fi ;; esac } _iwconfig () { local -a keywords=(essid nwid domain freq channel sens mode ap nick rate bit rts frag key enc power); _ifwconfig iwconfig; COMPREPLY=($( compgen -W '${COMPREPLY[@]}' -- $cur )) } _jar () { local cur; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; if [ $COMP_CWORD = 1 ]; then COMPREPLY=($( compgen -W 'c t x u' -- $cur )); return 0; fi; case "${COMP_WORDS[1]}" in *c*f) _filedir ;; *f) _filedir '?(e|j|w)ar' ;; *) _filedir ;; esac } _java () { local cur prev i; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; for (( i=1 ; i < $COMP_CWORD ; i++ )) do case ${COMP_WORDS[$i]} in -cp | -classpath) (( "i++" )) ;; -*) ;; *) _filedir; return 0 ;; esac; done; case $prev in -@(cp|classpath)) _java_path; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-client -hotspot -server -classic \ -cp -classpath -D -verbose -verbose:class \ -verbose:gc -version:jni -version \ -showversion -? -help -X -jar \ -ea -enableassertions -da -disableassertions \ -esa -enablesystemassertions \ -dsa -disablesystemassertions ' -- $cur )); else if [[ "$prev" == -jar ]]; then _filedir jar; else _java_classes; fi; fi } _java_classes () { local classpath i; _java_find_classpath; cur=${cur//.//}; for i in ${classpath//:/ }; do if [ -r $i ] && [[ "$i" == *.@(jar|zip) ]]; then if type zipinfo >&/dev/null; then COMPREPLY=(${COMPREPLY[@]} $( zipinfo -1 "$i" | grep "^$cur" | grep '\.class$' | grep -v "\\$" )); else COMPREPLY=(${COMPREPLY[@]} $( jar tf "$i" "$cur" | grep "\.class$" | grep -v "\\$" )); fi; else if [ -d $i ]; then i=${i%/}; COMPREPLY=(${COMPREPLY[@]} $( find "$i" -type f -path "$i/$cur*.class" 2>/dev/null | grep -v "\\$" | sed -e "s|^$i/||" )); fi; fi; done; COMPREPLY=(${COMPREPLY[@]%.class}); COMPREPLY=(${COMPREPLY[@]//\//.}) } _java_find_classpath () { local i; for (( i=1 ; i < COMP_CWORD ; i++ )) do if [[ "${COMP_WORDS[i]}" == -@(cp|classpath) ]]; then classpath=${COMP_WORDS[i+1]}; break; fi; done; [ -z "$classpath" ] && classpath=$CLASSPATH; [ -z "$classpath" ] && classpath=. } _java_find_sourcepath () { local i; for (( i=1 ; i < COMP_CWORD ; i++ )) do if [[ "${COMP_WORDS[i]}" == -sourcepath ]]; then sourcepath=${COMP_WORDS[i+1]}; break; fi; done; [ -z "$sourcepath" ] && _java_find_classpath; sourcepath=$classpath } _java_packages () { local sourcepath i; _java_find_sourcepath; cur=${cur//.//}; for i in ${sourcepath//:/ }; do if [ -d $i ]; then COMPREPLY=(${COMPREPLY[@]} $( command ls -F -d $i/$cur* 2>/dev/null | sed -e 's|^'$i'/||' )); fi; done; COMPREPLY=($( echo ${COMPREPLY[@]} | tr " " "\n" | grep "/$" )); COMPREPLY=(${COMPREPLY[@]%/}); cur=${COMPREPLY[@]//\//.} } _java_path () { cur=${cur##*:}; _filedir '@(jar|zip)' } _javac () { COMPREPLY=(); local cur prev; cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; case $prev in -d) _filedir -d; return 0 ;; -@(classpath|bootclasspath|sourcepath|extdirs)) _java_path; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-g -g:none -g:lines -g:vars\ -g:source -O -nowarn -verbose -deprecation -classpath\ -sourcepath -bootclasspath -extdirs -d -encoding -source\ -target -help' -- $cur )); else _filedir java; fi } _javaconfig () { local cur curword numwords opts args arg spec flag sedcmd grepcmd; local multiplepkgs pkgs execopts; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; numwords=${#COMP_WORDS[*]}; curword=${COMP_CWORD}; opts=""; args=""; pkgs=""; sedcmd="sed -r -e s/\[([^]]+)\].*/\1/"; vmsedcmd="sed -r -e s/\[([^]]+)\]/\1/"; grepcmd="egrep -o (--set-(system|user)-(classpath|vm)=)"; multiplepkgs=""; execopts="HtmlConverter JavaPluginControlPanel appletviewer awt_robot extcheck idlj j2sdk-config jar jarsigner java java-rmi.cgijava_vm javac javadoc javah javap jdb keytool kinit klist ktab native2ascii oldjava oldjavac oldjdb orbd policytool realpath rmic rmid rmiregistry serialver servertool tnameserv"; if [[ "${cur}" == -* ]] || [ ${curword} -eq 1 ]; then case "${cur}" in "--java") opts="--java --javac --java-version" ;; --j@(a@(r|va@(c|-version))|@(dk|re)-home)) opts="" ;; --list-available-@(packages|vms)) opts="" ;; --@(exec|set-@(user|system)-@(classpath|vm))) opts="${cur}=" ;; --set-@(user|system)-@(classpath|vm)=) if [[ "${cur}" == "--set-system-vm=" ]] || [[ "${cur}" == "--set-user-vm=" ]]; then flag="--list-available-vms"; args=$(java-config "${flag}" | cut --delimiter=' ' --fields=2 | ${vmsedcmd}); else flag="--list-available-packages"; args=$(java-config "${flag}" | ${sedcmd}); fi; for arg in ${args}; do [ "${opts}" ] && opts="${opts} ${arg}" || opts="${arg}"; done; COMPREPLY=($(compgen $nospace -W "${opts}")); return 0 ;; "--exec=") COMPREPLY=($(compgen $nospace -W "${execopts}")); return 0 ;; *) if [[ "${cur}" == "--set-system-vm="* ]] || [[ "${cur}" == "--set-user-vm="* ]]; then args=$(java-config --list-available-vms | cut --delimiter=' ' --fields=2 | ${vmsedcmd}); if [[ "${cur}" == "--set-system-vm="* ]]; then spec=${cur##--set-system-vm=}; else spec=${cur##--set-user-vm=}; fi; for arg in ${args}; do if [[ "${arg:0:${#spec}}" == "${spec}" ]]; then [ "${opts}" ] && opts="${opts} ${arg}" || opts="${arg}"; fi; done; [[ "${opts}" == "${spec}" ]] && opts=""; COMPREPLY=($(compgen -W "${opts}")); return 0; else if [[ "${cur}" == "--set-system-classpath="* ]] || [[ "${cur}" == "--set-user-classpath="* ]]; then args=$(java-config --list-available-packages | ${sedcmd}); [ $(echo "${cur}" | grep -c ",") -gt 0 ] && multiplepkgs="true"; if [[ "${cur}" == "--set-system-classpath="* ]]; then spec="${cur##--set-system-classpath=}"; else spec="${cur##--set-user-classpath=}"; fi; if [[ -n "${multiplepkgs}" ]]; then pkgs="${spec%,*}"; spec="${spec##*,}"; fi; if [[ -n "${multiplepkgs}" ]]; then for arg in ${args}; do if [[ -n "${spec}" ]]; then if [[ "${arg:0:${#spec}}" == "${spec}" ]] && [[ ! -n $(echo "${cur}" | egrep -o "(=|,)${arg},") ]]; then [ "${opts}" ] && opts="${opts} ${pkgs},${arg}" || opts="${pkgs},${arg}"; fi; else if [[ ! -n $(echo "${cur}" | egrep -o "(=|,)${arg},") ]]; then [ "${opts}" ] && opts="${opts} ${pkgs},${arg}" || opts="${pkgs},${arg}"; fi; fi; done; [[ "${opts}" == "${pkgs},${spec}" ]] && opts=""; else for arg in ${args}; do if [[ -n "${spec}" ]] && [[ "${arg:0:${#spec}}" == "${spec}" ]]; then [ "${opts}" ] && opts="${opts} ${arg}" || opts="${arg}"; fi; done; [[ "${opts}" == "${spec}" ]] && opts=""; fi; COMPREPLY=($(compgen -W "${opts}")); return 0; else if [[ "${cur}" == "--exec="* ]]; then spec=${cur##--exec=}; for arg in ${execopts}; do if [[ "${arg:0:${#spec}}" == "${spec}" ]]; then [ "${opts}" ] && opts="${opts} ${arg}" || opts="${arg}"; fi; done; [[ "${opts}" == "${spec}" ]] && opts=""; COMPREPLY=($(compgen -W "${opts}")); return 0; else opts="--javac --java --jar --jdk-home --jre-home --java-version --classpath --full-classpath --exec --list-available-packages --list-available-vms --set-system-vm --set-user-vm --set-system-classpath --set-user-classpath --clean-system-classpath"; fi; fi; fi ;; esac; else opts=""; fi; COMPREPLY=($(compgen $nospace -W "${opts}" | grep ^${cur})); return 0 } _javadoc () { COMPREPLY=(); local cur prev; cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; case $prev in -@(overview|helpfile|stylesheetfile)) _filedir; return 0 ;; -d) _filedir -d; return 0 ;; -@(classpath|bootclasspath|docletpath|sourcepath|extdirs)) _java_path; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-overview -public -protected \ -package -private -help -doclet -docletpath \ -sourcepath -classpath -exclude -subpackages \ -breakiterator -bootclasspath -source -extdirs \ -verbose -locale -encoding -J -d -use -version \ -author -docfilessubdirs -splitindex \ -windowtitle -doctitle -header -footer -bottom \ -link -linkoffline -excludedocfilessubdir \ -group -nocomment -nodeprecated -noqualifier \ -nosince -nodeprecatedlist -notree -noindex \ -nohelp -nonavbar -quiet -serialwarn -tag \ -taglet -tagletpath -charset -helpfile \ -linksource -stylesheetfile -docencoding' -- $cur )); else _filedir java; _java_packages; fi } _kill () { local cur; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; if [ $COMP_CWORD -eq 1 ] && [[ "$cur" == -* ]]; then _signals; else _pids; fi } _killall () { local cur; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; if [ $COMP_CWORD -eq 1 ] && [[ "$cur" == -* ]]; then _signals; else COMPREPLY=($( compgen -W '$( command ps axo command | \ sed -ne "1d; s/^\[\?\([^-][^] ]*\).*$/\1/p" | \ sed -e "s/.*\///" )' -- $cur )); fi; return 0 } _known_hosts () { local cur ocur user suffix aliases global_kh user_kh hosts; local -a kh config; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; ocur=$cur; [ "$1" = -a ] || [ "$2" = -a ] && aliases='yes'; [ "$1" = -c ] || [ "$2" = -c ] && suffix=':'; [[ $cur == *@* ]] && user=${cur%@*}@ && cur=${cur#*@}; kh=(); [ -r /etc/ssh/ssh_config ] && config[0]=/etc/ssh/ssh_config; [ -r ~/.ssh/config ] && config[1]=~/.ssh/config; if [ ${#config[@]} -gt 0 ]; then global_kh=$( eval echo $( sed -ne 's/^[Gg][Ll][Oo][Bb][Aa][Ll][Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee]['' '']*\(.*\)$/\1/p' ${config[@]} ) ); user_kh=$( eval echo $( sed -ne 's/^[Uu][Ss][Ee][Rr][Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee]['' '']*\(.*\)$/\1/p' ${config[@]} ) ); fi; if [ -r "$global_kh" ]; then kh=("$global_kh"); else [ -r /etc/ssh/ssh_known_hosts ] && kh[0]=/etc/ssh/ssh_known_hosts; [ -r /etc/ssh/ssh_known_hosts2 ] && kh[1]=/etc/ssh/ssh_known_hosts2; [ -r /etc/known_hosts ] && kh[2]=/etc/known_hosts; [ -r /etc/known_hosts2 ] && kh[3]=/etc/known_hosts2; fi; if [ -r "$user_kh" ]; then kh=(${kh[@]} "$user_kh"); else [ -r ~/.ssh/known_hosts ] && kh=(${kh[@]} ~/.ssh/known_hosts); [ -r ~/.ssh/known_hosts2 ] && kh=(${kh[@]} ~/.ssh/known_hosts2); fi; if [ ${#kh[@]} -gt 0 ]; then cur=${cur//\//\\\/}; cur=${cur//\./\\\.}; if [[ "$cur" == [0-9]*.* ]]; then cur="^$cur.*"; else if [[ "$cur" == [0-9]* ]]; then cur="^$cur.*\."; else if [ -z "$cur" ]; then cur="[a-z.]"; else cur="^$cur"; fi; fi; fi; COMPREPLY=($( awk 'BEGIN {FS=","} {for (i=1; i<=2; ++i) { \ gsub(" .*$", "", $i); \ if ($i ~ /'$cur'/) {print $i} \ }}' ${kh[@]} 2>/dev/null )); if [ ${#config[@]} -gt 0 ] && [ -n "$aliases" ]; then hosts=$( compgen -W "$( echo $( sed -ne "s/^[Hh][Oo][Ss][Tt]["' '"]*\([^*?]*\)$/\1/p" ${config[@]} ) )" -- $ocur ); COMPREPLY=(${COMPREPLY[@]} $hosts); fi; for (( i=0 ; i < ${#COMPREPLY[@]} ; i++ )) do COMPREPLY[i]=$user${COMPREPLY[i]}$suffix; done; else COMPREPLY=($( compgen -A hostname -S "$suffix" -- $cur )); fi; return 0 } _links () { local cur; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; case "$cur" in --*) COMPREPLY=($( compgen -W '--help' -- $cur )) ;; -*) COMPREPLY=($( compgen -W '-async-dns -max-connections \ -max-connections-to-host -retries \ -receive-timeout -unrestartable-receive-timeout\ -format-cache-size -memory-cache-size \ -http-proxy -ftp-proxy -download-dir \ -assume-codepage -anonymous -dump -no-connect \ -source -version -help' -- $cur )) ;; *) if [ -r ~/.links/links.his ]; then COMPREPLY=($( compgen -W '$( < ~/.links/links.his )' -- $cur )); fi; _filedir '@(htm|html)'; return 0 ;; esac; return 0 } _longopt () { local cur opt; cur=${COMP_WORDS[COMP_CWORD]}; if [[ "$cur" == --*=* ]]; then opt=${cur%%=*}; opt=${opt%\\*}; cur=${cur#*=}; _filedir; COMPREPLY=($( compgen -P "$opt=" -W '${COMPREPLY[@]}' -- $cur)); return 0; fi; if [[ "$cur" == -* ]]; then COMPREPLY=($( $1 --help 2>&1 | sed -e '/--/!d' -e 's/.*\(--[-A-Za-z0-9]\+=\?\).*/\1/' | grep "^$cur" | sort -u )); else if [[ "$1" == @(mk|rm)dir ]]; then _filedir -d; else _filedir; fi; fi } _look () { local cur; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; if [ $COMP_CWORD = 1 ]; then COMPREPLY=($( compgen -W '$(look $cur)' )); fi } _make () { local makef cur prev i; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; case $prev in -@(f|o|W)) _filedir; return 0 ;; -@(I|C)) _filedir -d; return 0 ;; esac; if [[ "$cur" == *=* ]]; then prev=${cur/=*/}; cur=${cur/*=/}; case "$prev" in --@(file|makefile)) _filedir; return 0 ;; --@(directory|include-dir)) _filedir -d; return 0 ;; esac; fi; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-b -m -B -C -d -e -f -h -i -I\ -j -l -k -n -o -p -q -r -R - s -S -t -v -w -W \ --always-make --directory= --debug \ --environment-overrides --file= --makefile= --help \ --ignore-errors --include-dir= --jobs --load-average \ --max-load --keep-going --just-print --dry-run \ --recon --old-file= --assume-old= --print-data-base \ --question --no-builtin-rules --no-builtin-variables \ --silent --quiet --no-keep-goind --stop --touch \ --version --print-directory --no-print-directory \ --what-if= --new-file= --assume-new= \ --warn-undefined-variables' -- $cur )); else if [ -f GNUmakefile ]; then makef=GNUmakefile; else if [ -f makefile ]; then makef=makefile; else if [ -f Makefile ]; then makef=Makefile; else makef=*.mk; fi; fi; fi; for (( i=0 ; i < ${#COMP_WORDS[@]} ; i++ )) do if [[ ${COMP_WORDS[i]} == -f ]]; then eval makef=${COMP_WORDS[i+1]}; break; fi; done; [ ! -f $makef ] && return 0; COMPREPLY=($( awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ \ {split($1,A,/ /);for(i in A)print A[i]}' $makef 2>/dev/null | grep "^$cur" )); fi } _man () { local cur prev sect manpath UNAME; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; _expand || return 0; if [[ "$cur" == */* ]]; then _filedir; return 0; fi; UNAME=$( uname -s ); if [ $UNAME = GNU -o $UNAME = Linux -o $UNAME = FreeBSD ]; then manpath=$( manpath 2>/dev/null || command man --path ); else manpath=$MANPATH; fi; if [ -z "$manpath" ]; then COMPREPLY=($( compgen -c -- $cur )); return 0; fi; [[ "$prev" == [0-9ln] ]] && sect=$prev || sect='*'; manpath=$manpath:; if [ -n "$cur" ]; then manpath="${manpath//://*man$sect/$cur* }"; else manpath="${manpath//://*man$sect/ }"; fi; COMPREPLY=($( eval command ls "$manpath" 2>/dev/null )); COMPREPLY=(${COMPREPLY[@]##*/?(:)}); COMPREPLY=(${COMPREPLY[@]%.@(gz|bz2)}); COMPREPLY=($( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" )); [[ "$prev" != [0-9ln] ]] && _filedir '[0-9ln]'; return 0 } _mkisofs () { local cur prev; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; case "$prev" in -@(o|abstract|biblio|check-session|copyright|log-file|root-info|prep-boot|*-list)) _filedir; return 0 ;; -*-charset) COMPREPLY=($( mkisofs -input-charset help 2>&1 | tail +3 | grep "^$cur")); return 0 ;; -uid) _uids; return 0 ;; -gid) _gids; return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-abstract -A -allow-lowercase \ -allow-multidot -biblio -cache-inodes \ -no-cache-inodes -b -eltorito-alt-boot -B -G \ -hard-disk-boot -no-emul-boot -no-boot \ -boot-load-seg -boot-load-size \ -boot-info-table -C -c -check-oldname \ -check-session -copyright -d -D -dir-mode \ -dvd-video-f -file-mode -gid -gui \ -graft-points -hide -hide-list -hidden \ -hidden-list -hide-joliet -hide-joliet-list \ -hide-joliet-trans-tbl -hide-rr-moved \ -input-charset -output-charset -iso-level -J \ -joliet-long -jcharset -l -L -log-file -m \ -exclude-list -max-iso9660-filenames -M -N \ -new-dir-mode -nobak -no-bak -force-rr -no-rr \ -no-split-symlink-components \ -no-split-symlink-fields -o -pad -no-pad \ -path-list -P -p -print-size -quiet -R -r \ -relaxed-filenames -sort -split-output \ -stream-media-size -stream-file-name -sysid -T\ -table-name -ucs-level -udf -uid \ -use-fileversion -U -no-iso-translate -V \ -volset -volset-size -volset-seqno -v -x -z \ -hfs -apple -map -magic -hfs-creator \ -hfs-type -probe -no-desktop -mac-name \ -boot-hfs-file -part -auto -cluster-size \ -hide-hfs -hide-hfs-list -hfs-volid \ -icon-position -root-info -prep-boot \ -input-hfs-charset -output-hfs-charset \ -hfs-unlock -hfs-bless -hfs-parms --cap \ --netatalk --double --ethershare --ushare \ --exchange --sgi --xinet --macbin --single \ --dave --sfm --osx-double --osx-hfs' -- $cur )); else _filedir; fi } _mogrify () { local cur; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; _ImageMagick; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-affine -antialias -authenticate \ -background -black-threshold -blue-primary -blur \ -border -bordercolor -channel -charcoal -chop \ -colorize -colors -colorspace -comment -compress \ -contrast -convolve -crop -cycle -debug -delay \ -density -depth -despeckle -display -dispose -dither \ -draw -edge -emboss -encoding -endian -enhance \ -equalize -extract -fill -filter -flip -flop -font \ -format -frame -fuzz -gamma -gaussian -geometry \ -green-primary -implode -interlace -help -label -lat \ -level -limit -list -log -loop -map -mask -matte \ -median -modulate -monochrome -negate -noop \ -normalize -opaque -page -paint -fill -ordered-dither \ -pointsize -profile -quality -raise -random-threshold \ -red-primary -region -resample -resize -roll -rotate \ -sample -sampling-factor -scale -scene -seed -segment \ -shade -sharpen -shear -size -solarize -spread \ -stroke -strokewidth -swirl -texture -threshold \ -thumbnail -tile -transform -transparent -treedepth \ -trim -type -undercolor -units -unsharp -verbose \ -version -view -virtual-pixel -wave -white-point \ -white-threshold' -- $cur )); else if [[ "$cur" == +* ]]; then COMPREPLY=($( compgen -W '+compress +contrast +debug +dither \ +endian +gamma +label +map +mask +matte +negate +page \ +raise' -- $cur )); else _filedir; fi; fi } _montage () { local cur; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; _ImageMagick; if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '-adjoin -affine -authenticate \ -blue-primary -blur -colors -colorspace -comment \ -compose -compress -crop -debug -density -depth \ -display -dispose -dither -draw -encoding -endian \ -extract -fill -filter -flip -flop -frame -gamma \ -geometry -gravity -green-primary -interlace -help \ -label -limit -log -matte -mode -monochrome -noop \ -page -pointsize -quality -red-primary -resize \ -rotate -sampling-factor -scene -shadow -size \ -stroke -texture -thumbnail -tile -transform \ -transparent -treedepth -trim -type -verbose \ -version -virtual-pixel -white-point' -- $cur )); else if [[ "$cur" == +* ]]; then COMPREPLY=($( compgen -W '+adjoin +compress +debug +dither \ +endian +gamma +label +matte +page' -- $cur )); else _filedir; fi; fi } _mount () { local cur i sm host; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; [[ "$cur" == \\ ]] && cur="/"; for i in {,/usr}/{,s}bin/showmount; do [ -x $i ] && sm=$i && break; done; if [ -n "$sm" ] && [[ "$cur" == *:* ]]; then COMPREPLY=($( $sm -e ${cur%%:*} | sed 1d | grep ^${cur#*:} | awk '{print $1}' )); else if [[ "$cur" == //* ]]; then host=${cur#//}; host=${host%%/*}; if [ -n "$host" ]; then COMPREPLY=($( compgen -W "$( echo $( smbclient -d 0 -NL $host | sed -ne '/^['' '']*Sharename/,/^$/p' | sed -ne '3,$s|^[^A-Za-z]*\([^'' '']*\).*$|//'$host'/\1|p' ) )" -- "$cur" )); fi; else if [ -r /etc/vfstab ]; then COMPREPLY=($( awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' /etc/vfstab | grep "^$cur" )); else COMPREPLY=($( awk '! /^[ \t]*#/ {if ($2 ~ /\//) print $2}' /etc/fstab | grep "^$cur" )); fi; fi; fi; return 0 } _mplayer () { local cmd cur prev skinsdir IFS=' ' i j k=0; COMPREPLY=(); cmd=${COMP_WORDS[0]}; cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; case "$prev" in -@(ac|afm|vc|vfm|ao|vo|vop|fstype)) _mplayer_options_list mplayer $prev; return 0 ;; -@(oac|ovc|of)) _mplayer_options_list mencoder $prev; return 0 ;; -audiofile) _filedir '@(mp3|MP3|mpg|MPG|ogg|OGG|wav|WAV)'; return 0 ;; -font) _filedir '@(desc|ttf)'; return 0 ;; -sub) _filedir '@(srt|SRT|sub|SUB|txt|TXT|utf|UTF|rar|RAR)'; return 0 ;; -vobsub) _filedir '@(idx|IDX|ifo|IFO|sub|SUB)'; IFS=' '; COMPREPLY=($( for i in ${COMPREPLY[@]}; do if [ -f $i -a -r $i ]; then echo ${i%.*} else echo $i fi done )); IFS=' '; return 0 ;; -ifo) _filedir '@(ifo|IFO)'; return 0 ;; -cuefile) _filedir '@(bin|BIN|cue|CUE)'; return 0 ;; -skin) if [ -n "$MPLAYER_SKINS_DIR" ]; then skinsdir=$MPLAYER_SKINS_DIR; else skinsdir=/usr/local/share/mplayer/Skin; fi; IFS=' '; for i in ~/.mplayer/Skin $skinsdir; do if [ -d $i -a -r $i ]; then for j in $( compgen -d $i/$cur ); do COMPREPLY[$k]=${j#$i/}; k=$((++k)); done; fi; done; IFS=' '; return 0 ;; -@(mixer|@(cdrom|dvd)-device|dvdauth|fb|zrdev)) cur=${cur:=/dev/}; _filedir; return 0 ;; -@(edl?(out)|lircconf|menu-cfg|playlist|csslib|dumpfile) | -@(subfile|vobsub|aofile|fbmodeconfig|include|o|dvdkey) | -passlogfile) _filedir; return 0 ;; -@(auto@(q|sync)|loop|menu-root|speed|sstep|aid|alang) | -@(?(@(audio|sub)-)demuxer|bandwidth|cache|chapter) | -@(dvd?(angle)|fps|frames|mc|passwd|user|sb|srate|ss|vcd) | -@(vi?(d|vo)|ffactor|sid|slang|spu@(align|aa|gauss)) | -@(vobsubid|delay|bpp|brightness|contrast|dfbopts|display) | -@(fbmode|geometry|guiwid|hue|icelayer|screen[wh]|wid) | -@(monitor@(aspect|_@(dotclock|[hv]freq))|panscan|saturation) | -@(xineramascreen|zr@(crop|norm|quality|[xy]doff|[vh]dec)) | -@(aspect|pp|x|y|xy|z|stereo|audio-@(density|delay|preload)) | -@(endpos|osdlevel|ffourcc|sws|channels|skiplimit|format) | -@(ofps|aa@(driver|@(osd|sub)color)|vobsubout?(i@(ndex|d))) | -sub@(-bg-@(alpha|color)|cp|delay|fps|pos|align|width) | -sub@(font-@(blur|outline|autoscale|encoding|@(osd|text)-scale))) return 0 ;; -lavdopts) COMPREPLY=($( compgen -W 'ec er= bug= idct= gray' -- $cur )); return 0 ;; -lavcopts) COMPREPLY=($( compgen -W 'vcodec= vqmin= vqscale= \ vqmax= mbqmin= mbqmax= vqdiff= \ vmax_b_frames= vme= vhq v4mv \ keyint= vb_strategy= vpass= \ aspect= vbitrate= vratetol= \ vrc_maxrate= vrc_minrate= \ vrc_buf_size= vb_qfactor= vi_qfactor= \ vb_qoffset= vi_qoffset= vqblur= \ vqcomp= vrc_eq= vrc_override= \ vrc_init_cplx= vqsquish= vlelim= \ vcelim= vstrict= vdpart vpsize= gray \ vfdct= idct= lumi_mask= dark_mask= \ tcplx_mask= scplx_mask= naq ildct \ format= pred qpel precmp= cmp= \ subcmp= predia= dia= trell last_pred= \ preme= subq= psnr mpeg_quant aic umv' -- $cur )); return 0 ;; -ssf) COMPREPLY=($( compgen -W 'lgb= cgb= ls= cs= chs= \ cvs=' -- $cur )); return 0 ;; -jpeg) COMPREPLY=($( compgen -W 'noprogressive progressive \ nobaseline baseline optimize= \ smooth= quality= outdir=' -- $cur )); return 0 ;; -xvidopts) COMPREPLY=($( compgen -W 'dr2 nodr2' -- $cur )); return 0 ;; -xvidencopts) COMPREPLY=($( compgen -W 'pass= bitrate= \ fixed_quant= me_quality= 4mv \ rc_reaction_delay_factor= \ rc_averaging_period= rc_buffer= \ quant_range= min_key_interval= \ max_key_interval= mpeg_quant \ mod_quant lumi_mask hintedme \ hintfile debug keyframe_boost= \ kfthreshold= kfreduction=' -- $cur )); return 0 ;; -divx4opts) COMPREPLY=($( compgen -W 'br= key= deinterlace q= \ min_quant= max_quant= rc_period= \ rc_reaction_period= crispness= \ rc_reaction_ratio= pass= vbrpass= \ help' -- $cur )); return 0 ;; -info) COMPREPLY=($( compgen -W 'name= artist= genre= \ subject= copyright= srcform= \ comment= help' -- $cur )); return 0 ;; -lameopts) COMPREPLY=($( compgen -W 'vbr= abr cbr br= q= aq= \ ratio= vol= mode= padding= fast \ preset= help' -- $cur )); return 0 ;; -rawaudio) COMPREPLY=($( compgen -W 'on channels= rate= \ samplesize= format=' -- $cur )); return 0 ;; -rawvideo) COMPREPLY=($( compgen -W 'on fps= sqcif qcif cif \ 4cif pal ntsc w= h= y420 yv12 yuy2 \ y8 format= size=' -- $cur )); return 0 ;; -aop) COMPREPLY=($( compgen -W 'list= delay= format= fout= \ volume= mul= softclip' -- $cur )); return 0 ;; -dxr2) COMPREPLY=($( compgen -W 'ar-mode= iec958-encoded \ iec958-decoded mute ucode= 75ire bw \ color interlaced macrovision= norm= \ square-pixel ccir601-pixel cr-left= \ cr-right= cr-top= cr-bot= ck-rmin= \ ck-gmin= ck-bmin= ck-rmax= ck-gmax= \ ck-bmax= ck-r= ck-g= ck-b= \ ignore-cache= ol-osd= olh-cor= \ olw-cor= olx-cor= oly-cor= overlay \ overlay-ratio= update-cache' -- $cur )); return 0 ;; -tv) COMPREPLY=($( compgen -W 'on noaudio driver= device= \ input= freq= outfmt= width= height= \ buffersize= norm= channel= chanlist= \ audiorate= forceaudio alsa amode= \ forcechan= adevice= audioid= volume= \ bass= treble= balance= fps= \ channels= immediatemode=' -- $cur )); return 0 ;; -mf) COMPREPLY=($( compgen -W 'on w= h= fps= type=' -- $cur )); return 0 ;; -cdda) COMPREPLY=($( compgen -W 'speed= paranoia= \ generic-dev= sector-size= overlap= \ toc-bias toc-offset= skip noskip' -- $cur )); return 0 ;; -input) COMPREPLY=($( compgen -W 'conf= ar-delay ar-rate \ keylist cmdlist js-dev file' -- $cur )); return 0 ;; -af) COMPREPLY=($( compgen -W 'resample resample= \ channels channels= format format= \ volume volume= delay delay= pan \ pan= sub sub= surround surround=' -- $cur )); return 0 ;; -af-adv) COMPREPLY=($( compgen -W 'force= list=' -- $cur )); return 0 ;; esac; case "$cur" in -*) COMPREPLY=($( compgen -W '-aid -alang -audio-demuxer \ -audiofile -cdrom-device -cache -cdda \ -channels -chapter -csslib -demuxer \ -dvd -dvd-device -dvdangle -dvdauth \ -dvdkey -dvdnav -forceidx -fps -frames \ -hr-mp3-seek -idx -mc -mf -ni -nobps \ -passwd -rawaudio -rtsp-stream-over-tcp\ -skipopening -sb -srate -ss -tv -user \ -vcd -vid -vivo -ifo -ffactor -font \ -noautosub -nooverlapsub -sid -slang \ -sub -subcc -subcp -sub-demuxer \ -subdelay -subfont-autoscale \ -subfont-blur -subfont-encoding \ -subfont-osd-scale -subfont-outline \ -subfont-text-scale -subfps -subfile \ -subpos -unicode -utf8 -vobsub \ -vobsubid -ac -afm -aspect -flip \ -lavdopts -noaspect -nosound -pp -ssf \ -stereo -sws -vc -vfm -vop -xvidopts\ -xy -zoom -bandwidth -cuefile \ -noextbased -rawvideo -overlapsub \ -sub-bg-alpha -sub-bg-color -subalign \ -subwidth -sub-no-text-pp -spualign \ -spuaa -spugauss -pphelp -verbose -v \ -noni -noidx -nohr-mp3-seek -extbased \ -bps -oldpp -nozoom -noflip -nounicode \ -noutf8' -- $cur )); [[ "$cmd" == @(?(g)mplayer) ]] && COMPREPLY=(${COMPREPLY[@]} $(compgen -W '-autoq -autosync -benchmark \ -framedrop -h -help -hardframedrop \ -identify -input -lircconf -loop \ -nojoystick -nolirc -nortc -playlist \ -quiet -really-quiet -rnd -sdp -skin \ -slave -softsleep -speed -sstep \ -use-stdin -dumpaudio -dumpfile \ -dumpstream -dumpvideo -dumpmicrodvdsub\ -dumpmpsub -dumpsrtsub -dumpjacosub \ -dumpsami -dumpsub -osdlevel -af \ -af-adv -ao -aofile -aop -delay -mixer \ -nowaveheader -bpp -brightness \ -contrast -display -double -dr -dxr2 \ -fb -fbmode -fbmodeconfig -forcexv -fs \ -geometry -hue -icelayer -jpeg \ -monitor_dotclock -monitor_hfreq \ -monitor_vfreq -monitoraspect \ -nograbpointer -noslices -panscan \ -rootwin -saturation -screenw -screenh \ -stop_xscreensaver -vm -vo -vsync -wid \ -xineramascreen -z -zrbw -zrcrop \ -zrdev -zrfd -zrhelp -zrnorm -zrquality \ -zrvdec -zrhdec -zrxdoff -zrydoff -y \ -edl -edlout -enqueue -fixed-vo \ -menu -menu-root -menu-cfg -shuffle \ -format -aahelp -dfbopts -fstype \ -guiwid -nokeepaspect -x --help \ -aaosdcolor -aasubcolor -aadriver \ -aaextended -aaeight' -- $cur)); [[ "$cmd" = mencoder ]] && COMPREPLY=(${COMPREPLY[@]} $(compgen -W '-audio-density -audio-delay \ -audio-preload -divx4opts -endpos \ -ffourcc -include -info -lameopts \ -lavcopts -noskip -o -oac -ofps -ovc \ -passlogfile -skiplimit -vobsubout \ -vobsuboutindex -vobsuboutid \ -xvidencopts -of --verbose' -- $cur)) ;; *) _filedir '@(mp?(e)g|MP?(E)G|wm[av]|avi|AVI|asf|vob|VOB|bin|dat|vcd|ps|pes|fli|viv|rm|ram|yuv|mov|MOV|qt|QT|mp[34]|MP[34]|og[gm]|OG[GM]|wav|WAV|dump|DUMP|mkv|MKV|m4a|aac|m2v)' ;; esac; return 0 } _mplayer_options_list () { cur=${cur%\\}; COMPREPLY=($( $1 $2 help 2> /dev/null | sed -e '1,/^Available/d' | awk '{print $1}' | sed -e 's/:$//' -e 's/^'${2#-}'$//' -e 's/<.*//' | grep "^$cur" )) } _mysqladmin () { local cur prev; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; case "$prev" in -u) COMPREPLY=($( compgen -u -- $cur )); return 0 ;; *) ;; esac; COMPREPLY=($( compgen -W '-# -f -? -C -h -p -P -i -r -E -s -S -t -u \ -v -V -w' -- $cur )); COMPREPLY=(${COMPREPLY[@]} $( compgen -W 'create drop extended-status flush-hosts \ flush-logs flush-status flush-tables \ flush-threads flush-privileges kill \ password ping processlist reload refresh \ shutdown status variables version' -- $cur )) } _nslookup () { local cur; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]#-}; COMPREPLY=($( compgen -P '-' -W 'all class= debug d2 domain= \ srchlist= defname search port= querytype= \ type= recurse retry root timeout vc \ ignoretc' -- $cur )) } _openglupdate () { local cur opts; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; numwords=${#COMP_WORDS[*]}; if [ ${numwords} -gt 2 ]; then return 0; fi; COMPREPLY=($(compgen -W 'nvidia xfree' $cur)); COMPREPLY=($(echo " ${COMP_WORDS[@]}" | (while read -d ' ' i; do [ "$i" == "" ] && continue # flatten array with spaces on either side, # otherwise we cannot grep on word # boundaries of first and last word COMPREPLY=" ${COMPREPLY[@]} " # remove word from list of completions COMPREPLY=( ${COMPREPLY/ $i / }) done echo ${COMPREPLY[@]}))); return 0 } _openssl () { local cur; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=($( compgen -W 'asn1parse ca ciphers crl crl2pkcs7 \ dgst dh dhparam dsa dsaparam enc errstr gendh gendsa \ genrsa nseq passwd pkcs12 pkcs7 pkcs8 rand req rsa \ rsautl s_client s_server s_time sess_id smime speed \ spkac verify version x509 md2 md4 md5 mdc2 rmd160 sha \ sha1 base64 bf bf-cbc bf-cfb bf-ecb bf-ofb cast \ cast-cbc cast5-cbc cast5-cfb cast5-ecb cast5-ofb des \ des-cbc des-cfb des-ecb des-ede des-ede-cbc \ des-ede-cfb des-ede-ofb des-ede3 des-ede3-cbc \ des-ede3-cfb des-ede3-ofb des-ofb des3 desx rc2 \ rc2-40-cbc rc2-64-cbc rc2-cbc rc2-cfb rc2-ecb rc2-ofb \ rc4 rc4-40' -- $cur )); fi; return 0 } _perl () { local cur prev prefix temp; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; prefix=""; if [[ "$cur" == -?* ]]; then temp=$cur; prev=${temp:0:2}; cur=${temp:2}; prefix=$prev; fi; case "$prev" in -m | -M) _perlmodules; return 0 ;; esac; if [ $COMP_CWORD -eq 1 ] && [[ "$cur" != -* ]]; then _filedir; return 0; fi; COMPREPLY=($( compgen -W '-C -s -T -u -U -W -X -h -v -V -c -w -d -D -p \ -n -a -F -l -0 -I -m -M -P -S -x -i -e ' -- $cur )); return 0 } _perldoc () { local cur prev prefix temp; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; prefix=""; if [[ "$cur" == -?* ]]; then temp=$cur; prev=${temp:0:2}; cur=${temp:2}; prefix=$prev; fi; case $prev in -f) COMPREPLY=($( compgen -W 'chomp chop chr crypt hex index lc \ lcfirst length oct ord pack q qq reverse rindex sprintf \ substr tr uc ucfirst y m pos quotemeta s split study qr abs \ atan2 cos exp hex int log oct rand sin sqrt srand pop push \ shift splice unshift grep join map qw reverse sort unpack \ delete each exists keys values binmode close closedir \ dbmclose dbmopen die eof fileno flock format getc print \ printf read readdir rewinddir seek seekdir select syscall \ sysread sysseek syswrite tell telldir truncate warn write \ pack read syscall sysread syswrite unpack vec -X chdir chmod \ chown chroot fcntl glob ioctl link lstat mkdir open opendir \ readlink rename rmdir stat symlink umask unlink utime caller \ continue do dump eval exit goto last next redo return \ sub wantarray caller import local my our package use defined \ formline reset scalar undef \ alarm exec fork getpgrp getppid getpriority kill pipe qx \ setpgrp setpriority sleep system times wait waitpid \ import no package require use bless dbmclose dbmopen package \ ref tie tied untie use accept bind connect getpeername \ getsockname getsockopt listen recv send setsockopt shutdown \ socket socketpair msgctl msgget msgrcv msgsnd semctl semget \ semop shmctl shmget shmread shmwrite endgrent endhostent \ endnetent endpwent getgrent getgrgid getgrnam getlogin \ getpwent getpwnam getpwuid setgrent setpwent endprotoent \ endservent gethostbyaddr gethostbyname gethostent \ getnetbyaddr getnetbyname getnetent getprotobyname \ getprotobynumber getprotoent getservbyname getservbyport \ getservent sethostent setnetent setprotoent setservent \ gmtime localtime time times' -- $cur )); return 0 ;; esac; case $cur in -*) COMPREPLY=($( compgen -W '-h -v -t -u -m -l -F -X -f -q' -- $cur )); return 0 ;; */*) return 0 ;; *) _perlmodules; 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 )); return 0 ;; esac } _perlmodules () { COMPREPLY=($( compgen -P "$prefix" -W "$( perl -e 'sub mods { my ($base,$dir)=@_; return if $base !~ /^\Q$ENV{cur}/; chdir($dir) or return; for (glob(q[*.pm])) {s/\.pm$//; print qq[$base$_\n]}; mods(/^(?:[.\d]+|$Config{archname}-$Config{osname}|auto)$/ ? undef : qq[${base}${_}\\\\:\\\\:],qq[$dir/$_]) for grep {-d} glob(q[*]); } mods(undef,$_) for @INC;' )" -- $cur )) } _pgids () { COMPREPLY=($( compgen -W '$( command ps axo pgid | sed 1d )' -- $cur )) } _pids () { COMPREPLY=($( compgen -W '$( command ps axo pid | sed 1d )' -- $cur )) } _python () { local prev cur; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; case "$prev" in -Q) COMPREPLY=($( compgen -W "old new warn warnall" -- $cur )); return 0 ;; -W) COMPREPLY=($( compgen -W "ignore default all module once error" -- $cur )); return 0 ;; -c) _filedir '@(py|pyc|pyo)'; return 0 ;; !(python|-?)) [[ ${COMP_WORDS[COMP_CWORD-2]} != -@(Q|W) ]] && _filedir ;; esac; for (( i=0 ; i < ${#COMP_WORDS[@]}-1 ; i++ )) do if [[ ${COMP_WORDS[i]} == -c ]]; then _filedir; fi; done; if [[ "$cur" != -* ]]; then _filedir '@(py|pyc|pyo)'; else COMPREPLY=($( compgen -W "- -d -E -h -i -O -Q -S -t -u -U -v -V -W -x -c" -- $cur )); fi; return 0 } _rc () { local cur; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; if [ ${#COMP_WORDS[*]} -le 2 ]; then COMPREPLY=($( compgen -W "$(for i in /etc/runlevels/*; do echo ${i##*/}; done)" -- $cur )); fi; return 0 } _rcs () { local cur prev file dir; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; file=${cur##*/}; dir=${cur%/*}; [ "$file" = "$dir" ] && dir=.; COMPREPLY=($( compgen -f "$dir/RCS/$file" )); for (( i=0 ; i < ${#COMPREPLY[@]} ; i++ )) do file=${COMPREPLY[$i]##*/}; file=${file%,v}; dir=${COMPREPLY[$i]%RCS/*}; COMPREPLY[$i]=$dir$file; done; [ ${#COMPREPLY[@]} -eq 0 -a $1 = ci ] && _filedir || _filedir -d } _rcstatus () { local cur opts; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; if [ ${#COMP_WORDS[*]} -le 2 ]; then opts="-a -all -l --list -u --unused"; COMPREPLY=($( compgen -W "${opts} $(for i in /etc/runlevels/*; do echo ${i##*/}; done)" -- $cur )); fi; return 0 } _rcupdate () { local cur prev initdir runlvdir origdir; origdir=${PWD}; initdir=/etc/init.d; runlvdir=/etc/runlevels; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=($( compgen -W 'add del' ${cur} )); else if [ $COMP_CWORD -eq 2 ]; then cd ${initdir}; COMPREPLY=($( compgen -G "${cur}*" )); cd ${origdir}; else if [ $COMP_CWORD -eq 3 ]; then cd ${runlvdir}; COMPREPLY=($( compgen -G "${cur}*" )); cd ${origdir}; fi; fi; fi; return 0 } _renice () { local command cur curopt i; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; command=$1; i=0; while [ $i -le $COMP_CWORD -a ${#COMPREPLY[@]} -eq 0 ]; do curopt=${COMP_WORDS[COMP_CWORD-$i]}; case "$curopt" in -u) COMPREPLY=($( compgen -u -- $cur )) ;; -g) _pgids ;; -p | $command) _pids ;; esac; i=$(( ++i )); done } _rmmod () { local cur; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; COMPREPLY=($( /sbin/lsmod | awk '{if (NR != 1 && $1 ~ /^'$cur'/) print $1}' 2>/dev/null )); return 0 } _root_command () { PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin _command $1 $2 $3 } _route () { local cur prev; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; if [ "$prev" = dev ]; then COMPREPLY=($( ifconfig -a | sed -ne 's|^\('$cur'[^ ]*\).*$|\1|p' )); return 0; fi; COMPREPLY=($( compgen -W 'add del -host -net netmask metric mss \ window irtt reject mod dyn reinstate dev \ default gw' -- $cur )); COMPREPLY=($( echo " ${COMP_WORDS[@]}" | (while read -d ' ' i; do [ "$i" == "" ] && continue # flatten array with spaces on either side, # otherwise we cannot grep on word # boundaries of first and last word COMPREPLY=" ${COMPREPLY[@]} " # remove word from list of completions COMPREPLY=( ${COMPREPLY/ $i / } ) done echo ${COMPREPLY[@]}) )); return 0 } _rpm () { local cur prev ver options; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; options=""; ver=$(rpm --version); ver=${ver##* }; if [[ "$ver" > "4.0.4" ]]; then options="--nodigest"; fi; if [[ "$ver" > "4.0.99" ]]; then options="$options --nosignature"; fi; if [ $COMP_CWORD -eq 1 ]; then case "$cur" in -b*) COMPREPLY=($( compgen -W '-ba -bb -bc -bi -bl -bp -bs' -- $cur )) ;; -t*) COMPREPLY=($( compgen -W '-ta -tb -tc -ti -tl -tp -ts' -- $cur )) ;; --*) COMPREPLY=($( compgen -W '--help --version --initdb \ --checksig --recompile --rebuild --resign --addsign \ --rebuilddb --showrc --setperms --setugids --tarbuild \ --eval --install --upgrade --query --freshen --erase \ --verify --querytags --rmsource --rmspec --clean \ --import' -- $cur )) ;; *) COMPREPLY=($( compgen -W '-b -e -F -i -q -t -U -V' -- $cur )) ;; esac; return 0; fi; case "$prev" in --@(@(db|exclude)path|prefix|relocate|root)) _filedir -d; return 0 ;; --eval) COMPREPLY=($( sed -ne 's|^\(%'${cur#\%}'[^ '' '']*\).*$|\1|p' /usr/lib/rpm/macros )); return 0 ;; --pipe) COMPREPLY=($( compgen -c -- $cur )); return 0 ;; --rcfile) _filedir; return 0 ;; --specfile) _filedir spec; return 0 ;; --whatprovides) if [[ "$cur" == */* ]]; then _filedir; else COMPREPLY=($( rpm -qa $options --queryformat '%{providename}\n' | grep "^$cur" )); fi; return 0 ;; --whatrequires) COMPREPLY=($( rpm -qa $options --queryformat '%{requirename}\n' | grep "^$cur" )); return 0 ;; esac; case "${COMP_WORDS[1]}" in -@([iFU]*|-install|-freshen|-upgrade)) if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--percent --force --test \ --replacepkgs --replacefiles --root --excludedocs \ --includedocs --noscripts --rcfile --ignorearch \ --dbpath --prefix --ignoreos --nodeps --allfiles \ --ftpproxy --ftpport --justdb --httpproxy --httpport \ --noorder --relocate --badreloc --notriggers \ --excludepath --ignoresize --oldpackage --define \ --eval --pipe --queryformat --repackage --nosuggests \ --nodigest --nosignature' -- $cur )); else _filedir 'rpm'; fi ;; -@(e|-erase)) if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--allmatches --noscripts \ --notriggers --nodeps --test --repackage' -- $cur )); else _rpm_installed_packages; fi ;; -@(q*|-query)) if [ "${COMP_LINE#* -*([^ -])f}" != "$COMP_LINE" ]; then if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--scripts --root \ --rcfile --requires --ftpport --ftpproxy \ --httpproxy --httpport --provides --triggers \ --dump --changelog --dbpath \ --last --filesbypkg \ --info --list --state \ --docfiles --configfiles --queryformat \ --conflicts --obsoletes \ --nodigest --nosignature \ --triggerscripts' -- $cur )); else _filedir; fi; else if [ "${COMP_LINE#* -*([^ -])g}" != "$COMP_LINE" ]; then _rpm_groups; else if [ "${COMP_LINE#* -*([^ -])p}" != "$COMP_LINE" ]; then if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--scripts --root \ --rcfile --whatprovides --whatrequires \ --requires --triggeredby --ftpport --ftpproxy \ --httpproxy --httpport --provides --triggers \ --dump --changelog --dbpath --filesbypkg \ --define --eval --pipe --showrc --info --list \ --state --docfiles --configfiles --queryformat\ --conflicts --obsoletes --nodigest \ --nosignature' -- $cur )); else _filedir 'rpm'; fi; else if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--scripts --root \ --rcfile --whatprovides --whatrequires \ --requires --triggeredby --ftpport --ftpproxy \ --httpproxy --httpport --provides --triggers \ --dump --changelog --dbpath --specfile \ --querybynumber --last --filesbypkg --define \ --eval --pipe --showrc --info --list --state \ --docfiles --configfiles --queryformat \ --conflicts --obsoletes --pkgid --hdrid \ --fileid --tid --nodigest --nosignature \ --triggerscripts' -- $cur )); else if [ "${COMP_LINE#* -*([^ -])a}" == "$COMP_LINE" ]; then _rpm_installed_packages; fi; fi; fi; fi; fi ;; -@(K*|-checksig)) if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--nopgp --nogpg --nomd5 \ --nodigest --nosignature' -- $cur )); else _filedir 'rpm'; fi ;; -@([Vy]*|-verify)) if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--root --rcfile --dbpath \ --nodeps --nogroup --nolinkto --nomode --nomtime \ --nordev --nouser --nofiles --noscripts --nomd5 \ --querytags --specfile --whatrequires --whatprovides \ --nodigest --nosignature' -- $cur )); else if [ "${COMP_LINE#* -*([^ -])f}" != "$COMP_LINE" ]; then _filedir; else if [ "${COMP_LINE#* -*([^ -])g}" != "$COMP_LINE" ]; then _rpm_groups; else if [ "${COMP_LINE#* -*([^ -])p}" != "$COMP_LINE" ]; then _filedir 'rpm'; else _rpm_installed_packages; fi; fi; fi; fi ;; -[bt]*) if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--short-circuit --timecheck \ --clean --rmsource --rmspec --test --sign --buildroot \ --target -- buildarch --buildos --nobuild --nodeps \ --nodirtokens' -- $cur )); else if [[ ${COMP_WORDS[1]} == -b* ]]; then _filedir 'spec'; else _filedir '@(tgz|tar.@(gz|bz2))'; fi; fi ;; --re@(build|compile)) if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--nodeps --rmsource \ --rmspec --sign --nodirtokens --target' -- $cur )); else _filedir '?(no)src.rpm'; fi ;; --tarbuild) _filedir '@(tgz|tar.@(gz|bz2))' ;; --@(re|add)sign) _filedir 'rpm' ;; --set@(perms|gids)) _rpm_installed_packages ;; --@(clean|rms@(ource|pec))) if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--clean --rmsource \ --rmspec' -- $cur )); else _filedir 'spec'; fi ;; --@(import|dbpath|root)) if [[ "$cur" == -* ]]; then COMPREPLY=($( compgen -W '--import --dbpath --root' -- $cur )); else _filedir; fi ;; esac; return 0 } _rpm_groups () { local IFS=' '; cur=${cur%"\\"}; COMPREPLY=($( rpm -qa $options --queryformat '%{group}\n' | grep "^$cur" )); COMPREPLY=($( echo ${COMPREPLY[@]} | sed 's/ /\\ /g' | tr '\n' '\t' )) } _rpm_installed_packages () { local i; if [ -r /var/log/rpmpkgs -a /var/log/rpmpkgs -nt /var/lib/rpm/Packages ]; then COMPREPLY=($( sed -ne 's|^\('$cur'.*\)-[0-9a-zA-Z._]\+-[0-9a-z.@]\+.*\.rpm$|\1|p' /var/log/rpmpkgs )); else COMPREPLY=($( rpm -qa $options | sed -ne 's|^\('$cur'.*\)-[0-9a-zA-Z._]\+-[0-9a-z.@]\+$|\1|p' )); fi } _rsync () { local cur prev shell i userhost path; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; _expand || return 0; case "$prev" in --@(config|password-file|include-from|exclude-from)) _filedir; return 0 ;; -@(T|-temp-dir|-compare-dest)) _filedir -d; return 0 ;; -@(e|-rsh)) COMPREPLY=($( compgen -W 'rsh ssh' -- $cur )); return 0 ;; esac; case "$cur" in -*) COMPREPLY=($( compgen -W '-v -q -c -a -r -R -b -u -l -L -H \ -p -o -g -D -t -S -n -W -x -B -e -C -I -T -P \ -z -h -4 -6 --verbose --quiet --checksum \ --archive --recursive --relative --backup \ --backup-dir --suffix= --update --links \ --copy-links --copy-unsafe-links --safe-links \ --hard-links --perms --owner --group --devices\ --times --sparse --dry-run --whole-file \ --no-whole-file --one-file-system \ --block-size= --rsh= --rsync-path= \ --cvs-exclude --existing --ignore-existing \ --delete --delete-excluded --delete-after \ --ignore-errors --max-delete= --partial \ --force --numeric-ids --timeout= \ --ignore-times --size-only --modify-window= \ --temp-dir= --compare-dest= --compress \ --exclude= --exclude-from= --include= \ --include-from= --version --daemon --no-detach\ --address= --config= --port= --blocking-io \ --no-blocking-io --stats --progress \ --log-format= --password-file= --bwlimit= \ --write-batch= --read-batch= --help' -- $cur )) ;; *:*) shell=rsh; for (( i=1 ; i < COMP_CWORD ; i++ )) do if [[ "${COMP_WORDS[i]}" == -@(e|-rsh) ]]; then shell=${COMP_WORDS[i+1]}; break; fi; done; if [[ "$shell" == ssh ]]; then cur=${cur/\\:/:}; userhost=${cur%%?(\\):*}; path=${cur#*:}; path=${path//\\\\\\\\ / }; if [ -z "$path" ]; then path=$(ssh -o 'Batchmode yes' $userhost pwd 2>/dev/null); fi; COMPREPLY=($( ssh -o 'Batchmode yes' $userhost command ls -aF1d "$path*" 2>/dev/null | sed -e 's/ /\\\\\\\ /g' -e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' )); fi ;; *) _known_hosts -c -a; _filedir ;; esac; return 0 } _scp () { local cur userhost path; local IFS=' '; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; _expand || return 0; if [[ "$cur" == *:* ]]; then cur=${cur/\\:/:}; userhost=${cur%%?(\\):*}; path=${cur#*:}; path=${path//\\\\\\\\ / }; if [ -z "$path" ]; then path=$(ssh -o 'Batchmode yes' $userhost pwd 2>/dev/null); fi; COMPREPLY=($( ssh -o 'Batchmode yes' $userhost command ls -aF1d "$path*" 2>/dev/null | sed -e 's/ /\\\\\\\ /g' -e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' )); return 0; fi; [[ "$cur" == */* ]] || _known_hosts -c -a; COMPREPLY=(${COMPREPLY[@]} $( command ls -aF1d $cur* 2>/dev/null | sed -e 's/ /\\ /g' -e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' )); return 0 } _screen () { local cur prev; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; test "$COMP_CWORD" -ge 2 && preprev=${COMP_WORDS[COMP_CWORD-2]} || unset preprev; if test "$preprev" = "-d" -o "$preprev" = "-D" -a "$prev" = "-r" -o "$prev" = "-R"; then COMPREPLY=($( command screen -ls | sed -ne 's|^['' '']\+[0-9]\+\.\('$cur'[^'' '']\+\).*$|\1|p' )); else case "$prev" in -[rR]) COMPREPLY=($( command screen -ls | sed -ne 's|^['' '']\+[0-9]\+\.\('$cur'[^'' '']\+\).*Detached.*$|\1|p' )) ;; -[dDx]) COMPREPLY=($( command screen -ls | sed -ne 's|^['' '']\+[0-9]\+\.\('$cur'[^'' '']\+\).*Attached.*$|\1|p' )) ;; -s) COMPREPLY=($( grep ^${cur:-[^#]} /etc/shells )) ;; *) ;; esac; fi; return 0 } _service () { local cur sysvdir; COMPREPLY=(); prev=${COMP_WORDS[COMP_CWORD-1]}; cur=${COMP_WORDS[COMP_CWORD]}; [[ ${COMP_WORDS[0]} != @(*init.d/!(functions|~)|service) ]] && return 0; [ $COMP_CWORD -gt 2 ] && return 0; [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d; if [[ $COMP_CWORD -eq 1 ]] && [[ $prev == "service" ]]; then COMPREPLY=($( compgen -W '`echo $sysvdir/!(*.rpmsave|*.rpmorig)`' )); COMPREPLY=($( compgen -W '${COMPREPLY[@]#$sysvdir/}' -- $cur )); else COMPREPLY=($( compgen -W '`sed -ne "y/|/ /; \ s/^.*Usage.*{\(.*\)}.*$/\1/p" \ $sysvdir/${prev##*/}`' -- $cur )); fi; return 0 } _signals () { local i; COMPREPLY=($( compgen -A signal SIG${cur#-} )); for (( i=0 ; i < ${#COMPREPLY[@]} ; i++ )) do COMPREPLY[i]=-${COMPREPLY[i]#SIG}; done } _ssh () { local cur prev; local -a config; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; prev=${COMP_WORDS[COMP_CWORD-1]}; case "$prev" in -*c) COMPREPLY=($( compgen -W 'blowfish 3des 3des-cbc blowfish-cbc \ arcfour cast128-cbc' -- $cur )) ;; -*i) _filedir ;; -*l) COMPREPLY=($( compgen -u -- $cur )) ;; *) _known_hosts -a; [ $COMP_CWORD -eq 1 ] || COMPREPLY=(${COMPREPLY[@]} $( compgen -c -- $cur )) ;; esac; return 0 } _tar () { local cur ext regex tar untar; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=($( compgen -W 'c t x u r d A' -- $cur )); return 0; fi; case "${COMP_WORDS[1]}" in ?(-)c*f) _filedir; return 0 ;; +([^Izjy])f) ext='tar'; regex=$ext ;; *z*f) ext='t?(ar.)@(gz|Z)'; regex='t\(ar\.\)\(gz\|Z\)' ;; *[Ijy]*f) ext='t?(ar.)bz?(2)'; regex='t\(ar\.\)bz2\?' ;; *) _filedir; return 0 ;; esac; if [[ "$COMP_LINE" == *$ext' ' ]]; then tar=$( echo "$COMP_LINE" | sed -e 's|^.* \([^ ]*'$regex'\) .*$|\1|' ); untar=t${COMP_WORDS[1]//[^Izjyf]/}; COMPREPLY=($( compgen -W "$( echo $( tar $untar $tar 2>/dev/null ) )" -- "$cur" )); return 0; fi; _filedir $ext; return 0 } _uids () { if type perl >&/dev/null; then COMPREPLY=($( compgen -W '$( perl -e '"'"'while (($uid) = (getpwent)[2]) { print $uid . "\n" }'"'"' )' -- $cur )); else COMPREPLY=($( awk 'BEGIN {FS=":"} {if ($3 ~ /^'$cur'/) print $3}' /etc/passwd )); fi } _umount () { local cur; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; COMPREPLY=($( compgen -W '$( mount | cut -d" " -f 3 )' -- $cur )); return 0 } _user_at_host () { local cur; COMPREPLY=(); cur=${COMP_WORDS[COMP_CWORD]}; if [[ $cur == *@* ]]; then _known_hosts; else COMPREPLY=($( compgen -S '@' -u -- "$cur" )); fi; return 0 } get_entries () { [ -r ${prefix:-}CVS/Entries ] && entries=($( compgen -W "$( echo $( cut -d/ -f2 -s ${prefix:-}CVS/Entries ) )" -- $cur )) } get_modules () { if [ -n "$prefix" ]; then COMPREPLY=($( command ls -d ${cvsroot}/${prefix}/!(CVSROOT) )); else COMPREPLY=($( command ls -d ${cvsroot}/!(CVSROOT) )); fi } set_prefix () { [ -z ${prefix:-} ] || prefix=${cur%/*}/; [ -r ${prefix:-}CVS/Entries ] || prefix="" }