Ausgabe set:
BASH=/bin/bash
BASH_ALIASES=()
BASH_ARGC=()
BASH_ARGV=()
BASH_CMDS=()
BASH_COMPLETION=/etc/bash_completion
BASH_COMPLETION_DIR=/etc/bash_completion.d
BASH_LINENO=()
BASH_SOURCE=()
BASH_VERSINFO=([0]="4" [1]="0" [2]="33" [3]="1" [4]="release" [5]="i486-pc-linux-gnu")
BASH_VERSION='4.0.33(1)-release'
COLORTERM=gnome-terminal
COLUMNS=80
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-bPo8s9NVNc,guid=1ee641a5c864f2455f18f8e84b991279
DESKTOP_SESSION=gnome
DIRSTACK=()
DISPLAY=:0.0
EUID=1001
GDMSESSION=gnome
GDM_KEYBOARD_LAYOUT=ch
GDM_LANG=de_DE.UTF-8
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
GNOME_KEYRING_PID=1794
GNOME_KEYRING_SOCKET=/tmp/keyring-2pawJV/socket
GPG_AGENT_INFO=/tmp/seahorse-PcuHyE/S.gpg-agent:1874:1
GROUPS=()
GTK_MODULES=canberra-gtk-module
GTK_RC_FILES=/etc/gtk/gtkrc:/home/globi/.gtkrc-1.2-gnome2
HISTCONTROL=ignoreboth
HISTFILE=/home/globi/.bash_history
HISTFILESIZE=500
HISTSIZE=500
HOME=/home/globi
HOSTNAME=homs-laptop
HOSTTYPE=i486
IFS=$' \t\n'
LANG=de_DE.UTF-8
LESSCLOSE='/usr/bin/lesspipe %s %s'
LESSOPEN='| /usr/bin/lesspipe %s'
LINES=24
LOGNAME=globi
LS_COLORS='rs=0:di=01;34:ln=01;36:hl=44;37:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:'
MACHTYPE=i486-pc-linux-gnu
MAILCHECK=60
OPTERR=1
OPTIND=1
ORBIT_SOCKETDIR=/tmp/orbit-globi
OSTYPE=linux-gnu
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
PIPESTATUS=([0]="1" [1]="0")
PPID=2282
PS1='\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
PS2='> '
PS4='+ '
PWD=/home/globi
SESSION_MANAGER=local/homs-laptop:@/tmp/.ICE-unix/1809,unix/homs-laptop:/tmp/.ICE-unix/1809
SHELL=/bin/bash
SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor
SHLVL=1
SPEECHD_PORT=7561
SSH_AGENT_PID=1850
SSH_AUTH_SOCK=/tmp/keyring-2pawJV/socket.ssh
TERM=xterm
UID=1001
USER=globi
USERLAND=GNU
USERNAME=globi
WINDOWID=83886083
XAUTHORITY=/var/run/gdm/auth-for-globi-axvazc/database
XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/
XDG_SESSION_COOKIE=352da1b74ba0800df09acecf4a9edf53-1268322936.693071-156943615
_=
bash205='4.0.33(1)-release'
bash205b='4.0.33(1)-release'
bash3='4.0.33(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
}
_add_members ()
{
local cur prev;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
-@(r|d|-regular-members-file=|-digest-members-file=))
_filedir;
return 0
;;
-@(w|a|-welcome-msg=|-admin-notify=))
COMPREPLY=($( compgen -W 'y n' -- $cur));
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '--regular-members-file= -r \
--digest-members-file= -d --welcome-msg= -w \
--admin-notify= -a --help -h' -- $cur ));
else
_mailman_lists;
fi
}
_alias ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
case "$COMP_LINE" in
*[^=])
COMPREPLY=($( compgen -A alias -- $cur ))
;;
*=)
COMPREPLY=("$( alias ${cur%=} 2>/dev/null | sed -e 's|^alias '$cur'\(.*\)$|\1|' )")
;;
esac
}
_animate ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
_ImageMagick;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-alpha -authenticate -backdrop \
-background -bordercolor -borderwidth -channel \
-coalesce -colormap -colors -colorspace -crop -debug \
-decipher -define -delay -density -depth -display \
-dispose -dither -extract -filter -flatten -font \
-foreground -format -gamma -geometry -help \
-iconGeometry -iconic -identify -immutable -interlace \
-interpolate -limit -list -log -loop -map -mattecolor \
-mattecolor -monitor -monochrome -name -page -pause \
-quantize -quiet -regard-warnings -remote -repage \
-resample -resize -respect-parenthesis -rotate \
-sampling-factor -scenes -seed -set -shared-memory \
-size -strip -title -transparent-color -treedepth \
-trim -verbose -version -virtual-pixel -visual \
-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=`_get_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'"' '/<target name="/ {print $2}' $buildfile | grep "^$cur" ) $( awk -F"'" "/<target name='/ "'{print $2}' $buildfile | grep "^$cur" ) $( awk -F'"' '/<target [^n]/ {if ($1 ~ /name=/) { print $2 } else if ($3 ~ /name=/) {print $4} else if ($5 ~ /name=/) {print $6}}' $buildfile | grep "^$cur" ));
fi
}
_apt_cache ()
{
local cur prev special i;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
if [ "$cur" != show ]; then
for ((i=0; i < ${#COMP_WORDS[@]}-1; i++ ))
do
if [[ ${COMP_WORDS[i]} == @(add|depends|dotty|madison|policy|rdepends|show?(pkg|src|)) ]]; then
special=${COMP_WORDS[i]};
fi;
done;
fi;
if [ -n "$special" ]; then
case $special in
add)
_filedir;
return 0
;;
showsrc)
COMPREPLY=($( apt-cache dumpavail | grep "^Source: $cur" | sort | uniq | cut -f2 -d" " ));
return 0
;;
*)
COMPREPLY=($( apt-cache pkgnames $cur 2> /dev/null ));
return 0
;;
esac;
fi;
case "$prev" in
-@(c|p|s|-config-file|-@(pkg|src)-cache))
_filedir;
return 0
;;
search)
if [[ "$cur" != -* ]]; then
return 0;
fi
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-h -v -p -s -q -i -f -a -g -c \
-o --help --version --pkg-cache --src-cache \
--quiet --important --full --all-versions \
--no-all-versions --generate --no-generate \
--names-only --all-names --recurse \
--config-file --option --installed' -- $cur ));
else
COMPREPLY=($( compgen -W 'add gencaches show showpkg showsrc \
stats dump dumpavail unmet search search \
depends rdepends pkgnames dotty xvcg \
policy madison' -- $cur ));
fi;
return 0
}
_apt_file ()
{
local cur prev;
COMPREPLY=();
cur=${COMP_WORDS[COMP_CWORD]};
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
list | show)
COMPREPLY=($( apt-cache pkgnames $cur 2> /dev/null ));
return 0
;;
search | find)
_filedir;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-c -v -V -a -s -l -F -y -H -N -d \
--cache --verbose --version --architecture \
--sources-list --package-only --fixed-string \
--architecture --cdrom-mount --non-interactive \
--dummy --help' -- $cur ));
else
COMPREPLY=($( compgen -W 'update search list find \
show purge' -- $cur ));
fi;
return 0
}
_apt_get ()
{
local cur prev special i;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
for ((i=0; i < ${#COMP_WORDS[@]}-1; i++ ))
do
if [[ ${COMP_WORDS[i]} == @(install|remove|autoremove|purge|source|build-dep) ]]; then
special=${COMP_WORDS[i]};
fi;
done;
if [ -n "$special" ]; then
case $special in
remove | autoremove | purge)
if [ -f /etc/debian_version ]; then
COMPREPLY=($( _comp_dpkg_installed_packages $cur ));
else
_rpm_installed_packages;
fi;
return 0
;;
*)
COMPREPLY=($( apt-cache pkgnames $cur 2> /dev/null ));
return 0
;;
esac;
fi;
case "$prev" in
-@(c|-config-file))
_filedir;
return 0
;;
-@(t|-target-release|-default-release))
COMPREPLY=($( apt-cache policy | grep "release.o=Debian,a=$cur" | sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null));
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-d -f -h -v -m -q -s -y \
-u -t -b -c -o --download-only --fix-broken \
--help --version --ignore-missing \
--fix-missing --no-download --quiet --simulate \
--just-print --dry-run --recon --no-act --yes \
--assume-yes --show-upgraded --only-source \
--compile --build --ignore-hold \
--target-release --no-upgrade --force-yes \
--print-uris --purge --reinstall \
--list-cleanup --default-release \
--trivial-only --no-remove --diff-only \
--no-install-recommends \
--tar-only --config-file --option --auto-remove' -- $cur ));
else
COMPREPLY=($( compgen -W 'update upgrade dselect-upgrade \
dist-upgrade install remove purge source build-dep \
check clean autoclean autoremove' -- $cur ));
fi;
return 0
}
_aptitude ()
{
local cur dashoptions prev special i;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
dashoptions='-S -u -i -h --help --version -s --simulate -d \
--download-only -P --prompt -y --assume-yes -F \
--display-format -O --sort -w --width -f -r -g \
--with-recommends --with-suggests -R -G \
--without-recommends --without-suggests -t \
--target-release -V --show-versions -D --show-deps\
-Z -v --verbose --purge-unused --schedule-only';
for ((i=0; i < ${#COMP_WORDS[@]}-1; i++ ))
do
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|build-dep) ]]; then
special=${COMP_WORDS[i]};
fi;
[[ ${COMP_WORDS[i]} == '-u' ]] && dashoptions=${dashoptions/-i};
[[ ${COMP_WORDS[i]} == '-i' ]] && dashoptions=${dashoptions/-u};
done;
if [[ -n "$special" ]]; then
case $special in
@(install|hold|markauto|unmarkauto|dist-upgrade|full-upgrade|download|show|changelog|why|why-not|build-dep))
COMPREPLY=($( apt-cache pkgnames $cur 2> /dev/null ));
return 0
;;
@(purge|remove|reinstall|forbid-version))
COMPREPLY=($( _comp_dpkg_installed_packages $cur ));
return 0
;;
unhold)
COMPREPLY=($( _comp_dpkg_hold_packages $cur ));
return 0
;;
esac;
fi;
case $prev in
@(autoclean|clean|forget-new|search|upgrade|safe-upgrade|update|keep-all))
return 0
;;
-S)
_filedir;
return 0
;;
-@(t|-target-release|-default-release))
COMPREPLY=($( apt-cache policy | grep "release.o=Debian,a=$cur" | sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null ));
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W "$dashoptions" -- $cur ));
else
COMPREPLY=($( compgen -W 'update upgrade safe-upgrade forget-new clean \
autoclean install reinstall remove \
hold unhold purge markauto unmarkauto why why-not \
dist-upgrade full-upgrade download search show \
forbid-version changelog keep-all build-dep' -- $cur ));
fi;
return 0
}
_arch ()
{
local cur prev;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
-@(w|g|d|--welcome-msg=|-goodbye-msg|-digest=))
COMPREPLY=($( compgen -W 'y n' -- $cur));
return 0
;;
-@(d|-file))
_filedir;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '--wipe -s --start= -e --end= \
-q --quiet -h --help' -- $cur ));
else
args=$COMP_CWORD;
for ((i=1; i < COMP_CWORD; i++ ))
do
if [[ "${COMP_WORDS[i]}" == -* ]]; then
args=$(($args-1));
fi;
done;
case $args in
1)
_mailman_lists
;;
2)
_filedir
;;
esac;
fi
}
_arpspoof ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
-i)
_interfaces;
return 0
;;
-t)
_known_hosts;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-i -t' -- $cur ));
else
_known_hosts;
fi
}
_aspell ()
{
local cur prev;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
@(-c|-p|check))
_filedir;
return 0
;;
@(dump|create|merge))
COMPREPLY=($( compgen -W 'master personal repl' -- $cur ));
return 0
;;
-d)
_aspell_dictionary;
return 0
;;
esac;
if [[ "$cur" == *=* ]]; then
prev=${cur/=*/};
cur=${cur/*=/};
case "$prev" in
--@(conf|personal|repl|per-conf))
_filedir;
return 0
;;
--@(conf-dir|data-dir|dict-dir|home-dir|local-data-dir|prefix))
_filedir -d;
return 0
;;
--master)
_aspell_dictionary;
return 0
;;
--mode)
COMPREPLY=($( compgen -W 'none url email sgml tex' -- $cur ));
return 0
;;
--sug-mode)
COMPREPLY=($( compgen -W 'ultra fast normal bad-speller' -- $cur ));
return 0
;;
--keymapping)
COMPREPLY=($( compgen -W 'aspell ispell' -- $cur ));
return 0
;;
esac;
fi;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '--conf= --conf-dir= --data-dir= --dict-dir= \
--encoding= --add-filter= --rem-filter= --mode= -e \
-H -t --add-extra-dicts= --rem-extra-dicts= \
--home-dir= -W --ignore= --ignore-accents \
--dont-ignore-accents --ignore-case --dont-ignore-case \
--ignore-repl --dont-ignore-repl --jargon= --keyboard= \
--lang= --language-tag= --local-data-dir= -d --master= \
--module= --add-module-search-order= \
--rem-module-search-order= --per-conf= -p --personal= \
--prefix= --repl= -C -B --run-together --dont-run-together \
--run-together-limit= --run-together-min= --save-repl \
--dont-save-repl --set-prefix --dont-set-prefix --size= \
--spelling= --strip-accents --dont-strip-accents \
--sug-mode= --add-word-list-path= --rem-word-list-path= \
-b -x --backup -b|-x --dont-backup --reverse --dont-reverse \
--time --dont-time --keymapping= --add-email-quote= \
--rem-email-quote= --email-margin= --add-tex-command= \
--rem-tex-command= --tex-check-comments \
--dont-tex-check-comments --add-tex-extension= \
--rem-tex-extension= --add-sgml-check= --rem-sgml-check= \
--add-sgml-extension= --rem-sgml-extension=' -- $cur ));
else
COMPREPLY=($( compgen -W '-? help -c check -a pipe -l list \
config config soundslike filter -v version dump \
create merge' -- $cur ));
fi
}
_aspell_dictionary ()
{
local datadir;
datadir=/usr/lib/aspell;
COMPREPLY=($( command ls $datadir/*.@(multi|alias) ));
COMPREPLY=(${COMPREPLY[@]%.@(multi|alias)});
COMPREPLY=($( compgen -W '${COMPREPLY[@]#$datadir/}' -- $cur ))
}
_available_interfaces ()
{
local cmd;
if [ "${1:-}" = -w ]; then
cmd="iwconfig";
else
if [ "${1:-}" = -a ]; then
cmd="ifconfig";
else
cmd="ifconfig -a";
fi;
fi;
COMPREPLY=($( eval $cmd 2>/dev/null | sed -ne 's|^\('$cur'[^[:space:][:punct:]]\{1,\}\).*$|\1|p'))
}
_bk ()
{
local BKCMDS;
COMPREPLY=();
cur=`_get_cword`;
BKCMDS="$( bk help topics | grep '^ bk' | cut -d ' ' -f 4 | xargs echo )";
COMPREPLY=($( compgen -W "$BKCMDS" -- "$cur" ));
_filedir;
return 0
}
_btdownload ()
{
local cur prev;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
--@(responsefile|saveas))
_filedir;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '--max_uploads --keepalive_interval \
--download_slice_size --request_backlog \
--max_message_length --ip --minport --maxport \
--responsefile --url --saveas --timeout \
--timeout_check_interval --max_slice_length \
--max_rate_period --bind --upload_rate_fudge \
--display_interval --rerequest_interval \
--min_peers --http_timeout --max_initiate \
--max_allow_in --check_hashes \
--max_upload_rate --snub_time --spew \
--rarest_first_cutoff --min_uploads \
--report_hash_failures' -- $cur ));
else
_filedir;
fi
}
_bzip2 ()
{
local cur prev xspec;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-c -d -f -h -k -L -q -s \
-t -v -V -z -1 -2 -3 -4 -5 -6 -7 -8 -9 \
--help --decompress --compress --keep --force \
--test --stdout --quiet --verbose --license \
--version --small --fast --best' -- $cur ));
return 0;
fi;
local IFS='
';
xspec="*.bz2";
if [[ "$prev" == --* ]]; then
[[ "$prev" == --decompress || "$prev" == --list || "$prev" == --test ]] && xspec="!"$xspec;
[[ "$prev" == --compress ]] && xspec=;
else
if [[ "$prev" == -* ]]; then
[[ "$prev" == -*[dt]* ]] && xspec="!"$xspec;
[[ "$prev" == -*z* ]] && xspec=;
fi;
fi;
_expand || return 0;
COMPREPLY=($( compgen -f -X "$xspec" -- $cur ) $( compgen -d -- $cur ))
}
_cancel ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
COMPREPLY=($( lpstat | cut -d' ' -f1 | grep "^$cur" ))
}
_cd ()
{
local IFS='
' cur=`_get_cword` i j k;
if [[ "$cur" == ?(\\)\$* ]]; then
COMPREPLY=($( compgen -v -P '$' -- "${cur#?(\\)$}" ));
return 0;
fi;
compgen -f /non-existing-dir/ > /dev/null;
if [ -z "${CDPATH:-}" ] || [[ "$cur" == ?(.)?(.)/* ]]; then
_filedir -d;
return 0;
fi;
local -r mark_dirs=$(_rl_enabled mark-directories && echo y);
local -r mark_symdirs=$(_rl_enabled mark-symlinked-directories && echo y);
for i in ${CDPATH//:/' '};
do
k="${#COMPREPLY[@]}";
for j in $( compgen -d $i/$cur );
do
if [[ ( -n $mark_symdirs && -h $j || -n $mark_dirs && ! -h $j ) && ! -d ${j#$i/} ]]; then
j="${j}/";
fi;
COMPREPLY[k++]=${j#$i/};
done;
done;
_filedir -d;
if [[ ${#COMPREPLY[@]} -eq 1 ]]; then
i=${COMPREPLY[0]};
if [ "$i" == "$cur" ] && [[ $i != "*/" ]]; then
COMPREPLY[0]="${i}/";
fi;
fi;
return 0
}
_cdrecord ()
{
local cur prev i generic_options track_options track_mode;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
if [[ "$cur" == *=* ]]; then
prev=${cur/=*/};
cur=${cur/*=/};
case "$prev" in
@(text|cue)file)
_filedir;
return 0
;;
blank)
COMPREPLY=($( compgen -W 'help all fast \
track unreserve trtail unclose session' -- $cur ));
return 0
;;
driveropts)
COMPREPLY=($( compgen -W 'burnfree noburnfree\
varirec= audiomaster forcespeed noforcespeed\
speedread nospeedread singlesession \
nosinglesession hidecdr nohidecdr tattooinfo\
tattoofile=' -- $cur ));
return 0
;;
esac;
fi;
generic_options=(-version -v -V -d -silent -s -force -immed -dummy -dao -raw -raw96r -raw96p -raw16 -multi -msinfo -toc -atip -fix -nofix -waiti -load -lock -eject -format -setdropts -checkdrive -prcap -inq -scanbus -reset -abort -overburn -ignsize -useinfo -packet -noclose -text debug= kdebug= kd= minbuf= speed= blank= fs= dev= gracetime= timeout= driver= driveropts= defpregap= pktsize= mcn= textfile= cuefile=);
track_options=(-audio -swab -data -mode2 -xa -xa1 -xa2 -xamix -cdi -isosize -pad padsize= -nopad -shorttrack -noshorttrack pregap= -preemp -nopreemp -copy -nocopy -scms tcsize= isrc= index=);
track_mode=0;
if [ $COMP_CWORD -gt 1 ]; then
if [ -f "$prev" ]; then
track_mode=1;
else
for ((i=0; i < ${#track_options[@]}; i++ ))
do
if [[ "${track_options[i]}" == "$prev" ]]; then
track_mode=1;
break;
fi;
done;
fi;
fi;
_filedir;
COMPREPLY=("${COMPREPLY[@]}" $( compgen -W '${track_options[@]}' -- $cur ));
if [ $track_mode -eq 0 ]; then
COMPREPLY=("${COMPREPLY[@]}" $( compgen -W '${generic_options[@]}' -- $cur ));
fi
}
_change_pw ()
{
local cur prev;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
-@(l|-listname=))
_mailman_lists;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-a --all --domain= -d --listname= -l \
--password= -p --quiet -q -h --help' -- $cur ));
fi
}
_check_db ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '--all -a --verbose -v \
-h --help' -- $cur ));
else
_mailman_lists;
fi
}
_check_perms ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-f -v -h' -- $cur ));
fi
}
_chgrp ()
{
local cur prev;
COMPREPLY=();
cur=`_get_cword`;
cur=${cur//\\\\/};
prev=${COMP_WORDS[COMP_CWORD-1]};
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-c -h -f -R -v --changes \
--dereference --no-dereference --silent --quiet \
--reference= --recursive --verbose --help --version' -- $cur ));
return 0;
fi;
if [ $COMP_CWORD -eq 1 ] && [[ "$cur" != -* ]] || [[ "$prev" == -* ]] && [ -n "$bash205" ]; then
local IFS='
';
COMPREPLY=($( compgen -g $cur 2>/dev/null ));
else
_filedir || return 0;
fi;
return 0
}
_chown ()
{
local cur;
cur=`_get_cword`;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-c -h -f -R -v --changes \
--dereference --no-dereference --from= --silent --quiet \
--reference= --recursive --verbose --help --version' -- $cur ));
else
_count_args;
case $args in
1)
_usergroup
;;
*)
_filedir
;;
esac;
fi
}
_chsh ()
{
local cur prev;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
if [ "$prev" = "-s" ]; then
if [ -f /etc/debian_version ]; then
COMPREPLY=($( </etc/shells ));
else
COMPREPLY=($( chsh -l | grep "^$cur" ));
fi;
else
COMPREPLY=($( compgen -u -- $cur ));
fi;
return 0
}
_civclient ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
-@(l|S|t|-log|-Sound|-tiles))
_filedir;
return 0
;;
-@(P|-Plugin))
COMPREPLY=($( compgen -W 'none esd sdl' -- $cur ));
return 0
;;
-@(s|-server))
_known_hosts;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-a -d -h -l -m -n -p -P -s -S -t -v\
--autoconnect --debug --help --log --meta --name \
--port --Plugin --server --Sound --tiles --version' -- $cur ));
fi
}
_civserver ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
-@(f|g|l|r|-file|-log|-gamelog|-read))
_filedir;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-d -f -g -h -i -l -m -M -p -q -r -v\
--debug --file --gamelog --help --info --log --meta \
--Metaserver --port --quitidle --read --version' -- $cur ));
fi
}
_cksfv ()
{
COMPREPLY=();
cur=`_get_cword`;
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=($( compgen -W '-C -f -i -q -v' -- $cur ));
return 0;
fi;
case "${COMP_WORDS[$COMP_CWORD-1]}" in
-C)
_filedir -d;
return 0
;;
-f)
_filedir 'sfv';
return 0
;;
esac;
_filedir;
return 0
}
_cleanarch ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-s --status -n --dry-run \
-q --quiet -h --help' -- $cur ));
fi
}
_clisp ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-h --help --version --license -B -K \
-M -m -L -N -E -q --quiet --silent -w -I -ansi \
-traditional -p -C -norc -i -c -l -o -x ' -- $cur ));
else
_filedir;
fi;
return 0
}
_clone_member ()
{
local cur prev;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
-@(l|-listname=))
_mailman_lists;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-l --listname= --remove -r \
--admin -a --quiet -q --nomodify -n --help -h' -- $cur ));
fi
}
_command ()
{
local offset i;
offset=1;
for ((i=1; i <= COMP_CWORD; i++ ))
do
if [[ "${COMP_WORDS[i]}" != -* ]]; then
offset=$i;
break;
fi;
done;
_command_offset $offset
}
_command_offset ()
{
local cur func cline cspec noglob cmd i char_offset word_offset _COMMAND_FUNC _COMMAND_FUNC_ARGS;
word_offset=$1;
local first_word=${COMP_WORDS[$word_offset]};
for ((i=0; i <= ${#COMP_LINE}; i++ ))
do
if [[ "${COMP_LINE:$i:${#first_word}}" == "$first_word" ]]; then
char_offset=$i;
break;
fi;
done;
COMP_LINE=${COMP_LINE:$char_offset};
COMP_POINT=$(( COMP_POINT - $char_offset ));
for ((i=0; i <= COMP_CWORD - $word_offset; i++ ))
do
COMP_WORDS[i]=${COMP_WORDS[i+$word_offset]};
done;
for ((i; i <= COMP_CWORD; i++ ))
do
unset COMP_WORDS[i];
done;
COMP_CWORD=$(( $COMP_CWORD - $word_offset ));
COMPREPLY=();
cur=`_get_cword`;
if [[ $COMP_CWORD -eq 0 ]]; then
COMPREPLY=($( compgen -c -- $cur ));
else
cmd=${COMP_WORDS[0]};
if complete -p $cmd &>/dev/null; then
cspec=$( complete -p $cmd );
if [ "${cspec#* -F }" != "$cspec" ]; then
func=${cspec#*-F };
func=${func%% *};
if [[ ${#COMP_WORDS[@]} -ge 2 ]]; then
$func $cmd "${COMP_WORDS[${#COMP_WORDS[@]}-1]}" "${COMP_WORDS[${#COMP_WORDS[@]}-2]}";
else
$func $cmd "${COMP_WORDS[${#COMP_WORDS[@]}-1]}";
fi;
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
}
_comp_dpkg_hold_packages ()
{
grep -B 2 'hold' /var/lib/dpkg/status | grep "Package: $1" | cut -d\ -f2
}
_comp_dpkg_installed_packages ()
{
grep -A 1 "Package: $1" /var/lib/dpkg/status | grep -B 1 -Ee "ok installed|half-installed|unpacked| half-configured|config-files" -Ee "^Essential: yes" | grep "Package: $1" | cut -d\ -f2
}
_compare ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
_ImageMagick;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-alpha -authenticate -channel \
-colorspace -compress -debug -decipher -define \
-density -depth -encipher -extract -format -fuzz \
-help -highlight-color -identify -interlace -limit \
-list -log -metric -monitor -passphrase -profile \
-quality -quantize -quiet -regard-warnings \
-respect-parenthesis -sampling-factor -seed -set \
-size -transparent-color -type -verbose -version \
-virtual-pixel' -- $cur ));
else
if [[ "$cur" == +* ]]; then
COMPREPLY=($( compgen -W '+debug' -- $cur ));
else
_filedir;
fi;
fi
}
_complete ()
{
local cur prev options;
COMPREPLY=();
cur=`_get_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=`_get_cword`;
_ImageMagick;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-affine -alpha -authenticate \
-blend -blue-primary -border -bordercolor -channel \
-colors -colorspace -comment -compose -compress \
-debug -decipher -define -density -depth -displace \
-display -dispose -dissolve -dither -encipher \
-encoding -endian -extract -filter -font -format \
-geometry -gravity -green-primary -help -identify \
-interlace -interpolate -label -limit -list -log \
-monitor -monochrome -negate -page -profile -quality \
-quantize -quiet -red-primary -regard-warnings \
-repage -resize -respect-parenthesis -rotate \
-sampling-factor -scene -seed -sharpen -shave -size \
-stegano -stereo -strip -swap -thumbnail -tile \
-transform -transparent-color -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
}
_config_list ()
{
local cur prev;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
-@(i|o|-inputfile|-outputfile))
_filedir;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '--inputfile -i --outputfile -o \
--checkonly -c --verbose -v -h --help' -- $cur ));
else
_mailman_lists;
fi
}
_configure_func ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
[[ "$cur" != -* ]] && return 0;
if [ -n "$COMP_CONFIGURE_HINTS" ]; then
COMPREPLY=($( $1 --help 2>&1 | awk '/^ --[A-Za-z]/ { print $1; if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,].*//g' | grep ^$cur ));
else
COMPREPLY=($( $1 --help 2>&1 | awk '/^ --[A-Za-z]/ { print $1; if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,=].*//g' | grep ^$cur ));
fi
}
_configured_interfaces ()
{
if [ -f /etc/debian_version ]; then
COMPREPLY=($( sed -ne 's|^iface \([^ ]\+\).*$|\1|p' /etc/network/interfaces ));
else
if [ -f /etc/SuSE-release ]; then
COMPREPLY=($( command ls /etc/sysconfig/network/ifcfg-* | sed -ne 's|.*ifcfg-\('$cur'.*\)|\1|p' ));
else
if [ -f /etc/pld-release ]; then
COMPREPLY=($( command ls -B /etc/sysconfig/interfaces | sed -ne 's|.*ifcfg-\('$cur'.*\)|\1|p' ));
else
COMPREPLY=($( command ls /etc/sysconfig/network-scripts/ifcfg-* | sed -ne 's|.*ifcfg-\('$cur'.*\)|\1|p' ));
fi;
fi;
fi
}
_conjure ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
_ImageMagick;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-debug -help -list -log -monitor \
-quiet -regard-warnings -seed -verbose \
-version' -- $cur ));
else
if [[ "$cur" == +* ]]; then
COMPREPLY=($( compgen -W '+debug' -- $cur ));
else
_filedir;
fi;
fi
}
_convert ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
_ImageMagick;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-adaptive-blur -adaptive-resize \
-adaptive-sharpen -adjoin -affine -alpha -annotate \
-antialias -append -attenuate -authenticate \
-auto-orient -average -background -bench -bias \
-black-point-compensation -black-threshold \
-blue-primary -blur -border -bordercolor -caption \
-channel -charcoal -chop -clip -clip-mask -clip-path \
-clone -clut -coalesce -colorize -colors -colorspace \
-combine -comment -compose -composite -compress \
-contrast -contrast-stretch -convolve -crop -cycle \
-debug -decipher -deconstruct -define -delay -delete \
-density -depth -despeckle -display -dispose -distort \
-dither -draw -edge -emboss -encipher -encoding \
-endian -enhance -equalize -evaluate -extent -extract \
-family -fill -filter -flatten -flip -floodfill -flop \
-font -format -frame -fuzz -fx -gamma -gaussian-blur \
-geometry -gravity -green-primary -help -identify \
-implode -insert -intent -interlace -interpolate \
-label -lat -layers -level -limit -linear-stretch \
-liquid-rescale -list -log -loop -map -mask \
-mattecolor -median -modulate -monitor -monochrome \
-morph -mosaic -motion-blur -negate -noise -normalize \
-opaque -ordered-dither -orient -page -paint -ping \
-pointsize -polaroid -posterize -preview -print \
-process -profile -quality -quantize -quiet \
-radial-blur -raise -random-threshold -recolor \
-red-primary -regard-warnings -region -render -repage \
-resample -resize -respect-parenthesis -reverse -roll \
-rotate -sample -sampling-factor -scale -scene -seed \
-segment -separate -sepia-tone -set -shade -shadow \
-sharpen -shave -shear -sigmoidal-contrast -size \
-sketch -solarize -splice -spread -stretch -strip \
-stroke -strokewidth -style -swap -swirl -taint \
-texture -threshold -thumbnail -tile -tile-offset \
-tint -transform -transparent -transparent-color \
-transpose -transverse -treedepth -trim -type \
-undercolor -unique-colors -units -unsharp -verbose \
-version -view -vignette -virtual-pixel -wave \
-weight -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
}
_count_args ()
{
args=1;
for ((i=1; i < COMP_CWORD; i++ ))
do
if [[ "${COMP_WORDS[i]}" != -* ]]; then
args=$(($args+1));
fi;
done
}
_cpan2dist ()
{
local cur prev packagelist cpandirs;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case $prev in
--format)
COMPREPLY=($( compgen -W '$(perl -MCPANPLUS::Dist -e "print map { \"\$_\n\" } CPANPLUS::Dist->dist_types")' -- "$cur" ));
return 0
;;
--@(banlist|ignorelist|modulelist|logfile))
_filedir;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '--help --skiptest --force --install \
--verbose --keepsource --makefile --buildprereq \
--archive --flushcache --defaults --edit-metafile \
--format --ban --banlist --ignore --ignorelist \
--modulelist --logfile --timeout --set-config \
--set-program --dist-opts --default-banlist \
--default-ignorelist' -- $cur ));
else
cpandirs=("$HOME/.cpanplus/" "$HOME/.cpan/source/modules/");
for dir in ${cpandirs[@]};
do
[ -d "$dir" -a -r "$dir/02packages.details.txt.gz" ] && packagelist="$dir/02packages.details.txt.gz";
done;
COMPREPLY=($( zgrep "^${cur//-/::}" $packagelist 2>/dev/null | awk '{print $1}' | sed -e 's/::/-/g' ));
fi
}
_cpio ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case $prev in
-H)
_cpio_format;
return 0
;;
-@(E|F|I))
_filedir;
return 0
;;
-R)
_usergroup;
return 0
;;
esac;
if [[ "$cur" == *=* ]]; then
prev=${cur/=*/};
cur=${cur/*=/};
case $prev in
--format)
_cpio_format;
return 0
;;
--@(file|pattern-file))
_filedir;
return 0
;;
--owner)
_usergroup;
return 0
;;
--rsh-command)
COMPREPLY=($( compgen -c -- $cur ));
return 0
;;
esac;
fi;
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=($( compgen -W '-o --create -i --extract -p --pass-through' -- $cur));
else
case ${COMP_WORDS[1]} in
-@(o|-create))
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-0 -a -c -v -A -B\
-L -V -C -H -M -O -F --file= --format=\
--message= --null --reset-access-time\
--verbose --dot --append --block-size=\
--dereference --io-size= --quiet\
--force-local --rsh-command= --help\
--version' -- $cur ));
fi
;;
-@(i|-extract))
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-b -c -d -f -m -n -r\
-t -s -u -v -B -S -V -C -E -H -M -R -I\
-F --file= --make-directories\
--nonmatching\
--preserve-modification-time\
--numeric-uid-gid --rename -t --list\
--swap-bytes --swap --dot\
--unconditional --verbose --block-size=\
--swap-halfwords --io-size=\
--pattern-file= --format= --owner=\
--no-preserve-owner --message=\
--force-local --no-absolute-filenames\
--sparse --only-verify-crc --quiet\
--rsh-command= --help\
--version' -- $cur ));
fi
;;
-@(p|-pass-through))
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-0 -a -d -l -m -u -v\
-L -V -R --null --reset-access-time\
--make-directories --link --quiet\
--preserve-modification-time\
--unconditional --verbose --dot\
--dereference --owner=\
--no-preserve-owner --sparse --help\
--version' -- $cur ));
else
_filedir -d;
fi
;;
esac;
fi
}
_cpio_format ()
{
COMPREPLY=($( compgen -W 'bin odc newc crc tar ustar hpbin hpodc' -- $cur ))
}
_cryptsetup ()
{
local cmd cur prev action actions luksactions argopts noargopts;
COMPREPLY=();
cur="${COMP_WORDS[COMP_CWORD]}";
prev="${COMP_WORDS[COMP_CWORD-1]}";
actions="create remove status reload resize";
luksactions="luksFormat luksOpen luksClose luksAddKey luksDelKey luksUUID isLuks luksDump";
actions="$luksactions $actions";
argopts="-c --cipher -h --hash -d --key-file -s --key-size -b --size";
argopts="$argopts -o --offset -p --skip -i --iter-time -q --batch-mode";
argopts="$argopts -t --timeout -T --tries";
noargopts="-y --verify-passphrase --readonly --version --align-payload";
if [ "-d" = "$prev" -o "--key-file" = "$prev" ]; then
COMPREPLY=($(compgen -f -- "${cur}"));
fi;
for argopt in $argopts;
do
if [ "$argopt" = "$prev" ]; then
return;
fi;
done;
if [[ $cur == -* ]]; then
COMPREPLY=($(compgen -W "$argopts $noargopts" -- "$cur"));
return;
fi;
action="";
for word in "${COMP_WORDS[@]}";
do
for act in $actions;
do
if [ "$word" == "$act" ]; then
action=$act;
break;
fi;
done;
if [ -n "$action" ]; then
break;
fi;
done;
if [ -z "$action" ]; then
COMPREPLY=($(compgen -W "$actions" -- "$cur"));
return;
fi;
case "$action" in
"create")
if [ $COMP_CWORD -gt 1 ] && [ ${COMP_WORDS[COMP_CWORD-2]} == "create" ]; then
COMPREPLY=($(compgen -f -X '!/dev*' -- "$cur"));
fi
;;
"reload" | "remove" | "resize" | "status" | "luksClose")
MAPPINGS="$(ls /dev/mapper | fgrep --invert-match control)";
OLDIFS="$IFS";
IFS="
";
COMPREPLY=($(compgen -W "$MAPPINGS" -- "$cur"));
IFS="$OLDIFS"
;;
"luksDelKey")
if [ ${COMP_WORDS[COMP_CWORD-1]} == "luksDelKey" ]; then
MAPPINGS="$(ls /dev/mapper | fgrep --invert-match control)";
OLDIFS="$IFS";
IFS="
";
COMPREPLY=($(compgen -W "$MAPPINGS" -- "$cur"));
IFS="$OLDIFS";
fi
;;
"luksAddKey" | "luksFormat")
if [ ${COMP_WORDS[COMP_CWORD-1]} == "luksFormat" ]; then
MAPPINGS="$(ls /dev/mapper | fgrep --invert-match control)";
OLDIFS="$IFS";
IFS="
";
COMPREPLY=($(compgen -W "$MAPPINGS" -- "$cur"));
IFS="$OLDIFS";
else
if [ ${COMP_WORDS[COMP_CWORD-2]} == "luksFormat" ]; then
COMPREPLY=($(compgen -f -- "$cur"));
fi;
fi
;;
"luksOpen")
if [ ${COMP_WORDS[COMP_CWORD-1]} == "luksOpen" ]; then
COMPREPLY=($(compgen -f -X '!/dev*' -- "$cur"));
fi
;;
"isLuks" | "luksDump" | "luksUUID")
COMPREPLY=($(compgen -f -X '!/dev*' -- "$cur"))
;;
esac
}
_cvs ()
{
local cur count mode i cvsroot cvsroots pwd;
local -a flags miss files entries changed newremoved;
COMPREPLY=();
cur=`_get_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))]}
;;
@(ad?(d)|new))
mode=add
;;
@(adm?(in)|rcs))
mode=admin
;;
ann?(notate))
mode=annotate
;;
@(checkout|co|get))
mode=checkout
;;
@(com?(mit)|ci))
mode=commit
;;
di?(f?(f)))
mode=diff
;;
ex?(p?(ort)))
mode=export
;;
?(un)edit)
mode=$i
;;
hi?(s?(tory)))
mode=history
;;
im?(p?(ort)))
mode=import
;;
re?(l?(ease)))
mode=release
;;
?(r)log)
mode=log
;;
@(rdiff|patch))
mode=rdiff
;;
@(remove|rm|delete))
mode=remove
;;
@(rtag|rfreeze))
mode=rtag
;;
st?(at?(us)))
mode=status
;;
@(tag|freeze))
mode=tag
;;
up?(d?(ate)))
mode=update
;;
*)
;;
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 -X '*~' -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
;;
annotate)
if [[ "$cur" = -* ]]; then
COMPREPLY=($( compgen -W '-D -F -f -l -R -r' -- $cur ));
else
get_entries;
COMPREPLY=($( compgen -W '${entries[@]}' -- $cur ));
fi
;;
checkout)
if [[ "$cur" != -* ]]; then
[ -z "$cvsroot" ] && cvsroot=$CVSROOT;
COMPREPLY=($( cvs -d "$cvsroot" co -c 2> /dev/null | 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 -q diff --brief 2>&1 | sed -ne 's/^Files [^ ]* and \([^ ]*\) differ$/\1/p' ));
newremoved=($( cvs -q diff --brief 2>&1 | sed -ne 's/^cvs diff: \([^ ]*\) .*, no comparison available$/\1/p' ));
COMPREPLY=($( compgen -W '${changed[@]:-} \
${newremoved[@]:-}' -- $cur ));
else
COMPREPLY=($(compgen $default -- "$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=($( compgen -W '${entries[@]:-}' -- $cur ));
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
;;
update)
if [[ "$cur" = -* ]]; then
COMPREPLY=($( compgen -W '-A -P -C -d -f -l -R -p \
-k -r -D -j -I -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 stat 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
}
_dd ()
{
local cur;
COMPREPLY=();
cur=`_get_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 ))
}
_debconf_show ()
{
local cur;
COMPREPLY=();
cur=${COMP_WORDS[COMP_CWORD]};
COMPREPLY=($( compgen -W '--listowners --listdbs --db=' -- $cur ) $( apt-cache pkgnames -- $cur ))
}
_desktop_file_validate ()
{
COMPRELY=();
cur=${COMP_WORDS[COMP_CWORD]};
_filedir '@(desktop)'
}
_dhclient ()
{
local cur prev;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
-@(cf|lf|pf|sf))
_filedir;
return 0
;;
-s)
_known_hosts;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-p -d -q -1 -r -lf -pf \
-cf -sf -s -g -n -nw -w' -- $cur ));
else
_available_interfaces;
fi
}
_display ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
_ImageMagick;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-alpha -antialias -authenticate \
-auto-orient -backdrop -background -border \
-bordercolor -borderwidth -channel -clip \
-clip-path -coalesce -colormap -colors -colorspace \
-comment -compress -contrast -crop -debug -decipher \
-define -delay -density -depth -despeckle -display \
-dispose -dither -edge -endian -enhance -extract \
-filter -flatten -flip -flop -font -foreground \
-format -frame -gamma -geometry -help -iconGeometry \
-iconic -identify -immutable -interlace -interpolate \
-label -limit -list -log -loop -map -mattecolor \
-monitor -monochrome -name -negate -page -profile \
-quality -quantize -quiet -raise -regard-warnings \
-remote -repage -resample -resize \
-respect-parenthesis -roll -rotate -sample \
-sampling-factor -scenes -seed -segment -set \
-shared-memory -sharpen -size -strip -texture -title \
-transparent-color -treedepth -trim -update \
-usePixmap -verbose -version -virtual-pixel -visual \
-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
}
_dkms ()
{
local cur prev command module i;
COMPREPLY=();
cur=${COMP_WORDS[COMP_CWORD]};
if [[ $COMP_CWORD -eq 1 ]]; then
COMPREPLY=($( compgen -W "add remove build install uninstall match mkdriverdisk mktarball ldtarball mkrpm mkdeb mkdsc mkkmp status" -- $cur ));
else
prev=${COMP_WORDS[COMP_CWORD-1]};
command=${COMP_WORDS[1]};
case $prev in
-m)
if [ "$command" = 'add' ]; then
_filename_parts '.*-.*' 1;
else
_subdirectories /var/lib/dkms;
fi;
return 0
;;
-v)
for ((i=1; i < COMP_CWORD; i++ ))
do
if [[ "${COMP_WORDS[i]}" == -m ]]; then
module=${COMP_WORDS[i+1]};
break;
fi;
done;
if [ -n "$module" ]; then
if [ "$command" = 'add' ]; then
_filename_parts "$module-.*" 2;
else
_subdirectories /var/lib/dkms/$module;
fi;
return 0;
fi
;;
-k)
_kernels;
return 0
;;
-@\(c | -spec | -archive | -config\))
_filedir;
return 0
;;
--kernelsourcedir)
_filedir -d;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
case $command in
add)
options='-c --rpm_safe_upgrade'
;;
remove)
options='--rpm_safe_upgrade'
;;
build)
options='--config'
;;
mkdriverdisk)
options='-d --distro -r --release --size'
;;
ldtarball)
options='--archive --force'
;;
mktarball)
options='--source-only --binaries-only'
;;
mkrpm)
options='--source-only'
;;
mkkmp)
options='--spec'
;;
match)
options='--templatekernel'
;;
esac;
options="$options -m -v -k -a --arch -q --quiet -V --version --all --no-prepare-kernel --no-clean-kernel --kernelsourcedir --directive";
COMPREPLY=($( compgen -W "$options" -- $cur ));
fi;
fi
}
_dnsspoof ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
-i)
_interfaces;
return 0
;;
-f)
_filedir;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-i -f' -- $cur ));
fi
}
_dpkg ()
{
local cur prev i;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
i=$COMP_CWORD;
_expand || return 0;
if [[ $cur != -* ]]; then
while [[ $prev != -* && $i != 1 ]]; do
i=$((i-1));
prev=${COMP_WORDS[i-1]};
done;
fi;
case "$prev" in
-@(c|i|A|I|f|e|x|X|-@(install|unpack|record-avail|contents|info|fsys-tarfile|field|control|extract)))
_filedir '?(u)deb';
return 0
;;
-@(b|-build))
_filedir -d;
return 0
;;
-@(s|p|l|-@(status|print-avail|list)))
COMPREPLY=($( apt-cache pkgnames $cur 2>/dev/null ));
return 0
;;
-@(S|-search))
_filedir;
return 0
;;
-@(r|L|P|-@(remove|purge|listfiles)))
COMPREPLY=($( _comp_dpkg_installed_packages $cur ));
return 0
;;
*)
COMPREPLY=($( compgen -W '-i --install --unpack -A --record-avail \
--configure -r --remove -P --purge --get-selections \
--set-selections --update-avail --merge-avail \
--clear-avail --command-fd --forget-old-unavail -s \
--status -p --print-avail -L --listfiles -l --list \
-S --search -C --audit --print-architecture \
--print-gnu-build-architecture \
--print-installation-architecture \
--compare-versions --help --version --force-help \
--force-all --force-auto-select --force-downgrade \
--force-configure-any --force-hold --force-bad-path \
--force-not-root --force-overwrite \
--force-overwrite-diverted --force-bad-verify \
--force-depends-version --force-depends \
--force-confnew --force-confold --force-confdef \
--force-confmiss --force-conflicts --force-architecture\
--force-overwrite-dir --force-remove-reinstreq \
--force-remove-essential -Dh \
--debug=help --licence --admindir= --root= --instdir= \
-O --selected-only -E --skip-same-version \
-G --refuse-downgrade -B --auto-deconfigure \
--no-debsig --no-act -D --debug= --status-fd \
-b --build -I --info -f --field -c --contents \
-x --extract -X --vextract --fsys-tarfile -e --control \
--ignore-depends= --abort-after' -- $cur ))
;;
esac
}
_dpkg_reconfigure ()
{
local cur prev opt;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
-@(f|-frontend))
opt=($( echo /usr/share/perl5/Debconf/FrontEnd/* ));
opt=(${opt[@]##*/});
opt=(${opt[@]%.pm});
COMPREPLY=($( compgen -W '${opt[@]}' -- $cur ));
return 0
;;
-@(p|-priority))
COMPREPLY=($( compgen -W 'low medium high critical' -- $cur ));
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-f --frontend -p --priority -a --all \
-u --unseen-only -h --help -s --showold \
--force --terse' -- $cur ));
else
COMPREPLY=($( _comp_dpkg_installed_packages $cur ));
fi
}
_dpkg_source ()
{
local cur prev options work i action packopts unpackopts;
packopts="-c -l -F -V -T -D -U -W -E -sa -i -I -sk -sp -su -sr -ss -sn -sA -sK -sP -sU -sR";
unpackopts="-sp -sn -su";
options=`echo "-x -b $packopts $unpackopts" | xargs echo | sort -u | xargs echo`;
COMPREPLY=();
if [ "$1" != "dpkg-source" ]; then
return 1;
fi;
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
action="options";
for ((i=0; i < ${#COMP_WORDS[@]}-1; i++ ))
do
if [[ ${COMP_WORDS[$i]} == "-x" ]]; then
action=unpack;
else
if [[ ${COMP_WORDS[$i]} == "-b" ]]; then
action=pack;
else
if [[ ${COMP_WORDS[$i]} == "-h" ]]; then
action=help;
fi;
fi;
fi;
done;
for i in $options;
do
if [ "$cur" = "$i" ]; then
COMPREPLY=("$cur");
return 0;
fi;
done;
case "$action" in
"unpack")
if [ "$cur" = "-" -o "$cur" = "-s" ]; then
COMPREPLY=($unpackopts);
return 0;
fi;
case "$prev" in
"-x")
COMPREPLY=($( compgen -d -- "$cur" ) $( compgen -f -X '!*.dsc' -- "$cur" ));
return 0
;;
*)
COMPREPLY=($unpackopts $(compgen -d -f -- "$cur" ));
return 0
;;
esac;
return 0
;;
"pack")
if [ "$cur" = "-" ]; then
COMPREPLY=($packopts);
return 0;
fi;
if [ "$cur" = "-s" ]; then
COMPREPLY=("-sa" "-sk" "-sp" "-su" "-sr" "-ss" "-sn" "-sA" "-sK" "-sP" "-sU" "-sR");
return 0;
fi;
case "$prev" in
"-b")
COMPREPLY=($( compgen -d -- "$cur" ));
return 0
;;
"-c" | "-l" | "-T" | "-i" | "-I")
COMPREPLY=($( compgen -d -f ));
return 0
;;
"-F")
COMPREPLY=($( ( cd /usr/lib/dpkg/parsechangelog; compgen -f "$cur" ) ));
return 0
;;
"-V" | "-D")
COMPREPLY=();
return 0
;;
"-D")
if echo -- "$cur" | grep -q "="; then
COMPREPLY=();
return 0;
else
COMPREPLY=(Format Source Version Binary Maintainer Uploader Architecture Standards-Version Build-Depends Files);
return 0;
fi
;;
"-U")
COMPREPLY=(Format Source Version Binary Maintainer Uploader Architecture Standards-Version Build-Depends Files);
return 0
;;
*)
COMPREPLY=($packopts);
return 0
;;
esac;
return 0
;;
*)
if [ "$cur" = "-s" ]; then
COMPREPLY=("-sa" "-sk" "-sp" "-su" "-sr" "-ss" "-sn" "-sA" "-sK" "-sP" "-sU" "-sR");
return 0;
fi;
COMPREPLY=($options);
return 0
;;
esac
}
_dsniff ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
-@(r|w|f))
_filedir;
return 0
;;
-i)
_interfaces;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-c -d -m -n -i -s -f -t \
-r -w' -- $cur ));
fi
}
_dumpdb ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '--marshal -m --pickle -p --noprint -n -h --help' -- $cur ));
else
_filedir;
fi
}
_expand ()
{
if [[ "$cur" == \~*/* ]]; then
eval cur=$cur;
else
if [[ "$cur" == \~* ]]; then
cur=${cur#\~};
COMPREPLY=($( compgen -P '~' -u $cur ));
[ ${#COMPREPLY[@]} -eq 1 ] && eval COMPREPLY[0]=${COMPREPLY[0]};
return ${#COMPREPLY[@]};
fi;
fi
}
_export ()
{
local cur;
COMPREPLY=();
cur=`_get_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;
local -a toks;
local tmp;
toks=(${toks[@]-} $(
compgen -d -- "$(quote_readline "$cur")" | {
while read -r tmp; do
echo $tmp
done
}
));
if [[ "$1" != -d ]]; then
xspec=${1:+"!*.$1"};
toks=(${toks[@]-} $(
compgen -f -X "$xspec" -- "$(quote_readline "$cur")" | {
while read -r tmp; do
[ -n $tmp ] && echo $tmp
done
}
));
fi;
COMPREPLY=("${COMPREPLY[@]}" "${toks[@]}")
}
_filedir_xspec ()
{
local IFS cur xspec;
IFS='
';
COMPREPLY=();
cur=`_get_cword`;
_expand || return 0;
xspec=$( sed -ne '/^complete .*[ ]'${1##*/}'\([ ]\|$\)/{p;q;}' $BASH_COMPLETION );
xspec=${xspec#*-X };
xspec=${xspec%% *};
local -a toks;
local tmp;
toks=(${toks[@]-} $(
compgen -d -- "$(quote_readline "$cur")" | {
while read -r tmp; do
# see long TODO comment in _filedir() --David
echo $tmp
done
}
));
toks=(${toks[@]-} $(
eval compgen -f -X "$xspec" -- "\$(quote_readline "\$cur")" | {
while read -r tmp; do
[ -n $tmp ] && echo $tmp
done
}
));
COMPREPLY=("${toks[@]}")
}
_filename_parts ()
{
COMPREPLY=($( command ls -F /usr/src/ 2>/dev/null | grep -E '^'$1'/$' | sed -r -e 's/^([^-]+)-(.+)\/$/\'$2'/' | grep "^$cur" ))
}
_find ()
{
local cur prev i exprfound onlyonce;
COMPREPLY=();
cur=`_get_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 | -?(i)wholename)
_filedir;
return 0
;;
-fstype)
[ -e /proc/filesystems ] && 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)?(whole)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 \
-wholename \
-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 -wholename -iwholename' -- $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
}
_find_member ()
{
local cur prev;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
-@(l|x|-listname=|-exclude=))
_mailman_lists;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-l --listname= -x \
--exclude= --owners -w --help -h' -- $cur ));
fi
}
_function ()
{
local cur prev;
COMPREPLY=();
cur=`_get_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=`_get_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/' | command grep "^$cur" | sort -u ));
else
_filedir;
fi
}
_gcl ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-eval -load -f -batch -dir -libdir \
-compile -o-file -c-file -h-file -data-file -system-p ' -- $cur ));
else
_filedir;
fi;
return 0
}
_gdb ()
{
local cur prev;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
if [ $COMP_CWORD -eq 1 ]; then
local IFS;
if [[ "$cur" == */* ]]; then
IFS='
';
COMPREPLY=($( PATH="$PATH:." compgen -d -c -- "$cur" ));
else
IFS=":";
local path_array=($(echo "$PATH" | sed 's/::\+/:/g;s/^:\|:$//g'));
IFS='
';
COMPREPLY=($( compgen -d -W '$(find "${path_array[@]}" . \
-mindepth 1 -maxdepth 1 -not -type d -executable -printf "%f\\n" 2>/dev/null)' -- "$cur" ));
fi;
else
if [ $COMP_CWORD -eq 2 ]; then
prev=${prev##*/};
COMPREPLY=($( compgen -fW "$( command ps axo comm,pid | awk '{if ($1 ~ /^'"$prev"'/) print $2}' ) )" -- "$cur" ));
fi;
fi
}
_genaliases ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-q --quiet -h --help' -- $cur ));
fi
}
_get_cword ()
{
if [[ "${#COMP_WORDS[COMP_CWORD]}" -eq 0 ]] || [[ "$COMP_POINT" == "${#COMP_LINE}" ]]; then
printf "%s" "${COMP_WORDS[COMP_CWORD]}";
else
local i;
local cur="$COMP_LINE";
local index="$COMP_POINT";
for ((i = 0; i <= COMP_CWORD; ++i ))
do
while [[ "${#cur}" -ge ${#COMP_WORDS[i]} ]] && [[ "${cur:0:${#COMP_WORDS[i]}}" != "${COMP_WORDS[i]}" ]]; do
cur="${cur:1}";
index="$(( index - 1 ))";
done;
if [[ "$i" -lt "$COMP_CWORD" ]]; then
local old_size="${#cur}";
cur="${cur#${COMP_WORDS[i]}}";
local new_size="${#cur}";
index="$(( index - old_size + new_size ))";
fi;
done;
if [[ "${COMP_WORDS[COMP_CWORD]:0:${#cur}}" != "$cur" ]]; then
printf "%s" "${COMP_WORDS[COMP_CWORD]}";
else
printf "%s" "${cur:0:$index}";
fi;
fi
}
_getent ()
{
local cur prev;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case $prev in
passwd)
COMPREPLY=($( compgen -u $cur ));
return 0
;;
group)
COMPREPLY=($( compgen -g $cur ));
return 0
;;
services)
COMPREPLY=($( compgen -s $cur ));
return 0
;;
hosts)
COMPREPLY=($( compgen -A hostname $cur ));
return 0
;;
protocols | networks | ahosts | ahostsv4 | ahostsv6 | rpc)
COMPREPLY=($( getent $prev | sed -ne 's|^\('$cur'[^[:space:]]*\).*|\1|p' ));
return 0
;;
aliases | shadow)
COMPREPLY=($( getent $prev | sed -ne 's|^\('$cur'[^:]*\).*|\1|p' ));
return 0
;;
esac;
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=($( compgen -W 'passwd group hosts services \
protocols networks ahosts ahostsv4 \
ahostsv6 aliases ethers netgroup \
rpc shadow' -- $cur ));
fi
}
_gids ()
{
if type getent &>/dev/null; then
COMPREPLY=($( getent group | awk -F: '{if ($3 ~ /^'$cur'/) print $3}' ));
else
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;
fi
}
_gkrellm ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
-@(t|-theme))
_filedir -d;
return 0
;;
-@(p|-plugin))
_filedir 'so';
return 0
;;
-@(s|-server))
_known_hosts;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '--help -t --theme -s --server \
-g --geometry -wm -w --withdrawn -c --config -nc \
-f --force-host-config -demo -p --plugin -P \
--port' -- $cur ));
fi
}
_gnatmake ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-a -c -f -i -j -k -m -M -n -o \
-q -s -v -z -aL -A -aO -aI -I -I- -L -nostdinc \
-nostdlib -cargs -bargs -largs -fstack-check \
-fno-inline -g -O1 -O0 -O2 -O3 -gnata -gnatA \
-gnatb -gnatc -gnatd -gnatD -gnate -gnatE \
-gnatf -gnatF -gnatg -gnatG -gnath -gnati \
-gnatk -gnatl -gnatL -gnatm -gnatn -gnato \
-gnatO -gnatp -gnatP -gnatq -gnatR -gnats \
-gnatt -gnatT -gnatu -gnatU -gnatv -gnatws \
-gnatwe -gnatwl -gnatwu -gnatW -gnatx -gnatX \
-gnaty -gnatz -gnatZ -gnat83' -- $cur ));
else
_filedir '@(adb|ads)';
fi
}
_gpg ()
{
local cur prev;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
-@(s|-sign|-clearsign|-decrypt-files|-load-extension))
_filedir;
return 0
;;
--@(export|@(?(l|nr|nrl)sign|edit)-key))
COMPREPLY=($( compgen -W "$( gpg --list-keys 2>/dev/null | sed -ne 's@^pub.*/\([^ ]*\).*$@\1@p;s@^.*\(<\([^>]*\)>\).*$@\2@p')" -- "$cur" ));
return 0
;;
-@(r|-recipient))
COMPREPLY=($( compgen -W "$( gpg --list-keys 2>/dev/null | sed -ne 's@^.*<\([^>]*\)>.*$@\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 $(gpg --dump-options)' -- $cur ));
fi
}
_gzip ()
{
local cur prev xspec helpopts;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
helpopts=`_parse_help gzip`;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W "$helpopts -2 -3 -4 -5 -6 -7 -8" -- "$cur" ));
return 0;
fi;
local IFS='
';
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" = '>' -o "$prev" = '>>' ]; then
xspec=;
else
if [ "$prev" = '<' ]; then
xspec=;
fi;
fi;
fi;
fi;
_expand || return 0;
COMPREPLY=($( compgen -f -X "$xspec" -- $cur ) $( compgen -d -- $cur ))
}
_iconv ()
{
local cur prev;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
-@(f|t|-@(from|to)-code))
COMPREPLY=($( compgen -W '$( iconv --list | sed -e "s@//@@;" )' -- "$cur" ));
return 0
;;
esac;
if [[ "$cur" = -* ]]; then
COMPREPLY=($( compgen -W '--from-code -f --to-code -t --list
--output -o --verbose' -- "$cur" ));
return 0;
fi
}
_id ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-a -g --group -G --groups -n --name\
-r --real -u --user --help --version' -- $cur ));
else
COMPREPLY=($( compgen -u $cur ));
fi
}
_identify ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
_ImageMagick;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-alpha -antialias -authenticate \
-channel -colorspace -crop -debug -define -density \
-depth -extract -format -fuzz -gamma -help -interlace \
-interpolate -limit -list -log -monitor -ping -quiet \
-regard-warnings -respect-parenthesis \
-sampling-factor -seed -set -size -strip -units \
-verbose -version -virtual-pixel' -- $cur ));
else
if [[ "$cur" == +* ]]; then
COMPREPLY=($( compgen -W '+debug' -- $cur ));
else
_filedir;
fi;
fi
}
_ifupdown ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
if [ $COMP_CWORD -eq 1 ]; then
_configured_interfaces;
COMPREPLY=($(compgen -W '${COMPREPLY[@]}' -- "$cur"));
fi;
return 0
}
_import ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
_ImageMagick;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-adjoin -annotate -border -channel \
-colors -colorspace -comment -compress -crop -debug \
-define -delay -density -depth -descend -display \
-dispose -dither -encipher -encoding -endian -filter \
-format -frame -geometry -gravity -help -identify \
-interlace -interpolate -label -limit -list -log \
-monitor -monochrome -negate -page -pause -pointsize \
-quality -quantize -quiet -regard-warnings -repage \
-resize -respect-parenthesis -rotate -sampling-factor \
-scene -screen -seed -set -silent -snaps -strip \
-thumbnail -transparent -transparent-color -treedepth \
-trim -type -verbose -version -virtual-pixel \
-window' -- $cur ));
else
if [[ "$cur" == +* ]]; then
COMPREPLY=($( compgen -W '+debug' -- $cur ));
else
_filedir;
fi;
fi
}
_info ()
{
local cur infopath;
COMPREPLY=();
cur=`_get_cword`;
_expand || return 0;
if [[ "$cur" == */* ]]; then
_filedir;
return 0;
fi;
infopath='/usr/share/info';
if [ "${INFOPATH: -1:1}" == ':' ]; then
infopath=${INFOPATH}${infopath};
else
if [ ${INFOPATH:+set} ]; then
infopath=$INFOPATH;
fi;
fi;
infopath=$infopath:;
if [ -n "$cur" ]; then
infopath="${infopath//://$cur* }";
else
infopath="${infopath//:// }";
fi;
COMPREPLY=($( eval command ls "$infopath" 2>/dev/null ));
COMPREPLY=(${COMPREPLY[@]##*/?(:)});
for ((i=0 ; i < ${#COMPREPLY[@]} ; ++i ))
do
if [ "${COMPREPLY[$i]}" == 'dir' ]; then
unset COMPREPLY[$i];
fi;
done;
COMPREPLY=(${COMPREPLY[@]%.@(gz|bz2|lzma)});
COMPREPLY=($( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" ));
return 0
}
_inject ()
{
local cur prev;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
-@(l|-listname=))
_mailman_lists;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-l --listname= -q --queue= \
-h --help' -- $cur ));
else
_filedir;
fi
}
_insmod ()
{
local cur prev modpath;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
if [ $1 = "modprobe" ] && [ "${COMP_WORDS[1]}" = "-r" ]; then
_installed_modules "$cur";
return 0;
fi;
if [[ "$cur" == */* ]]; then
_filedir '@(?(k)o?(.gz))';
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
_modules $(uname -r);
fi;
return 0
}
_insserv ()
{
local cur prev sysvdir services options;
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
[ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d;
services=($(echo $sysvdir/!(README*|*.dpkg*|*.rpm@(orig|new|save))));
services=(${services[@]#$sysvdir/});
options=(-c --config -d -f -n -o --override -p --path -r -v);
case "$prev" in
-c | --config)
_filedir
;;
-o | --override | -p | --path)
_filedir -d
;;
*)
COMPREPLY=($( compgen -W '${options[@]} ${services[@]}' -- $cur ))
;;
esac;
return 0
}
_installed_modules ()
{
COMPREPLY=($( compgen -W "$( /sbin/lsmod | awk '{if (NR != 1) print $1}' )" -- $1 ))
}
_invoke_rc_d ()
{
local cur prev sysvdir services options valid_options;
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
[ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d;
services=($(echo $sysvdir/!(README*|*.sh|*.dpkg*|*.rpm@(orig|new|save))));
services=(${services[@]#$sysvdir/});
options=(--help --quiet --force --try-anyway --disclose-deny --query --no-fallback);
if [[ ( $COMP_CWORD -eq 1 ) || ( "$prev" == --* ) ]]; then
valid_options=($( echo ${COMP_WORDS[@]} ${options[@]} | tr " " "\n" | sed -ne "/$( echo ${options[@]} | sed "s/ /\\\\|/g" )/p" | sort | uniq -u ));
COMPREPLY=($( compgen -W '${valid_options[@]} ${services[@]}' -- $cur ));
else
if [ -x $sysvdir/$prev ]; then
COMPREPLY=($( compgen -W '`sed -ne "y/|/ /; \
s/^.*Usage:[ ]*[^ ]*[ ]*{*\([^}\"]*\).*$/\1/p" \
$sysvdir/$prev`' -- $cur ));
else
COMPREPLY=();
fi;
fi;
return 0
}
_iptables ()
{
local cur prev table chain;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
chain='s/^Chain \([^ ]\+\).*$/\1/p';
if [[ $COMP_LINE == *-t\ *filter* ]]; then
table="-t filter";
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
}
_isql ()
{
local cur;
cur=`_get_cword`;
[ -f "$ODBCINI" ] && COMPREPLY=($( grep \\[$cur "$ODBCINI" | tr -d \\[\\] ))
}
_iwconfig ()
{
local cur prev;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case $prev in
mode)
COMPREPLY=($( compgen -W 'managed ad-hoc master \
repeater secondary monitor' -- $cur ));
return 0
;;
essid)
COMPREPLY=($( compgen -W 'on off any' -- $cur ));
if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
COMPREPLY=("${COMPREPLY[@]}" $( iwlist ${COMP_WORDS[1]} scan | awk -F '"' '/ESSID/ {print $2}' | grep "^$cur" ));
fi;
return 0
;;
nwid)
COMPREPLY=($( compgen -W 'on off' -- $cur ));
return 0
;;
channel)
COMPREPLY=($( iwlist ${COMP_WORDS[1]} channel | awk '/^[[:space:]]*Channel/ {print $2}' | grep "^$cur" ));
return 0
;;
freq)
COMPREPLY=($( iwlist ${COMP_WORDS[1]} channel | awk '/^[[:space:]]*Channel/ {print $4"G"}' | grep "^$cur" ));
return 0
;;
ap)
COMPREPLY=($( compgen -W 'on off any' -- $cur ));
if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
COMPREPLY=("${COMPREPLY[@]}" $( iwlist ${COMP_WORDS[1]} scan | awk -F ': ' '/Address/ {print $2}' | grep "^$cur" ));
fi;
return 0
;;
rate)
COMPREPLY=($( compgen -W 'auto fixed' -- $cur ));
COMPREPLY=("${COMPREPLY[@]}" $( iwlist ${COMP_WORDS[1]} rate | awk '/^[[:space:]]*[0-9]/ {print $1"M"}' | grep "^$cur" ));
return 0
;;
rts)
COMPREPLY=($( compgen -W 'auto fixed off' -- $cur ));
return 0
;;
frag)
COMPREPLY=($( compgen -W 'auto fixed off' -- $cur ));
return 0
;;
key)
COMPREPLY=($( compgen -W 'off on open restricted' -- $cur ));
return 0
;;
enc)
COMPREPLY=($( compgen -W 'off on open restricted' -- $cur ));
return 0
;;
power)
COMPREPLY=($( compgen -W 'period timeout off on' -- $cur ));
return 0
;;
txpower)
COMPREPLY=($( compgen -W 'off on auto' -- $cur ));
return 0
;;
retry)
COMPREPLY=($( compgen -W 'limit lifetime' -- $cur ));
return 0
;;
esac;
if [ $COMP_CWORD -eq 1 ]; then
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '--help --version' -- $cur ));
else
_available_interfaces -w;
fi;
else
COMPREPLY=($( compgen -W 'essid nwid mode freq channel sens mode \
ap nick rate rts frag enc key power txpower commit' -- $cur ));
fi
}
_iwlist ()
{
local cur prev;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
if [ $COMP_CWORD -eq 1 ]; then
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '--help --version' -- $cur ));
else
_available_interfaces -w;
fi;
else
COMPREPLY=($( compgen -W 'scan scanning freq frequency \
channel rate bit bitrate key enc encryption power \
txpower retry ap accesspoint peers event' -- $cur ));
fi
}
_iwpriv ()
{
local cur prev;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
roam)
COMPREPLY=($( compgen -W 'on off' -- $cur ));
return 0
;;
port)
COMPREPLY=($( compgen -W 'ad-hoc managed' -- $cur ));
return 0
;;
esac;
if [ $COMP_CWORD -eq 1 ]; then
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '--help --version' -- $cur ));
else
_available_interfaces -w;
fi;
else
COMPREPLY=($( compgen -W '--all roam port' -- $cur ));
fi
}
_iwspy ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
if [ $COMP_CWORD -eq 1 ]; then
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '--help --version' -- $cur ));
else
_available_interfaces -w;
fi;
else
COMPREPLY=($( compgen -W 'setthr getthr off' -- $cur ));
fi
}
_jar ()
{
local cur;
COMPREPLY=();
cur=`_get_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 '?([ejw]ar|zip|[EJW]AR|ZIP)'
;;
*)
_filedir
;;
esac
}
_java ()
{
local cur prev i;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
for ((i=1; i < $COMP_CWORD; i++))
do
case ${COMP_WORDS[$i]} in
-cp | -classpath)
((i++))
;;
-*)
;;
*)
_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 -maxdepth 1 -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;
if [ -z "$sourcepath" ]; then
_java_find_classpath;
sourcepath=$classpath;
fi
}
_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=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case $prev in
-d)
_filedir -d;
return 0
;;
-@(classpath|bootclasspath|sourcepath|extdirs))
_java_path;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
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
}
_javadoc ()
{
COMPREPLY=();
local cur prev;
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case $prev in
-@(overview|helpfile|stylesheetfile))
_filedir;
return 0
;;
-d)
_filedir -d;
return 0
;;
-@(classpath|bootclasspath|docletpath|sourcepath|extdirs))
_java_path;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
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
}
_kernel_versions ()
{
COMPREPLY=($( command ls /lib/modules | grep "^$cur" ))
}
_kernels ()
{
COMPREPLY=($( cd /lib/modules && compgen -d -- "$cur" ))
}
_kill ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
if [ $COMP_CWORD -eq 1 ] && [[ "$cur" == -* ]]; then
_signals;
else
_pids;
fi
}
_killall ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
if [ $COMP_CWORD -eq 1 ] && [[ "$cur" == -* ]]; then
_signals;
else
_pnames;
fi;
return 0
}
_known_hosts ()
{
local configfile;
local cur curd ocur user suffix aliases global_kh user_kh hosts i host;
local -a kh khd config;
COMPREPLY=();
cur=`_get_cword`;
ocur=$cur;
local OPTIND=1;
while getopts "acF:" flag "$@"; do
case $flag in
a)
aliases='yes'
;;
c)
suffix=':'
;;
F)
configfile="$OPTARG"
;;
esac;
done;
[[ $cur == *@* ]] && user=${cur%@*}@ && cur=${cur#*@};
kh=();
if [ -n "$configfile" ]; then
[ -r "$configfile" ] && config=("${config[@]}" "$configfile");
else
[ -r /etc/ssh/ssh_config ] && config=("${config[@]}" "/etc/ssh/ssh_config");
[ -r "${HOME}/.ssh/config" ] && config=("${config[@]}" "${HOME}/.ssh/config");
[ -r "${HOME}/.ssh2/config" ] && config=("${config[@]}" "${HOME}/.ssh2/config");
fi;
if [ ${#config[@]} -gt 0 ]; then
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[@]}" )" );
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[@]}" )" );
fi;
[ -r "$global_kh" ] && kh=("${kh[@]}" "$global_kh");
if [ -z "$configfile" ]; then
[ -r /etc/ssh/ssh_known_hosts ] && kh=("${kh[@]}" /etc/ssh/ssh_known_hosts);
[ -r /etc/ssh/ssh_known_hosts2 ] && kh=("${kh[@]}" /etc/ssh/ssh_known_hosts2);
[ -r /etc/known_hosts ] && kh=("${kh[@]}" /etc/known_hosts);
[ -r /etc/known_hosts2 ] && kh=("${kh[@]}" /etc/known_hosts2);
[ -d /etc/ssh2/knownhosts ] && khd=("${khd[@]}" /etc/ssh2/knownhosts/*pub);
fi;
[ -r "$user_kh" ] && kh=("${kh[@]}" "$user_kh");
if [ -z "$configfile" ]; then
[ -r ~/.ssh/known_hosts ] && kh=("${kh[@]}" ~/.ssh/known_hosts);
[ -r ~/.ssh/known_hosts2 ] && kh=("${kh[@]}" ~/.ssh/known_hosts2);
[ -d ~/.ssh2/hostkeys ] && khd=("${khd[@]}" ~/.ssh2/hostkeys/*pub);
fi;
if [ ${#kh[@]} -gt 0 -o ${#khd[@]} -gt 0 -o -n "$configfile" ]; then
cur=${cur//\//\\\/};
cur=${cur//\./\\\.};
curd=$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;
if [ ${#kh[@]} -gt 0 ]; then
COMPREPLY=($( awk 'BEGIN {FS=","}
/^\s*[^|\#]/ {for (i=1; i<=2; ++i) { \
gsub(" .*$", "", $i); \
if ($i ~ /'$cur'/) {print $i} \
}}' "${kh[@]}" 2>/dev/null ));
fi;
if [ ${#khd[@]} -gt 0 ]; then
for i in "${khd[@]}";
do
if [[ "$i" == *key_22_$curd*.pub ]] && [ -r "$i" ]; then
host=${i/#*key_22_/};
host=${host/%.pub/};
COMPREPLY=("${COMPREPLY[@]}" $host);
fi;
done;
fi;
if [ ${#config[@]} -gt 0 ] && [ -n "$aliases" ]; then
local host_aliases=$( sed -ne 's/^[ \t]*[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\?['"$'\t '"']\+\([^#*?]*\)\(#.*\)\?$/\2/p' "${config[@]}" );
hosts=$( compgen -W "$host_aliases" -- $ocur );
COMPREPLY=("${COMPREPLY[@]}" $hosts);
fi;
COMPREPLY=("${COMPREPLY[@]}" $( compgen -A hostname -- $ocur ));
for ((i=0; i < ${#COMPREPLY[@]}; i++ ))
do
COMPREPLY[i]=$user${COMPREPLY[i]}$suffix;
done;
else
if [ -z "$configfile" ]; then
COMPREPLY=($( compgen -A hostname -S "$suffix" -- $cur ));
fi;
fi;
return 0
}
_larch ()
{
local cur prev;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
if [ $COMP_CWORD -eq 1 ] || [[ "$prev" == -* ]]; then
COMPREPLY=($( compgen -W ' \
my-id my-default-archive register-archive whereis-archive archives \
init-tree tree-root tree-version set-tree-version inventory tagging-method \
tree-lint missing-tags add delete move explicit-default set-manifest \
manifest check-manifest mkpatch dopatch patch-report empty-patch \
make-archive make-category make-branch make-version categories \
branches versions revisions cat-archive-log archive-cache-revision \
archive-cached-revisions archive-uncache-revision category-readme \
branch-readme version-readme make-log logs add-log log-ls cat-log \
log-header-field changelog log-for-merge merge-points new-on-branch \
import commit get get-patch lock-branch lock-revision push-mirror \
build-config update-config replay-config record-config show-config \
config-history update replay delta-patch star-merge tag prepare-branch \
finish-branch join-branch whats-missing what-changed file-diffs pristines \
lock-pristine my-revision-library library-find library-add library-remove \
library-archives library-categories library-branches library-versions \
library-revisions library-log library-file touched-files-prereqs \
patch-set-web update-distributions distribution-name notify my-notifier \
mail-new-categories mail-new-branches mail-new-versions mail-new-revisions \
notify-library notify-browser push-new-revisions sendmail-mailx' $cur ));
fi;
return 0
}
_lftp ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
if [ $COMP_CWORD -eq 1 ] && [ -f ~/.lftp/bookmarks ]; then
COMPREPLY=($( compgen -W '$( sed -ne "s/^\(.*\)'' ''.*$/\1/p" \
~/.lftp/bookmarks )' -- $cur ));
fi;
return 0
}
_lisp ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-core -lib -batch -quit -edit -eval -init \
-dynamic-space-size -hinit -noinit -nositeinit -load \
-slave ' -- $cur ));
else
_filedir;
fi;
return 0
}
_list_admins ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '--all-vhost= -v \
--all -a -h --help' -- $cur ));
else
_mailman_lists;
fi
}
_list_lists ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-a --advertised \
--virtual-host-overview= -V -b --bare \
-h --help' -- $cur ));
fi
}
_list_members ()
{
local cur prev;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
-@(o|-output))
_filedir;
return 0
;;
-@(d|-digest=))
COMPREPLY=($( compgen -W 'mime plain' -- $cur));
return 0
;;
-@(n|-nomail=))
COMPREPLY=($( compgen -W 'byadmin byuser bybounce unknown' -- $cur));
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '--output -o --regular -r \
--digest= -d --nomail= -n --fullnames -f \
--preserve -p -h --help' -- $cur ));
else
_mailman_lists;
fi
}
_list_owners ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-w --with-listnames \
-m --moderators -h --help' -- $cur ));
else
_mailman_lists;
fi
}
_longopt ()
{
local cur opt;
cur=`_get_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/' | command grep "^$cur" | sort -u ));
else
if [[ "$1" == rmdir ]]; then
_filedir -d;
else
_filedir;
fi;
fi
}
_look ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
if [ $COMP_CWORD = 1 ]; then
COMPREPLY=($( compgen -W '$(look $cur 2>/dev/null)' ));
fi
}
_lzma ()
{
local cur prev xspec;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-c -d -f -h -k -L -q -s \
-v -V -z -1 -2 -3 -4 -5 -6 -7 -8 -9 \
--help --decompress --compress --keep --force \
--test --stdout --quiet --verbose --license \
--version --small --fast --best --text' -- $cur ));
return 0;
fi;
local IFS='
';
xspec="*.lzma";
if [[ "$prev" == --* ]]; then
[[ "$prev" == --decompress || "$prev" == --list || "$prev" == --test ]] && xspec="!"$xspec;
[[ "$prev" == --compress ]] && xspec=;
else
if [[ "$prev" == -* ]]; then
[[ "$prev" == -*[dt]* ]] && xspec="!"$xspec;
[[ "$prev" == -*z* ]] && xspec=;
fi;
fi;
_expand || return 0;
COMPREPLY=($( compgen -f -X "$xspec" -- $cur ) $( compgen -d -- $cur ))
}
_macof ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
-i)
_interfaces;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-i -s -d -e -x -y -n' -- $cur ));
fi
}
_mailman_lists ()
{
COMPREPLY=($( list_lists -b | grep "^$cur"))
}
_mailmanctl ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-n --no-restart -u --run-as-user \
-s --stale-lock-cleanup --quiet -q -h --help' -- $cur ));
else
COMPREPLY=($( compgen -W 'start stop restart reopen' -- $cur ));
fi
}
_make ()
{
local file makef makef_dir="." makef_inc cur prev i;
COMPREPLY=();
cur=`_get_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
for ((i=0; i < ${#COMP_WORDS[@]}; i++ ))
do
if [[ ${COMP_WORDS[i]} == -C ]]; then
eval makef_dir=${COMP_WORDS[i+1]};
break;
fi;
done;
for ((i=0; i < ${#COMP_WORDS[@]}; i++ ))
do
if [[ ${COMP_WORDS[i]} == -f ]]; then
eval makef=${COMP_WORDS[i+1]};
break;
fi;
done;
[ -n "$makef" ] && makef="-f ${makef}";
[ -n "$makef_dir" ] && makef_dir="-C ${makef_dir}";
COMPREPLY=($( make -qp $makef $makef_dir 2>/dev/null | awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ \
{split($1,A,/ /);for(i in A)print A[i]}' | command grep "^$cur" ));
fi
}
_man ()
{
local cur prev sect manpath manext mansect uname;
manext="@([0-9lnp]|[0-9][px]|man)?(.@(gz|bz2|lzma))";
mansect="@([0-9lnp]|[0-9][px])";
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
if [[ "$prev" == -l ]]; then
_filedir $manext;
return 0;
fi;
_expand || return 0;
if [[ "$cur" == */* ]]; then
_filedir $manext;
return 0;
fi;
uname=$( uname -s );
if [[ $uname == @(Linux|GNU|GNU/*|FreeBSD|Cygwin|CYGWIN_*) ]]; 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" == $mansect ]] && sect=$prev || sect='*';
manpath=$manpath:;
if [ -n "$cur" ]; then
manpath="${manpath//://*man$sect/$cur* } ${manpath//://*cat$sect/$cur* }";
else
manpath="${manpath//://*man$sect/ } ${manpath//://*cat$sect/ }";
fi;
COMPREPLY=($( eval command ls "$manpath" 2>/dev/null ));
COMPREPLY=(${COMPREPLY[@]##*/?(:)});
COMPREPLY=(${COMPREPLY[@]%.@(gz|bz2|lzma)});
COMPREPLY=($( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" ));
if [[ "$prev" != $mansect ]]; then
local start=${#COMPREPLY[@]};
_filedir $manext;
for ((i=$start; i < ${#COMPREPLY[@]}; i++ ))
do
[[ ${COMPREPLY[i]} == */* ]] || COMPREPLY[i]=./${COMPREPLY[i]};
done;
fi;
return 0
}
_mc ()
{
local cur prev;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
-@(e|v|l|P))
_filedir;
return 0
;;
esac;
if [[ "$cur" == *=* ]]; then
prev=${cur/=*/};
cur=${cur/*=/};
case "$prev" in
--@(edit|view|ftplog|printwd))
_filedir;
return 0
;;
esac;
fi;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-a --stickchars -b --nocolor -c \
--color -C --colors= -d --nomouse -e --edit= -f \
--datadir -k --resetsoft -l --ftplog= -P --printwd= \
-s --slow -t --termcap -u --nosubshell -U --subshell \
-v --view= -V --version -x --xterm -h --help' -- $cur ));
else
_filedir -d;
fi
}
_mcrypt ()
{
local cur prev i decrypt;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
-@(g|-openpgp-z))
COMPREPLY=($( compgen -W '0 1 2 3 4 5 6 7 8 9' -- $cur ));
return 0
;;
-@(o|-keymode))
COMPREPLY=($( mcrypt --list-keymodes 2> /dev/null |
grep "^$cur" ));
return 0
;;
-@(m|-mode))
COMPREPLY=($( mcrypt --list 2> /dev/null |
sed -e 's/.*: //' -e 's/ $//' | sort |
uniq | tr " " "\n" | grep "^$cur" ));
return 0
;;
-@(a|-algorithm))
COMPREPLY=($( mcrypt --list 2> /dev/null |
awk '{print $1}' | grep "^$cur" ));
return 0
;;
-@(h|-hash))
COMPREPLY=($( mcrypt --list-hash 2> /dev/null |
sed 1d | grep "^$cur" ));
return 0
;;
-@(k|s|-@(key?(size))))
return 0
;;
-@(f|c|-@(keyfile|config)))
_filedir;
return 0
;;
--@(algorithm|mode)s-directory)
_filedir -d;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-g --openpgp --openpgp-z -d \
--decrypt -s --keysize -o --keymode -f --keyfile \
-c --config -a --algorithm --algorithms-directory \
-m --mode --modes-directory -h --hash -k --key \
--noiv -b --bare -z --gzip -p --bzip2 --flush -l \
--doublecheck -u --unlink --nodelete -t --time -F \
--force --echo -r --random --list --list-keymodes \
--list-hash -V --verbose -q --quiet --help -v \
--version -L --license' -- $cur ));
else
if [[ ${COMP_WORDS[0]} == mdecrypt ]]; then
_filedir '@(nc)';
else
decrypt=0;
for ((i=1; i < ${#COMP_WORDS[@]}-1; i++ ))
do
if [[ ${COMP_WORDS[i]} == -@(d|-decrypt) ]]; then
_filedir '@(nc)';
decrypt=1;
break;
fi;
done;
if [[ $decrypt -eq 0 ]]; then
_filedir;
fi;
fi;
fi
}
_mii_tool ()
{
local cur prev;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case $prev in
-F)
COMPREPLY=($( compgen -W '100baseTx-FD 100baseTx-HD \
10baseT-FD 10baseT-HD' -- $cur ));
return 0
;;
-A)
COMPREPLY=($( compgen -W '100baseT4 100baseTx-FD 100baseTx-HD \
10baseT-FD 10baseT-HD' -- $cur ));
return 0
;;
esac;
if [[ "$cur" == *=* ]]; then
prev=${cur/=*/};
cur=${cur/*=/};
case "$prev" in
--force)
COMPREPLY=($( compgen -W '100baseTx-FD \
100baseTx-HD 10baseT-FD \
10baseT-HD' -- $cur ));
return 0
;;
--advertise)
COMPREPLY=($( compgen -W '100baseT4 \
100baseTx-FD 100baseTx-HD 10baseT-FD \
10baseT-HD' -- $cur ));
return 0
;;
esac;
fi;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-v --verbose -V --version -R \
--reset -r --restart -w --watch -l --log -A \
--advertise= -F --force=' -- $cur ));
else
_available_interfaces -a;
fi
}
_mkisofs ()
{
local cur prev;
COMPREPLY=();
cur=`_get_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
}
_mmsitepass ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-c --listcreator -h --help' -- $cur ));
fi
}
_modules ()
{
local modpath;
modpath=/lib/modules/$1;
COMPREPLY=($( command ls -R $modpath | sed -ne 's/^\('$cur'.*\)\.k\?o\(\|.gz\)$/\1/p'))
}
_mogrify ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
_ImageMagick;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-adaptive-blur -adaptive-resize \
-adaptive-sharpen -adjoin -affine -alpha -annotate \
-antialias -attenuate -authenticate -auto-orient \
-background -bias -black-point-compensation \
-black-threshold -blue-primary -blur -border \
-bordercolor -caption -channel -charcoal -chop -clip \
-clip-mask -clip-path -clut -colorize -colors \
-colorspace -comment -compose -compress -contrast \
-contrast-stretch -convolve -cycle -debug -decipher \
-define -delay -density -depth -despeckle -display \
-dispose -distort -dither -draw -edge -emboss \
-encipher -encoding -endian -enhance -equalize \
-evaluate -extent -extract -family -fill -filter \
-flip -floodfill -flop -font -format -frame -fuzz \
-gamma -gaussian-blur -geometry -gravity \
-green-primary -help -identify -implode -intent \
-interlace -interpolate -label -lat -layers -level \
-limit -linear-stretch -liquid-rescale -list -log \
-loop -mask -mattecolor -median -modulate -monitor \
-monochrome -motion-blur -negate -noise -normalize \
-opaque -ordered-dither -orient -page -paint -path \
-ping -pointsize -polaroid -posterize -preview -print \
-profile -quality -quantize -quiet -radial-blur \
-raise -random-threshold -recolor -red-primary \
-regard-warnings -region -render -repage -resample \
-resize -roll -rotate -sample -sampling-factor -scale \
-scene -seed -segment -sepia-tone -set -shade -shadow \
-sharpen -shave -shear -sigmoidal-contrast -size \
-sketch -solarize -splice -spread -stretch -strip \
-stroke -strokewidth -style -swirl -taint -texture \
-threshold -thumbnail -tile -tile-offset -tint \
-transform -transparent -transparent-color -transpose \
-transverse -treedepth -trim -type -undercolor \
-unique-colors -units -unsharp -verbose -version \
-view -vignette -virtual-pixel -wave -weight \
-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=`_get_cword`;
_ImageMagick;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-adjoin -affine -alpha \
-authenticate -background -blue-primary -blur -border \
-bordercolor -borderwidth -caption -channel -clone \
-coalesce -colors -colorspace -comment -compose \
-compress -crop -debug -define -density -depth \
-display -dispose -dither -draw -encoding -endian \
-extract -fill -filter -flatten -flip -flop -font \
-format -frame -gamma -geometry -gravity \
-green-primary -help -identify -interlace \
-interpolate -label -limit -list -log -mattecolor \
-mode -monitor -monochrome -origin -page -pointsize \
-polaroid -profile -quality -quantize -quiet \
-red-primary -regard-warnings -repage -resize \
-respect-parenthesis -rotate -sampling-factor -scenes \
-seed -set -shadow -size -strip -stroke -texture \
-thumbnail -tile -title -transform -transparent \
-transparent-color -treedepth -trim -type -units \
-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=`_get_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 2>/dev/null|
sed -ne '/^['"$'\t '"']*Sharename/,/^$/p' |
sed -ne '3,$s|^[^A-Za-z]*\([^'"$'\t '"']*\).*$|//'$host'/\1|p' ) )" -- "$cur" ));
fi;
else
if [ -r /etc/vfstab ]; then
COMPREPLY=($( awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' /etc/vfstab | grep "^$cur" ));
else
if [ ! -e /etc/fstab ]; then
COMPREPLY=($( mount | awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' | grep "^$cur" ));
else
COMPREPLY=($( awk '! /^[ \t]*#/ {if ($2 ~ /\//) print $2}' /etc/fstab | grep "^$cur" ));
fi;
fi;
fi;
fi;
return 0
}
_newlist ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-l --language -q --quiet -h --help' -- $cur ));
else
_mailman_lists;
fi
}
_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 ))
}
_ntpdate ()
{
local cur prev;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case $prev in
-k)
_filedir;
return 0
;;
-U)
COMPREPLY=($( compgen -u $cur ));
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-4 -6 -b -B -d -Q -q -s -u -v -a\
-e -k -p -o -r -t' -- $cur ));
else
_known_hosts;
fi
}
_ooexp_ ()
{
local c=${COMP_WORDS[COMP_CWORD]};
local a="${COMP_LINE}";
local e s g=0 cd dc t="";
local IFS;
shopt -q extglob && g=1;
test $g -eq 0 && shopt -s extglob;
cd='*-?(c)d*';
dc='*-d?(c)*';
case "${1##*/}" in
oobase)
e='!*.+(odb|ODB)'
;;
oofromtemplate)
e='!*.+(stw|STW|dot|DOT|vor|VOR|stc|STC|xlt|XLT|sti|STI|pot|POT|std|STD|stw|STW|dotm|DOTM|dotx|DOTX|potm|POTM|potx|POTX|xltm|XLTM|xltx|XLTX)'
;;
oodraw)
e='!*.+(sxd|SXD|std|STD|dxf|DXF|emf|EMF|eps|EPS|met|MET|pct|PCT|sgf|SGF|sgv|SGV|sda|SDA|sdd|SDD|vor|VOR|svm|SVM|wmf|WMF|bmp|BMP|gif|GIF|jpg|JPG|jpeg|JPEG|jfif|JFIF|fif|FIF|jpe|JPE|pcd|PCD|pcx|PCX|pgm|PGM|png|PNG|ppm|PPM|psd|PSD|ras|RAS|tga|TGA|tif|TIF|tiff|TIFF|xbm|XBM|xpm|XPM|odg|ODG|otg|OTG|fodg|FODG|odc|ODC|odi|ODI|sds|SDS|wpg|WPG|svg|SVG)'
;;
oocalc)
e='!*.+(sxc|SXC|stc|STC|dif|DIF|dbf|DBF|xls|XLS|xlw|XLW|xlt|XLT|rtf|RTF|sdc|SDC|vor|VOR|slk|SLK|txt|TXT|htm|HTM|html|HTML|wk1|WK1|wks|WKS|123|123|xml|XML|ods|ODS|ots|OTS|fods|FODS|csv|CSV|xlsb|XLSB|xlsm|XLSM|xlsx|XLSX|xltm|XLTM|xltx|XLTX)'
;;
oomath)
e='!*.+(sxm|SXM|smf|SMF|mml|MML|odf|ODF)'
;;
ooweb)
e='!*.+(htm|HTM|html|HTML|stw|STW|txt|TXT|vor|VOR|oth|OTH)'
;;
ooffice)
e='!*.+(sxd|SXD|std|STD|dxf|DXF|emf|EMF|eps|EPS|met|MET|pct|PCT|sgf|SGF|sgv|SGV|sda|SDA|sdd|SDD|vor|VOR|svm|SVM|wmf|WMF|bmp|BMP|gif|GIF|jpg|JPG|jpeg|JPEG|jfif|JFIF|fif|FIF|jpe|JPE|pcd|PCD|pcx|PCX|pgm|PGM|png|PNG|ppm|PPM|psd|PSD|ras|RAS|tga|TGA|tif|TIF|tiff|TIFF|xbm|XBM|xpm|XPM|odg|ODG|otg|OTG|fodg|FODG|odc|ODC|odi|ODI|sds|SDS|wpg|WPG|svg|SVG|doc|DOC|dot|DOT|rtf|RTF|sxw|SXW|stw|STW|sdw|SDW|vor|VOR|txt|TXT|htm?|HTM?|xml|XML|wp|WP|wpd|WPD|wps|WPS|odt|ODT|ott|OTT|fodt|FODT|docm|DOCM|docx|DOCX|dotm|DOTM|dotx|DOTX|sxm|SXM|smf|SMF|mml|MML|odf|ODF|sxi|SXI|sti|STI|ppt|PPT|pps|PPS|pot|POT|sxd|SXD|sda|SDA|sdd|SDD|sdp|SDP|vor|VOR|cgm|CGM|odp|ODP|otp|OTP|fodp|FODP|ppsm|PPSM|ppsx|PPSX|pptm|PPTM|pptx|PPTX|potm|POTM|potx|POTX|odb|ODB|sxc|SXC|stc|STC|dif|DIF|dbf|DBF|xls|XLS|xlw|XLW|xlt|XLT|rtf|RTF|sdc|SDC|vor|VOR|slk|SLK|txt|TXT|htm|HTM|html|HTML|wk1|WK1|wks|WKS|123|123|xml|XML|ods|ODS|ots|OTS|fods|FODS|csv|CSV|xlsb|XLSB|xlsm|XLSM|xlsx|XLSX|xltm|XLTM|xltx|XLTX|sxg|SXG|odm|ODM|sgl|SGL|stw|STW|dot|DOT|vor|VOR|stc|STC|xlt|XLT|sti|STI|pot|POT|std|STD|stw|STW|dotm|DOTM|dotx|DOTX|potm|POTM|potx|POTX|xltm|XLTM|xltx|XLTX|htm|HTM|html|HTML|stw|STW|txt|TXT|vor|VOR|oth|OTH)'
;;
oowriter)
e='!*.+(doc|DOC|dot|DOT|rtf|RTF|sxw|SXW|stw|STW|sdw|SDW|vor|VOR|txt|TXT|htm?|HTM?|xml|XML|wp|WP|wpd|WPD|wps|WPS|odt|ODT|ott|OTT|fodt|FODT|docm|DOCM|docx|DOCX|dotm|DOTM|dotx|DOTX|sxg|SXG|odm|ODM|sgl|SGL)'
;;
ooimpress)
e='!*.+(sxi|SXI|sti|STI|ppt|PPT|pps|PPS|pot|POT|sxd|SXD|sda|SDA|sdd|SDD|sdp|SDP|vor|VOR|cgm|CGM|odp|ODP|otp|OTP|fodp|FODP|ppsm|PPSM|ppsx|PPSX|pptm|PPTM|pptx|PPTX|potm|POTM|potx|POTX)'
;;
unopkg)
e='!*.+(oxt|OXT)'
;;
*)
e='!*'
;;
esac;
case "$(complete -p ${1##*/} 2> /dev/null)" in
*-d*)
;;
*)
s="-S/"
;;
esac;
IFS='
';
case "$c" in
\$\(*\))
eval COMPREPLY=\(${c}\)
;;
\$\(*)
COMPREPLY=($(compgen -c -P '$(' -S ')' -- ${c#??}))
;;
\`*\`)
eval COMPREPLY=\(${c}\)
;;
\`*)
COMPREPLY=($(compgen -c -P '\`' -S '\`' -- ${c#?}))
;;
\$\{*\})
eval COMPREPLY=\(${c}\)
;;
\$\{*)
COMPREPLY=($(compgen -v -P '${' -S '}' -- ${c#??}))
;;
\$*)
COMPREPLY=($(compgen -v -P '$' -- ${c#?}))
;;
\~*/*)
COMPREPLY=($(compgen -f -X "$e" -- ${c}))
;;
\~*)
COMPREPLY=($(compgen -u ${s} -- ${c}))
;;
*@*)
COMPREPLY=($(compgen -A hostname -P '@' -S ':' -- ${c#*@}))
;;
*[*?[]*)
COMPREPLY=($(compgen -G "${c}"))
;;
*[?*+\!@]\(*\)*)
if test $g -eq 0; then
COMPREPLY=($(compgen -f -X "$e" -- $c));
test $g -eq 0 && shopt -u extglob;
return;
fi;
COMPREPLY=($(compgen -G "${c}"))
;;
*)
if test "$c" = ".."; then
COMPREPLY=($(compgen -d -X "$e" -S / ${_nosp} -- $c));
else
for s in $(compgen -f -X "$e" -- $c);
do
if test -d $s; then
COMPREPLY=(${COMPREPLY[@]} $(compgen -f -X "$e" -S / -- $s));
else
if test -z "$t"; then
COMPREPLY=(${COMPREPLY[@]} $s);
else
case "$(file -b $s 2> /dev/null)" in
$t)
COMPREPLY=(${COMPREPLY[@]} $s)
;;
esac;
fi;
fi;
done;
fi
;;
esac;
test $g -eq 0 && shopt -u extglob
}
_openssl ()
{
local cur prev;
COMPREPLY=();
cur=`_get_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 ));
else
prev=${COMP_WORDS[COMP_CWORD-1]};
case ${COMP_WORDS[1]} in
asn1parse)
case $prev in
-inform)
COMPREPLY=($( compgen -W 'DER PEM' -- $cur ));
return 0
;;
-@(in|out|oid))
_filedir;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-inform -in -out -noout -offset \
-length -i -oid -strparse' -- $cur ));
fi
;;
ca)
case $prev in
-@(config|revoke|cert|in|out|spkac|ss_cert))
_filedir;
return 0
;;
-outdir)
_filedir -d;
return 0
;;
-@(name|crlexts|extensions))
_openssl_sections;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-verbose -config -name \
-gencrl -revoke -crldays -crlhours -crlexts \
-startdate -enddate -days -md -policy -keyfile \
-key -passin -cert -in -out -notext -outdir \
-infiles -spkac -ss_cert -preserveDN -batch \
-msie_hack -extensions' -- $cur ));
fi
;;
ciphers)
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-v -ssl2 -ssl3 -tls1' -- $cur ));
fi
;;
crl)
case $prev in
-@(in|out)form)
COMPREPLY=($( compgen -W 'DER PEM' -- $cur ));
return 0
;;
-@(in|out|CAfile))
_filedir;
return 0
;;
-CAPath)
_filedir -d;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-inform -outform -text -in -out -noout \
-hash -issuer -lastupdate -nextupdate -CAfile -CApath' -- $cur ));
fi
;;
crl2pkcs7)
case $prev in
-@(in|out)form)
COMPREPLY=($( compgen -W 'DER PEM' -- $cur ));
return 0
;;
-@(in|out))
_filedir;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-inform -outform -in -out -print_certs' -- $cur ));
fi
;;
dgst)
case $prev in
-@(out|sign|verify|prvrify|signature))
_filedir;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-md5 -md4 -md2 -sha1 -sha -mdc2 -ripemd160 -dss1 \
-c -d -hex -binary -out -sign -verify -prverify -signature' -- $cur ));
else
_filedir;
fi
;;
dsa)
case $prev in
-@(in|out)form)
COMPREPLY=($( compgen -W 'DER PEM' -- $cur ));
return 0
;;
-@(in|out))
_filedir;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-inform -outform -in -passin -out -passout -des -des3 -idea -text -noout \
-modulus -pubin -pubout' -- $cur ));
fi
;;
dsaparam)
case $prev in
-@(in|out)form)
COMPREPLY=($( compgen -W 'DER PEM' -- $cur ));
return 0
;;
-@(in|out|rand))
_filedir;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-inform -outform -in -out -noout \
-text -C -rand -genkey' -- $cur ));
fi
;;
enc)
case $prev in
-@(in|out|kfile))
_filedir;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-ciphername -in -out -pass \
-e -d -a -A -k -kfile -S -K -iv -p -P -bufsize -debug' -- $cur ));
fi
;;
dhparam)
case $prev in
-@(in|out)form)
COMPREPLY=($( compgen -W 'DER PEM' -- $cur ));
return 0
;;
-@(in|out|rand))
_filedir;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-inform -outform -in -out -dsaparam -noout \
-text -C -2 -5 -rand' -- $cur ));
fi
;;
gendsa)
case $prev in
-@(out|rand))
_filedir;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-out -des -des3 -idea -rand' -- $cur ));
else
_filedir;
fi
;;
genrsa)
case $prev in
-@(out|rand))
_filedir;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-out -passout -des -des3 -idea -f4 -3 -rand' -- $cur ));
fi
;;
pkcs7)
case $prev in
-@(in|out)form)
COMPREPLY=($( compgen -W 'DER PEM' -- $cur ));
return 0
;;
-@(in|out))
_filedir;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-inform -outform -in -out -print_certs -text -noout' -- $cur ));
fi
;;
rand)
case $prev in
-@(out|rand))
_filedir;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-out -rand -base64' -- $cur ));
fi
;;
req)
case "$prev" in
-@(in|out|key)form)
COMPREPLY=($( compgen -W 'DER PEM' -- $cur ));
return 0
;;
-@(in|out|rand|key|keyout|config))
_filedir;
return 0
;;
-extensions)
_openssl_sections;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-inform -outform -in \
-passin -out -passout -text -noout -verify \
-modulus -new -rand -newkey -newkey -nodes \
-key -keyform -keyout -md5 -sha1 -md2 -mdc2 \
-config -x509 -days -asn1-kludge -newhdr \
-extensions -reqexts section' -- $cur ));
fi
;;
rsa)
case $prev in
-@(in|out)form)
COMPREPLY=($( compgen -W 'DER NET PEM' -- $cur ));
return 0
;;
-@(in|out))
_filedir;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-inform -outform -in -passin -out -passout \
-sgckey -des -des3 -idea -text -noout -modulus -check -pubin \
-pubout -engine' -- $cur ));
fi
;;
rsautl)
case $prev in
-@(in|out|inkey))
_filedir;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-in -out -inkey -pubin -certin -sign -verify \
-encrypt -decrypt -pkcs -ssl -raw -hexdump -asn1parse' -- $cur ));
fi
;;
s_client)
case $prev in
-connect)
_known_hosts;
return 0
;;
-@(cert|key|CAfile|rand))
_filedir;
return 0
;;
-CApath)
_filedir -d;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-connect -verify -cert -key -CApath -CAfile \
-reconnect -pause -showcerts -debug -msg -nbio_test -state -nbio \
-crlf -ign_eof -quiet -ssl2 -ssl3 -tls1 -no_ssl2 -no_ssl3 -no_tls1 \
-bugs -cipher -starttls -engine -rand' -- $cur ));
fi
;;
s_server)
case $prev in
-@(cert|key|dcert|dkey|dhparam|CAfile|rand))
_filedir;
return 0
;;
-CApath)
_filedir -d;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-accept -context -verify -Verify -cert -key \
-dcert -dkey -dhparam -nbio -nbio_test -crlf -debug -msg -state -CApath \
-CAfile -nocert -cipher -quiet -no_tmp_rsa -ssl2 -ssl3 -tls1 -no_ssl2 \
-no_ssl3 -no_tls1 -no_dhe -bugs -hack -www -WWW -HTTP -engine -id_prefix \
-rand' -- $cur ));
fi
;;
s_time)
case $prev in
-connect)
_known_hosts;
return 0
;;
-@(cert|key|CAfile))
_filedir;
return 0
;;
-CApath)
_filedir -d;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-connect -www -cert -key -CApath -CAfile -reuse \
-new -verify -nbio -time -ssl2 -ssl3 -bugs -cipher' -- $cur ));
fi
;;
sess_id)
case $prev in
-@(in|out)form)
COMPREPLY=($( compgen -W 'DER PEM' -- $cur ));
return 0
;;
-@(in|out))
_filedir;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-inform -outform -in -out -text -noout \
-context ID' -- $cur ));
fi
;;
smime)
case $prev in
-@(in|out)form)
COMPREPLY=($( compgen -W 'SMIME DER PEM' -- $cur ));
return 0
;;
-@(in|out|certfile|signer|recip|inkey|content|rand))
_filedir;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-encrypt -decrypt -sign -verify -pk7out -des -des3 \
-rc2-40 -rc2-64 -rc2-128 -aes128 -aes192 -aes256 -in -certfile -signer \
-recip -inform -passin -inkey -out -outform -content -to -from -subject \
-text -rand' -- $cur ));
else
_filedir;
fi
;;
speed)
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-engine' -- $cur ));
else
COMPREPLY=($( compgen -W 'md2 mdc2 md5 hmac sha1 rmd160 idea-cbc \
rc2-cbc rc5-cbc bf-cbc des-cbc des-ede3 rc4 rsa512 rsa1024 rsa2048 \
rsa4096 dsa512 dsa1024 dsa2048 idea rc2 des rsa blowfish' -- $cur ));
fi
;;
verify)
case $prev in
-@(CAfile|untrusted))
_filedir;
return 0
;;
-CApath)
_filedir -d;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-CApath -CAfile -purpose -untrusted -help -issuer_checks \
-verbose -certificates' -- $cur ));
else
_filedir;
fi
;;
x509)
case "$prev" in
-@(in|out|CA|CAkey|CAserial|extfile))
_filedir;
return 0
;;
-@(in|out)form)
COMPREPLY=($( compgen -W 'DER PEM NET' -- $cur ));
return 0
;;
-@(key|CA|CAkey)form)
COMPREPLY=($( compgen -W 'DER PEM' -- $cur ));
return 0
;;
-extensions)
_openssl_sections;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-inform -outform \
-keyform -CAform -CAkeyform -in -out \
-serial -hash -subject -issuer -nameopt \
-email -startdate -enddate -purpose \
-dates -modulus -fingerprint -alias \
-noout -trustout -clrtrust -clrreject \
-addtrust -addreject -setalias -days \
-set_serial -signkey -x509toreq -req \
-CA -CAkey -CAcreateserial -CAserial \
-text -C -md2 -md5 -sha1 -mdc2 -clrext \
-extfile -extensions -engine' -- $cur ));
fi
;;
@(md5|md4|md2|sha1|sha|mdc2|ripemd160))
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-c -d' -- $cur ));
else
_filedir;
fi
;;
esac;
fi;
return 0
}
_openssl_sections ()
{
local config;
config=/etc/ssl/openssl.cnf;
[ ! -f $config ] && config=/usr/share/ssl/openssl.cnf;
for ((i=2; i < COMP_CWORD; i++ ))
do
if [[ "${COMP_WORDS[i]}" == -config ]]; then
config=${COMP_WORDS[i+1]};
break;
fi;
done;
[ ! -f $config ] && return 0;
COMPREPLY=($( awk '/\[.*\]/ {print $2} ' $config | grep "^$cur" ))
}
_p4 ()
{
local cur prev prev2 p4commands p4filetypes;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
p4commands="$( p4 help commands | awk 'NF>3 {print $1}' )";
p4filetypes="ctext cxtext ktext kxtext ltext tempobj ubinary uresource uxbinary xbinary xltext xtempobj xtext text binary resource";
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=($( compgen -W "$p4commands" -- $cur ));
else
if [ $COMP_CWORD -eq 2 ]; then
case "$prev" in
help)
COMPREPLY=($( compgen -W "simple commands environment filetypes jobview revisions usage views $p4commands" -- $cur ))
;;
admin)
COMPREPLY=($( compgen -W "checkpoint stop" -- $cur ))
;;
*)
;;
esac;
else
if [ $COMP_CWORD -gt 2 ]; then
prev2=${COMP_WORDS[COMP_CWORD-2]};
case "$prev" in
-t)
case "$prev2" in
add | edit | reopen)
COMPREPLY=($( compgen -W "$p4filetypes" -- $cur))
;;
*)
;;
esac
;;
*)
;;
esac;
fi;
fi;
fi;
return 0
}
_parse_help ()
{
local cmd;
cmd=$1;
$cmd --help | grep -- "^[[:space:]]*-" | tr "," " " | awk '{print $1; if ($2 ~ /-.*/) { print $2 } }' | sed -e "s:=.*::g"
}
_pci_ids ()
{
COMPREPLY=(${COMPREPLY[@]:-} $( compgen -W "$( lspci -n | awk '{print $3}')" -- $cur ))
}
_perl ()
{
local cur prev prefix temp;
local optPrefix optSuffix;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
prefix="";
if [[ "$cur" == -?* ]]; then
temp=$cur;
prev=${temp:0:2};
cur=${temp:2};
optPrefix=-P$prev;
optSuffix=-S/;
prefix=$prev;
fi;
case "$prev" in
-I | -x)
local IFS='
';
COMPREPLY=($( compgen -d $optPrefix $optSuffix -- "$cur" ));
return 0
;;
-m | -M)
_perlmodules;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-C -s -T -u -U -W -X -h -v -V -c -w -d \
-D -p -n -a -F -l -0 -I -m -M -P -S -x -i -e ' -- $cur ));
else
_filedir;
fi
}
_perldoc ()
{
local cur prev prefix temp;
COMPREPLY=();
cur=`_get_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;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-h -v -t -u -m -l -F -X -f -q' -- $cur ));
else
if [[ "$cur" != */* ]]; then
_perlmodules;
COMPREPLY=("${COMPREPLY[@]}" $( compgen -W '$( PAGER=/bin/cat man perl | sed -ne "/perl.*Perl overview/,/perlwin32/p" | awk "\$NF=2 { print \$1}" | grep perl )' -- $cur ));
fi;
fi
}
_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 ))
}
_pgrep ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
_pnames;
return 0
}
_pids ()
{
COMPREPLY=($( compgen -W '$( command ps axo pid | sed 1d )' -- $cur ))
}
_pkg_config ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-version --modversion \
--atleast-pkgconfig-version= --libs --libs-only-l \
--libs-only-other --libs-only-L --cflags \
--cflags-only-I --cflags-only-other --variable= \
--define-variable= --exists --uninstalled \
--atleast-version= --exact-version= --max-version= \
--list-all --debug --print-errors --silence-errors \
--errors-to-stdout -? --help --usage' -- $cur));
else
COMPREPLY=($( pkg-config --list-all 2>/dev/null | awk '{print $1}' | grep "^$cur" ));
fi
}
_pnames ()
{
COMPREPLY=($( compgen -W '$( command ps axo command | \
sed -e "1d; s/ .*//; s:.*/::; s/:$//;" \
-e "s/^[[(-]//; s/[])]$//" \
-e "s/^<defunct>$//")' -- $cur ))
}
_poff ()
{
local prev cur conns;
[ -r /etc/ppp/peers/ ] || return 0;
COMPREPLY=();
prev=${COMP_WORDS[COMP_CWORD-1]};
cur=${COMP_WORDS[COMP_CWORD]};
conns=$(\ls --color=none /etc/ppp/peers | egrep -v '(\.bak|~)$');
if [[ "$cur" == -* ]]; then
COMPREPLY=($(compgen -W '-r -d -c -a -h -v' -- $cur));
return 0;
fi;
if [ $COMP_CWORD -eq 1 ] && [[ "$cur" != -* ]] || [[ "$prev" == -* ]]; then
COMPREPLY=($(compgen -o filenames -W "$conns" $cur));
fi;
return 0
}
_pon ()
{
local cur conns;
[ -r /etc/ppp/peers/ ] || return 0;
COMPREPLY=();
cur=${COMP_WORDS[COMP_CWORD]};
conns=$(\ls --color=none /etc/ppp/peers | egrep -v '(\.bak|~)$');
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=($(compgen -o filenames -W "$conns" $cur));
fi;
return 0
}
_povray ()
{
local cur prev povcur pfx oext defoext;
defoext=png;
COMPREPLY=();
povcur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
_expand || return 0;
case $povcur in
[-+]I*)
cur="${povcur#[-+]I}";
pfx="${povcur%"$cur"}";
_filedir pov;
COMPREPLY=(${COMPREPLY[@]/#/$pfx});
return 0
;;
[-+]O*)
case $( ( IFS='
'; echo "${COMP_WORDS[*]}" | grep '^[-+]F' ) ) in
[-+]FN)
oext=png
;;
[-+]FP)
oext=ppm
;;
[-+]F[CT])
oext=tga
;;
*)
oext=$defoext
;;
esac;
COMPREPLY=($( ( IFS='
'; echo "${COMP_WORDS[*]}" | grep '^[-+]I' ) ));
COMPREPLY=(${COMPREPLY[@]#[-+]I});
COMPREPLY=(${COMPREPLY[@]/%.pov/.$oext});
cur="${povcur#[-+]O}";
pfx="${povcur%"$cur"}";
_filedir $oext;
COMPREPLY=(${COMPREPLY[@]/#/$pfx});
return 0
;;
*.ini\[ | *.ini\[*[^]])
cur="${povcur#*\[}";
pfx="${povcur%\["$cur"}";
[ -r "$pfx" ] || return 0;
COMPREPLY=($(sed -e 's/^[[:space:]]*\[\('"$cur"'[^]]*\]\).*$/\1/' -e 't' -e 'd' -- "$pfx"));
COMPREPLY=("${COMPREPLY[@]/#/$pfx[}");
return 0
;;
*)
cur="$povcur";
_filedir '?(ini|pov)';
return 0
;;
esac
}
_python ()
{
local prev cur;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]##*/};
case "$prev" in
-Q)
COMPREPLY=($( compgen -W "old new warn warnall" -- $cur ));
return 0
;;
-W)
COMPREPLY=($( compgen -W "ignore default all module once error" -- $cur ));
return 0
;;
-c)
_filedir '@(py|pyc|pyo)';
return 0
;;
!(python|-?))
[[ ${COMP_WORDS[COMP_CWORD-2]} != -@(Q|W) ]] && _filedir
;;
esac;
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
}
_qdbus ()
{
local cur compstr;
COMPREPLY=();
cur=`_get_cword`;
if [ -z "$cur" ]; then
compstr=${COMP_WORDS[*]};
else
compstr=$( command echo ${COMP_WORDS[*]} | sed "s/ ${cur/\//\\/}$//" );
fi;
COMPREPLY=($( compgen -W '$( command $compstr | sed s/\(.*\)// )' -- "$cur" ))
}
_qrunner ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-r --runner= --once -o \
-l --list -v --verbose -s --subproc -h --help' -- $cur ));
fi
}
_rdesktop ()
{
local cur prev;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case $prev in
-k)
COMPREPLY=($( command ls /usr/share/rdesktop/keymaps 2>/dev/null | egrep -v '(common|modifiers)' ));
COMPREPLY=(${COMPREPLY[@]:-} $( command ls $HOME/.rdesktop/keymaps 2>/dev/null ));
COMPREPLY=(${COMPREPLY[@]:-} $( command ls ./keymaps 2>/dev/null ));
COMPREPLY=($( compgen -W '${COMPREPLY[@]}' -- $cur ));
return 0
;;
-a)
COMPREPLY=($( compgen -W '8 15 16 24' -- $cur ));
return 0
;;
-x)
COMPREPLY=($( compgen -W 'b broadband m modem l lan' -- $cur ));
return 0
;;
-r)
COMPREPLY=($( compgen -W 'comport: disk: lptport: \
printer: sound: lspci scard' -- $cur ));
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-u -d -s -c -p -n -k -g -f -b -L \
-A -B -e -E -m -C -D -K -S -T -N -X -a -z -x -P -r \
-0 -4 -5' -- $cur ));
else
_known_hosts;
fi
}
_realcommand ()
{
type -P "$1" > /dev/null && {
if type -p realpath > /dev/null; then
realpath "$(type -P "$1")";
else
if type -p readlink > /dev/null; then
readlink -f "$(type -P "$1")";
else
type -P "$1";
fi;
fi
}
}
_remove_members ()
{
local cur prev;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
-@(f|-file=))
_filedir;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '--file= -f --all -a \
--fromall --nouserack -n --noadminack -N \
--help -h' -- $cur ));
else
_mailman_lists;
fi
}
_renice ()
{
local command cur curopt i;
COMPREPLY=();
cur=`_get_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
}
_ri ()
{
local cur class method prefix ri_path ri_version separator IFS;
local -a classes;
COMPREPLY=();
cur=`_get_cword`;
ri_path=$(type -p ri);
ri_version="$(ruby -W0 $ri_path -v 2>&1)" || ri_version=integrated;
[ "$ri_version" != "${ri_version%200*}" ] && ri_version=integrated;
IFS=',
';
if [[ "$cur" == [A-Z]*[#.]* ]]; then
[[ "$cur" == *#* ]] && separator=# || separator=.;
class=${cur%$separator*};
method=${cur#*$separator};
classes=($class);
prefix="-P $class$separator";
ri_get_methods;
return 0;
fi;
if [ "$ri_version" = integrated ]; then
classes=($( ri -c | ruby -ne 'if /^\s*$/..$stdin.eof then \
if /, [A-Z]+/ then print; end; end' ));
else
if [ "$ri_version" = "ri 1.8a" ]; then
classes=($( ruby -W0 $ri_path | ruby -ne 'if /^'"'"'ri'"'"' has/..$stdin.eof then \
if /^ .*[A-Z]/ then print; end; end' ));
else
classes=($( ruby -W0 $ri_path | ruby -ne 'if /^I have/..$stdin.eof then \
if /^ .*[A-Z]/ then print; end; end' ));
fi;
fi;
COMPREPLY=($( compgen -W '${classes[@]}' -- $cur ));
if [[ "$cur" == [A-Z]* ]]; then
return 0;
fi;
method=$cur;
ri_get_methods
}
_rl_enabled ()
{
[[ "$( bind -v )" = *$1+([[:space:]])on* ]]
}
_rmlist ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '--archives -a \
-h --help' -- $cur ));
else
_mailman_lists;
fi
}
_rmmod ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
_installed_modules "$cur";
return 0
}
_root_command ()
{
PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin _command $1 $2 $3
}
_route ()
{
local cur prev;
COMPREPLY=();
cur=`_get_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
}
_rsync ()
{
local cur prev shell i userhost path;
COMPREPLY=();
cur=`_get_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=ssh;
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
}
_sbcl ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '--core --noinform --help --version \
--sysinit --userinit --eval --noprint --disable-debugger \
--end-runtime-options --end-toplevel-options ' -- $cur ));
else
_filedir;
fi;
return 0
}
_scp ()
{
local cur userhost path;
local optconfigfile;
COMPREPLY=();
cur=`_get_cword ":"`;
_expand || return 0;
if [[ "$cur" == *:* ]]; then
local IFS='
';
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;
set -- "${COMP_WORDS[@]}";
while [ $# -gt 0 ]; do
if [ "${1:0:2}" = -F ]; then
if [ ${#1} -gt 2 ]; then
optconfigfile="$(dequote "$1")";
else
shift;
[ "$1" ] && optconfigfile="$(dequote "-F$1")";
fi;
break;
fi;
shift;
done;
[[ "$cur" == */* ]] || _known_hosts -c -a "$optconfigfile";
local IFS='
';
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 preprev;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
[ "$COMP_CWORD" -ge 2 ] && preprev=${COMP_WORDS[COMP_CWORD-2]};
if [ "$preprev" = "-d" -o "$preprev" = "-D" -a "$prev" = "-r" -o "$prev" = "-R" ]; then
COMPREPLY=($( command screen -ls | sed -ne 's|^['' '']\+\('$cur'[0-9]\+\.[^'' '']\+\).*$|\1|p' ));
else
case "$prev" in
-[rR])
COMPREPLY=($( command screen -ls | sed -ne 's|^['' '']\+\('$cur'[0-9]\+\.[^'' '']\+\).*Detached.*$|\1|p' ))
;;
-[dDx])
COMPREPLY=($( command screen -ls | sed -ne 's|^['' '']\+\('$cur'[0-9]\+\.[^'' '']\+\).*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=`_get_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
_services;
else
COMPREPLY=($( compgen -W '`sed -ne "y/|/ /; \
s/^.*Usage.*{\(.*\)}.*$/\1/p" \
$sysvdir/${prev##*/} 2>/dev/null`' -- $cur ));
fi;
return 0
}
_services ()
{
local sysvdir famdir;
[ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d;
famdir=/etc/xinetd.d;
COMPREPLY=($( builtin echo $sysvdir/!(*.rpm@(orig|new|save)|*~|functions)));
if [ -d $famdir ]; then
COMPREPLY=("${COMPREPLY[@]}" $( builtin echo $famdir/!(*.rpm@(orig|new|save)|*~)));
fi;
COMPREPLY=($( compgen -W '${COMPREPLY[@]#@($sysvdir|$famdir)/}' -- $cur ))
}
_signals ()
{
local i;
COMPREPLY=($( compgen -A signal SIG${cur#-} ));
for ((i=0; i < ${#COMPREPLY[@]}; i++ ))
do
COMPREPLY[i]=-${COMPREPLY[i]#SIG};
done
}
_sitecopy ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
case "$cur" in
--*)
COMPREPLY=($( compgen -W "$(sitecopy -h | grep -e '--\w' | awk '{sub (/=(FILE|PATH)/, "", $2); print $2}')" -- $cur ))
;;
-*)
COMPREPLY=($( compgen -W "$(sitecopy -h | grep -e '-\w' | awk '{sub (",", "", $1); print $1}')" -- $cur ))
;;
*)
if [ -r ~/.sitecopyrc ]; then
COMPREPLY=($( compgen -W "$(grep '^["$'\t '"]*site' ~/.sitecopyrc | awk '{print $2}')" -- $cur ));
fi
;;
esac;
return 0
}
_snarf ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
-i)
_interfaces;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-i -v' -- $cur ));
fi
}
_snownews ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '--update --help --version \
--disable-versioncheck -u -h -V' -- $cur));
fi
}
_ssh ()
{
local cur prev;
local optconfigfile;
local -a config;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
-F)
_filedir
;;
-*c)
COMPREPLY=($( compgen -W 'blowfish 3des 3des-cbc blowfish-cbc \
arcfour cast128-cbc' -- $cur ))
;;
-*i)
_filedir
;;
-*l)
COMPREPLY=($( compgen -u -- $cur ))
;;
*)
set -- "${COMP_WORDS[@]}";
while [ $# -gt 0 ]; do
if [ "${1:0:2}" = -F ]; then
if [ ${#1} -gt 2 ]; then
optconfigfile="$(dequote "$1")";
else
shift;
[ "$1" ] && optconfigfile="$(dequote "-F$1")";
fi;
break;
fi;
shift;
done;
_known_hosts -a "$optconfigfile";
[ $COMP_CWORD -eq 1 -o -n "$optconfigfile" ] || COMPREPLY=("${COMPREPLY[@]}" $( compgen -c -- $cur ))
;;
esac;
return 0
}
_ssh_copy_id ()
{
local cur prev;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
-*i)
_filedir
;;
*)
_known_hosts -a;
[ $COMP_CWORD -eq 1 ] || COMPREPLY=("${COMPREPLY[@]}" $( compgen -- $cur ))
;;
esac;
return 0
}
_sshmitm ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-d -I -p' -- $cur ));
else
_known_hosts;
fi
}
_sshow ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
-i)
_interfaces;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-d -i' -- $cur ));
fi
}
_stream ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
_ImageMagick;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-authenticate -channel -colorspace \
-compress -debug -define -density -depth -extract \
-help -identify -interlace -interpolate -limit -list \
-log -map -monitor -quantize -quiet -regard-warnings \
-respect-parenthesis -sampling-factor -seed -set \
-size -storage-type -transparent-color -verbose \
-version -virtual-pixel' -- $cur ));
else
if [[ "$cur" == +* ]]; then
COMPREPLY=($( compgen -W '+debug' -- $cur ));
else
_filedir;
fi;
fi
}
_subdirectories ()
{
COMPREPLY=($( cd $1 && compgen -d -- "$cur" ))
}
_svk ()
{
local cur prev commands options command;
COMPREPLY=();
cur=`_get_cword`;
commands='add admin annotate ann blame praise cat checkout co cleanup \
cmerge cm commit ci copy cp delete del remove rm depotmap \
depot describe desc diff di help h ? import info list ls log \
merge mirror mi mkdir move mv ren rename patch propdel pd pdel \
propedit pe pedit propget pg pget proplist pl plist propset ps \
pset pull push resolved revert smerge sm status st stat switch \
sw sync sy update up verify';
if [[ $COMP_CWORD -eq 1 ]]; then
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '--version' -- $cur ));
else
COMPREPLY=($( compgen -W "$commands" -- $cur ));
fi;
else
prev=${COMP_WORDS[COMP_CWORD-1]};
case $prev in
-@(F|-file|-targets))
_filedir;
return 0
;;
--encoding)
COMPREPLY=($( compgen -W '$( iconv --list | sed -e "s@//@@;" )' -- "$cur" ));
return 0
;;
esac;
command=${COMP_WORDS[1]};
if [[ "$cur" == -* ]]; then
case $command in
add)
options=' --non-recursive -N -q --quiet'
;;
@(blame|annotate|ann|praise))
options='-r --revisions -x --cross'
;;
cat)
options='-r --revision'
;;
@(checkout|co))
options='-r --revision -q --quiet -N \
--non-recursive -l --list -d \
--detach --export --relocate \
--purge'
;;
cleanup)
options='-a --all'
;;
@(cmerge|cm))
options='-c --change -l --log -r \
--revision -a --auto \
--verbatim --no-ticket -m \
--message -F --file --template \ --encoding -P --patch -S \
--sign -C --check-only --direct'
;;
@(commit|ci))
options='--import -m --message -F \
--file --encoding --template \
-P --patch -S --sign -C \
--check-only -N \
--non-recursive --direct'
;;
@(copy|cp))
options='-r --revision -p --parent -q \
--quiet -m --message -F --file \
--template --encoding -P \
--patch -S --sign -C \
--check-only --direct'
;;
@(delete|del|remove|rm))
options='-k --keep-local -m --message \
-F --file --encoding \
--template -P --patch -S \
--sign -C --check-only --direct'
;;
@(depotmap|depot))
options='-i --init -l --list -d \
--detach --relocate'
;;
@(diff|di))
options='-r --revision -s --summarize \
-b --verbose -N --non-recursive'
;;
import)
options='-f --from-checkout -t \
--to-checkout -m --message -F \
--file --template --encoding \
-P --patch -S --sign -C \
--check-only -N \
--non-recursive --direct'
;;
@(list|ls))
options='-r --revision -v --verbose -R \
--recursive -d --depth -f \
--full-path'
;;
log)
options='-r --revision -l --limit -q \
--quiet -x --cross -v --verbose'
;;
merge)
options='-r --revision -c --change -I \
--incremental -a --auto -l \
--log -s --sync -t --to -f \
--from --verbatim --no-ticket \
--track-rename -m --message \
-F --file --template \
--encoding -P --patch -S \
--sign -C --check-only --direct'
;;
@(mirror|mi))
options='-l --list -d --detach \
--relocate --recover --unlock \
--upgrade'
;;
mkdir)
options='-p --parent -m --message -F \
--file --template --encoding \
-P --patch -S --sign -C \
--check-only --direct'
;;
@(move|mv|rename|ren))
options='-r --revision -p --parent -q \
--quiet -m --message -F --file \
--encoding --template -P \
--patch -S --sign -C \
--check-only --direct'
;;
patch)
options='--depot'
;;
@(propdel|propset|pdel|pset|pd|ps))
options='-R --recursive -r --revision \
--revprop -m --message -F \
--file --template --encoding \
-P --patch -S --sign -C \
--check-only -q --quiet \
--direct'
;;
@(propedit|pedit|pe))
options='-R --recursive -r --revision \
--revprop -m --message -F \
--file --template --encoding \
-P --patch -S --sign -C \
--check-only --direct'
;;
@(propget|pget|pg))
options='-R --recursive -r --revision \
--revprop --strict'
;;
@(proplist|plist|pl))
options='-R --recursive -v --verbose \
-r --revision --revprop'
;;
pull)
options='-a --all -l --lump'
;;
push)
options='-f --from -l --lump -C \
--check -P --patch -S --sign \
--verbatim'
;;
resolved)
options='-R --recursive'
;;
revert)
options='-R --recursive -q --quiet'
;;
@(smerge|sm))
options='-I --incremental -l --log -B \
--baseless -b --base -s --sync \
-t --to -f --from --verbatim \
--no-ticket --track-rename \
--host --remoterev -m \
--message -F --file --template \
--encoding -P --patch -S \
--sign -C --check-only --direct'
;;
@(status|stat|st))
options='-q --quiet --no-ignore -N \
--non-recursive -v --verbose'
;;
@(switch|sw))
options='-r --revision -d --detach -q \
--quiet'
;;
@(sync|sy))
options='-a --all -s --skipto -t \
--torev'
;;
@(update|up))
options='-r --revision -N \
--non-recursive -C \
--check-only -s --sync -m \
--merge -q --quiet'
;;
esac;
options="$options --help -h";
COMPREPLY=($( compgen -W "$options" -- $cur ));
else
case $command in
@(help|h|\?))
COMPREPLY=($( compgen -W "$commands environment commands intro" -- $cur ))
;;
admin)
COMPREPLY=($( compgen -W 'help \
deltify dump hotcopy \
list-dblogs list-unused-dblogs \
load lstxns recover rmtxns \
setlog verify rmcache' -- $cur ))
;;
patch)
COMPREPLY=($( compgen -W '--ls --list \
--cat --view --regen \
--regenerate --up --update \
--apply --rm --delete' -- $cur ))
;;
sync)
COMPREPLY=($( compgen -W "$( svk mirror --list 2>/dev/null | awk '/^\//{print $1}' )" -- $cur ))
;;
@(co|checkout|push|pull))
if [[ "$cur" == //*/* ]]; then
path=${cur%/*}/;
else
path=//;
fi;
COMPREPLY=($( compgen -W "$( svk list $path 2>/dev/null | sed -e 's|\(.*\)|'$path'\1|')" -- $cur ))
;;
*)
_filedir
;;
esac;
fi;
fi;
return 0
}
_sync_members ()
{
local cur prev;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
-@(w|g|d|--welcome-msg=|-goodbye-msg|-digest=))
COMPREPLY=($( compgen -W 'y n' -- $cur));
return 0
;;
-@(d|-file))
_filedir;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '--no-change -n --welcome-msg= -w \
--goodbye-msg= -g --digest= -d --notifyadmin= -a \
-f --file -h --help' -- $cur ));
else
_mailman_lists;
fi
}
_sysctl ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
COMPREPLY=($( compgen -W "$(sysctl -N -a 2>/dev/null)" -- $cur ));
return 0
}
_tar ()
{
local cur ext regex tar untar;
COMPREPLY=();
cur=`_get_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
?(-)[cr]*f)
_filedir;
return 0
;;
+([^IZzJjy])f)
ext='t@(ar?(.@(Z|gz|bz?(2)|lz?(ma)))|gz|bz?(2)|lz?(ma))';
regex='t\(ar\(\.\(Z\|gz\|bz2\?\|lzma\)\)\?\|gz\|bz2\?\|lzma\)'
;;
*[Zz]*f)
ext='t?(ar.)@(gz|Z)';
regex='t\(ar\.\)\?\(gz\|Z\)'
;;
*[Ijy]*f)
ext='t?(ar.)bz?(2)';
regex='t\(ar\.\)\?bz2\?'
;;
*[J]*f)
ext='t?(ar.)lz?(ma)';
regex='t\(ar\.\)\?lzma\?'
;;
*)
_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
}
_tcpdump ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
-@(r|w|F))
_filedir;
return 0
;;
-i)
_available_interfaces -a;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-a -d -e -f -l -n -N -O -p \
-q -R -S -t -u -v -x -C -F -i -m -r -s -T -w \
-E' -- $cur ));
fi
}
_tcpkill ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
-i)
_interfaces;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-i -1 -2 -3 -4 -5 -6 -7 -8 -9' -- $cur ));
fi
}
_tcpnice ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
-i)
_interfaces;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-A -I -M -i' -- $cur ));
fi
}
_tightvncviewer ()
{
local cur prev;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case $prev in
-passwd)
_filedir;
return 0
;;
-encodings)
COMPREPLY=($( compgen -W 'copyrect tight hextile zlib \
corre rre raw' -- $cur ));
return 0
;;
-via)
_known_hosts;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-help -listen -via -shared -noshared\
-viewonly -fullscreen -noraiseonbeep -passwd -encodings\
-bgr233 -owncmap -truecolour -truecolor -depth \
-compresslevel -quality -nojpeg -nocursorshape \
-x11cursor' -- $cur ));
else
_known_hosts;
fi
}
_ufw ()
{
cur=${COMP_WORDS[COMP_CWORD]};
prev=${COMP_WORDS[COMP_CWORD-1]};
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=($( compgen -W "$(_ufw_commands)" $cur ));
else
if [ $COMP_CWORD -eq 2 ]; then
case "$prev" in
app)
COMPREPLY=($( compgen -W "$(_ufw_app_commands)" $cur ))
;;
status)
COMPREPLY=($( compgen -W "$(_ufw_status_commands)" $cur ))
;;
delete)
COMPREPLY=($( compgen -W "$(_ufw_rule_commands)" $cur ))
;;
logging)
COMPREPLY=($( compgen -W "$(_ufw_logging_commands)" $cur ))
;;
show)
COMPREPLY=($( compgen -W "$(_ufw_show_commands)" $cur ))
;;
default)
COMPREPLY=($( compgen -W "$(_ufw_default_commands)" $cur ))
;;
esac;
fi;
fi
}
_ufw_app_commands ()
{
ufw --help | sed -e '1,/^Application profile commands:/d' -e '/^ [^ ]/!d' -e 's/[ \t]\+app[ \t]\+\([a-z|]\+\)[ \t]\+.*/\1/g'
}
_ufw_commands ()
{
commands=$(ufw --help | sed -e '1,/^Commands:/d' -e '/^Application profile commands:/Q' -e 's/^[ \t]\+\([a-z|]\+\)[ \t]\+.*/\1/g' -e 's/|/ /g' | uniq);
echo "$commands app"
}
_ufw_default_commands ()
{
echo "allow deny reject"
}
_ufw_logging_commands ()
{
echo "off on low medium high full"
}
_ufw_rule_commands ()
{
echo "`_ufw_default_commands` limit"
}
_ufw_show_commands ()
{
echo "raw"
}
_ufw_status_commands ()
{
echo "numbered verbose"
}
_uids ()
{
if type getent &>/dev/null; then
COMPREPLY=($( getent passwd | awk -F: '{if ($3 ~ /^'$cur'/) print $3}' ));
else
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;
fi
}
_umount ()
{
local cur IFS='
';
COMPREPLY=();
cur=`_get_cword`;
COMPREPLY=($( compgen -W '$( mount | cut -d" " -f 3 )' -- $cur ));
return 0
}
_unace ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
case "$cur" in
-*)
COMPREPLY=($( compgen -W '-c -c- -f -f- -o -o- -p -y -y-' -- $cur ))
;;
*)
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=($( compgen -W 'e l t v x' -- $cur ));
else
_filedir '@(ace|ACE)';
fi
;;
esac;
return 0
}
_unrar ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
case "$cur" in
-*)
COMPREPLY=($( compgen -W '-ad -ap -av- -c- -cfg- -cl -cu \
-dh -ep -f -idp -ierr -inul -kb -o+ -o- -ow -p -p- -r -ta \
-tb -tn -to -u -v -ver -vp -x -x@ -y' -- $cur ))
;;
*)
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=($( compgen -W 'e l lb lt p t v vb vt x' -- $cur ));
else
_filedir '@(rar|RAR)';
fi
;;
esac;
return 0
}
_unshunt ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-h --help' -- $cur ));
else
_filedir -d;
fi
}
_update_alternatives ()
{
local cur prev mode args i;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
--@(altdir|admindir))
_filedir -d;
return 0
;;
--@(help|version))
return 0
;;
esac;
for ((i=1; i < COMP_CWORD; i++ ))
do
if [[ "${COMP_WORDS[i]}" == --@(install|remove|auto|display|config|remove-all) ]]; then
mode=${COMP_WORDS[i]};
args=$(($COMP_CWORD - i));
break;
fi;
done;
case $mode in
--install)
case $args in
1)
_filedir
;;
2)
installed_alternatives
;;
3)
_filedir
;;
esac
;;
--remove)
case $args in
1)
installed_alternatives
;;
2)
_filedir
;;
esac
;;
--auto)
installed_alternatives
;;
--remove-all)
installed_alternatives
;;
--display)
installed_alternatives
;;
--config)
installed_alternatives
;;
*)
COMPREPLY=($( compgen -W '--verbose --quiet --help --version \
--altdir --admindir' -- $cur ) $( compgen -W '--install --remove --auto --display \
--config' -- $cur ))
;;
esac
}
_update_rc_d ()
{
local cur prev sysvdir services options valid_options;
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
[ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d;
services=($(echo $sysvdir/!(README*|*.sh|*.dpkg*|*.rpm@(orig|new|save))));
services=(${services[@]#$sysvdir/});
options=(-f -n);
if [[ $COMP_CWORD -eq 1 || "$prev" == -* ]]; then
valid_options=($( echo "${COMP_WORDS[@]} ${options[@]}" | tr " " "\n" | sed -ne "/$( echo "${options[@]}" | sed "s/ /\\|/g" )/p" | sort | uniq -u ));
COMPREPLY=($( compgen -W '${options[@]} ${services[@]}' -X '$( echo ${COMP_WORDS[@]} | tr " " "|" )' -- $cur ));
else
if [[ "$prev" == ?($( echo ${services[@]} | tr " " "|" )) ]]; then
COMPREPLY=($( compgen -W 'remove defaults start stop' -- $cur ));
else
if [[ "$prev" == defaults && "$cur" == [0-9] ]]; then
COMPREPLY=(0 1 2 3 4 5 6 7 8 9);
else
if [[ "$prev" == defaults && "$cur" == [sk]?([0-9]) ]]; then
COMPREPLY=(0 1 2 3 4 5 6 7 8 9);
else
if [[ "$prev" == defaults && -z "$cur" ]]; then
COMPREPLY=(0 1 2 3 4 5 6 7 8 9 s k);
else
if [[ "$prev" == ?(start|stop) ]]; then
if [[ "$cur" == [0-9] || -z "$cur" ]]; then
COMPREPLY=(0 1 2 3 4 5 6 7 8 9);
else
if [[ "$cur" == [0-9][0-9] ]]; then
COMPREPLY=($cur);
else
COMPREPLY=();
fi;
fi;
else
if [[ "$prev" == ?([0-9][0-9]|[0-6S]) ]]; then
if [[ -z "$cur" ]]; then
if [[ $prev == [0-9][0-9] ]]; then
COMPREPLY=(0 1 2 3 4 5 6 S);
else
COMPREPLY=(0 1 2 3 4 5 6 S .);
fi;
else
if [[ "$cur" == [0-6S.] ]]; then
COMPREPLY=($cur);
else
COMPREPLY=();
fi;
fi;
else
if [[ "$prev" == "." ]]; then
COMPREPLY=($(compgen -W "start stop" -- $cur));
else
COMPREPLY=();
fi;
fi;
fi;
fi;
fi;
fi;
fi;
fi;
return 0
}
_urlsnarf ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
-i)
_interfaces;
return 0
;;
esac;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-n -i -v' -- $cur ));
fi
}
_usb_ids ()
{
COMPREPLY=(${COMPREPLY[@]:-} $( compgen -W "$( lsusb | awk '{print $6}')" -- $cur ))
}
_user_at_host ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
if [[ $cur == *@* ]]; then
_known_hosts;
else
COMPREPLY=($( compgen -u -- "$cur" ));
fi;
return 0
}
_usergroup ()
{
local IFS='
';
cur=${cur//\\\\ / };
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
}
_vncviewer_bootstrap ()
{
local fname;
case "$(_realcommand vncviewer)" in
'')
_filedir `_get_cword`
;;
*xvnc4viewer)
fname=_xvnc4viewer
;;
*tightvncviewer | *)
fname=_tightvncviewer
;;
esac;
if [ $fname ]; then
complete -F $fname vncviewer;
$fname;
unset -f _vncviewer_bootstrap;
fi
}
_webmitm ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-d' -- $cur ));
else
_known_hosts;
fi
}
_withlist ()
{
local cur;
COMPREPLY=();
cur=`_get_cword`;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W '-l --lock -i --interactive \
-r --run -a --all -q --quiet -h --help' -- $cur ));
else
_mailman_lists;
fi
}
_xrandr ()
{
local cur prev output modes;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case "$prev" in
--output)
local outputs=$(xrandr|grep 'connected'|awk '{print $1}');
COMPREPLY=($(compgen -W "$outputs" -- $cur));
return 0
;;
--mode)
for ((i = 1; i < COMP_CWORD; i++ ))
do
if [[ "${COMP_WORDS[i]}" == "--output" ]]; then
output=${COMP_WORDS[i+1]};
break;
fi;
done;
modes=$(xrandr|sed -e "1,/$output/ d" -e "/connected/,$ d"|awk '{print $1}');
COMPREPLY=($( compgen -W "$modes" -- $cur));
return 0
;;
esac;
case "$cur" in
*)
COMPREPLY=($(compgen -W '-d -display -help -o \
--orientation -q --query -s --size\
-r --rate -v --version -x -y --screen \
--verbose --dryrun --prop --fb --fbmm --dpi \
--output --auto --mode --preferred --pos \
--reflect --rotate --left-of --right-of \
--above --below --same-as --set --off --crtc \
--newmode --rmmode --addmode --delmode' -- $cur));
return 0
;;
esac;
return 0
}
_xvnc4viewer ()
{
local cur prev;
COMPREPLY=();
cur=`_get_cword`;
prev=${COMP_WORDS[COMP_CWORD-1]};
case ${prev/#--/-} in
-[pP][aA][sS][sS][wW][dD] | -[pP][aA][sS][sS][wW][oO][rR][dD][fF][iI][lL][eE])
_filedir;
return 0
;;
-[pP][rR][eE][fF][eE][rR][rR][eE][dD][eE][nN][cC][oO][dD][iI][nN][gG])
COMPREPLY=($( compgen -W 'zrle hextile raw' -- $cur ));
return 0
;;
-[vV][iI][aA])
_known_hosts;
return 0
;;
esac;
if [[ "$cur" == -* || "$cur" == --* ]]; then
local dash options=(AcceptClipboard AutoSelect DebugDelay display DotWhenNoCursor FullColor FullColour FullScreen geometry help listen Log LowColourLevel MenuKey name Parent passwd PasswordFile PointerEventInterval PreferredEncoding SendClipboard SendPrimary Shared UseLocalCursor via ViewOnly WMDecorationHeight WMDecorationWidth ZlibLevel);
[[ "$cur" == --* ]] && dash=-- || dash=-;
if shopt nocasematch 2> /dev/null | grep -q ^nocasematch; then
local option oldNoCaseMatch=$(shopt -p nocasematch);
shopt -s nocasematch;
COMPREPLY=($( for option in "${options[@]}"; do
[[ $dash$option == "$cur"* ]] && echo $dash$option
done ));
eval "$oldNoCaseMatch" 2> /dev/null;
else
COMPREPLY=($( compgen -W "$(
echo ${options[@]/#/$dash} | tr [:upper:] [:lower:]
)" -- "$(echo "$cur" | tr [:upper:] [:lower:])" ));
fi;
else
_known_hosts;
fi
}
command_not_found_handle ()
{
if [ -x /usr/lib/command-not-found ]; then
/usr/bin/python /usr/lib/command-not-found -- $1;
return $?;
else
return 127;
fi
}
dequote ()
{
eval echo "$1"
}
get_entries ()
{
local IFS='
';
[ -r ${prefix:-}CVS/Entries ] && entries=$(cut -d/ -f2 -s ${prefix:-}CVS/Entries)
}
get_modules ()
{
if [ -n "$prefix" ]; then
COMPREPLY=($( command ls -d ${cvsroot}/${prefix}/!(CVSROOT) ));
else
COMPREPLY=($( command ls -d ${cvsroot}/!(CVSROOT) ));
fi
}
installed_alternatives ()
{
local admindir;
for i in alternatives dpkg/alternatives rpm/alternatives;
do
[ -d /var/lib/$i ] && admindir=/var/lib/$i && break;
done;
for ((i=1; i < COMP_CWORD; i++ ))
do
if [[ "${COMP_WORDS[i]}" == --admindir ]]; then
admindir=${COMP_WORDS[i+1]};
break;
fi;
done;
COMPREPLY=($( command ls $admindir | grep "^$cur" ))
}
quote ()
{
echo \'${1//\'/\'\\\'\'}\'
}
quote_readline ()
{
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
echo "${1}";
return;
fi;
local t="${1//\\/\\\\}";
echo \'${t//\'/\'\\\'\'}\'
}
ri_get_methods ()
{
local regex;
if [ "$ri_version" = integrated ]; then
if [ -z "$separator" ]; then
regex="(Instance|Class)";
else
if [ "$separator" = "#" ]; then
regex=Instance;
else
regex=Class;
fi;
fi;
COMPREPLY=(${COMPREPLY[@]} "$( ri ${classes[@]} 2>/dev/null | ruby -ane 'if /^'"$regex"' methods:/.../^------------------|^$/ and \
/^ / then print $_.split(/, |,$/).grep(/^[^\[]*$/).join("\n"); \
end' | sort -u )");
else
COMPREPLY=(${COMPREPLY[@]} "$( ruby -W0 $ri_path ${classes[@]} | ruby -ane 'if /^-/.../^-/ and \
! /^-/ and ! /^ +(class|module): / then \
print $_.split(/, |,$| +/).grep(/^[^\[]*$/).join("\n"); \
end' | sort -u )");
fi;
COMPREPLY=($( compgen $prefix -W '${COMPREPLY[@]}' -- $method ))
}
set_prefix ()
{
[ -z ${prefix:-} ] || prefix=${cur%/*}/;
[ -r ${prefix:-}CVS/Entries ] || prefix=""
}