merge with master

This commit is contained in:
Guillaume Rousse 2009-10-05 21:08:50 +02:00
commit ca8598aa51
155 changed files with 10803 additions and 11003 deletions

View File

@ -47,7 +47,6 @@ bashcomp_DATA = contrib/ant \
contrib/gpg \ contrib/gpg \
contrib/gpg2 \ contrib/gpg2 \
contrib/gzip \ contrib/gzip \
contrib/harbour \
contrib/heimdal \ contrib/heimdal \
contrib/iconv \ contrib/iconv \
contrib/imagemagick \ contrib/imagemagick \
@ -62,7 +61,6 @@ bashcomp_DATA = contrib/ant \
contrib/ldapvi \ contrib/ldapvi \
contrib/lftp \ contrib/lftp \
contrib/lilo \ contrib/lilo \
contrib/lilypond \
contrib/links \ contrib/links \
contrib/lisp \ contrib/lisp \
contrib/lvm \ contrib/lvm \

File diff suppressed because it is too large Load Diff

View File

@ -424,8 +424,8 @@ complete -F _svnlook $default svnlook
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -84,16 +84,14 @@ _yum()
cache dbcache all' -- $cur ) ) cache dbcache all' -- $cur ) )
;; ;;
repolist) repolist)
COMPREPLY=( $( compgen -W 'all enabled disabled' \ COMPREPLY=( $( compgen -W 'all enabled disabled' -- $cur ) )
-- $cur ) )
;; ;;
localinstall|localupdate) localinstall|localupdate)
# TODO: should not match *src.rpm # TODO: should not match *src.rpm
_filedir rpm _filedir rpm
;; ;;
-d|-e) -d|-e)
COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9 10' \ COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9 10' -- $cur ) )
-- $cur ) )
;; ;;
-c) -c)
_filedir _filedir
@ -102,12 +100,10 @@ _yum()
_filedir -d _filedir -d
;; ;;
--enablerepo) --enablerepo)
COMPREPLY=( $( compgen -W '$( _yum_repolist \ COMPREPLY=( $( compgen -W '$( _yum_repolist disabled )' -- $cur ) )
disabled )' -- $cur ) )
;; ;;
--disablerepo) --disablerepo)
COMPREPLY=( $( compgen -W '$( _yum_repolist \ COMPREPLY=( $( compgen -W '$( _yum_repolist enabled )' -- $cur ) )
enabled )' -- $cur ) )
;; ;;
--disableexcludes) --disableexcludes)
COMPREPLY=( $( compgen -W '$( _yum_repolist all ) \ COMPREPLY=( $( compgen -W '$( _yum_repolist all ) \
@ -164,8 +160,7 @@ _yum_arch()
case "$cur" in case "$cur" in
-*) -*)
COMPREPLY=( $( compgen -W '-d -v -vv -n -c -z -s -l \ COMPREPLY=( $( compgen -W '-d -v -vv -n -c -z -s -l -q' -- $cur ) )
-q' -- $cur ) )
;; ;;
*) *)
_filedir -d _filedir -d
@ -178,8 +173,8 @@ complete -F _yum_arch $filenames yum-arch
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -67,8 +67,8 @@ have complete-ant-cmd.pl && \
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -2,22 +2,23 @@
have apache2ctl && { have apache2ctl && {
_apache2ctl() { _apache2ctl() {
local APWORDS local APWORDS
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
APWORDS=$(apache2ctl 2>&1 >/dev/null | head -n1 | cut -f3 -d" " | tr "|" " ") APWORDS=$(apache2ctl 2>&1 >/dev/null | head -n1 | cut -f3 -d" " | \
tr "|" " ")
COMPREPLY=( $( compgen -W "$APWORDS" -- "$cur" ) ) COMPREPLY=( $( compgen -W "$APWORDS" -- "$cur" ) )
} }
complete -F _apache2ctl apache2ctl complete -F _apache2ctl apache2ctl
} }
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,79 +3,68 @@
have apt-get && have apt-get &&
_apt_get() _apt_get()
{ {
local cur prev special i local cur prev special i
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
if [[ ${COMP_WORDS[i]} == @(install|remove|autoremove|purge|source|build-dep) ]]; then if [[ ${COMP_WORDS[i]} == @(install|remove|autoremove|purge|source|build-dep) ]]; then
special=${COMP_WORDS[i]} special=${COMP_WORDS[i]}
fi fi
done done
if [ -n "$special" ]; then if [ -n "$special" ]; then
case $special in case $special in
remove|autoremove|purge) remove|autoremove|purge)
if [ -f /etc/debian_version ]; then if [ -f /etc/debian_version ]; then
# Debian system # Debian system
COMPREPLY=( $( _comp_dpkg_installed_packages \ COMPREPLY=( $( _comp_dpkg_installed_packages $cur ) )
$cur ) ) else
else # assume RPM based
# assume RPM based _rpm_installed_packages
_rpm_installed_packages fi
fi return 0
return 0 ;;
;; *)
*) COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" \
COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" 2> /dev/null ) ) 2> /dev/null ) )
return 0 return 0
;; ;;
esac
fi
esac case "$prev" in
fi -@(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
case "$prev" in if [[ "$cur" == -* ]]; then
-@(c|-config-file)) COMPREPLY=( $( compgen -W '-d -f -h -v -m -q -s -y -u -t -b -c -o \
_filedir --download-only --fix-broken --help --version --ignore-missing \
return 0 --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
-@(t|-target-release|-default-release)) return 0
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
} && } &&
complete -F _apt_get $filenames apt-get complete -F _apt_get $filenames apt-get
@ -84,83 +73,83 @@ complete -F _apt_get $filenames apt-get
have apt-cache && have apt-cache &&
_apt_cache() _apt_cache()
{ {
local cur prev special i local cur prev special i
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
if [ "$cur" != show ]; then if [ "$cur" != show ]; then
for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
if [[ ${COMP_WORDS[i]} == @(add|depends|dotty|madison|policy|rdepends|show?(pkg|src|)) ]]; then if [[ ${COMP_WORDS[i]} == @(add|depends|dotty|madison|policy|rdepends|show?(pkg|src|)) ]]; then
special=${COMP_WORDS[i]} special=${COMP_WORDS[i]}
fi fi
done done
fi fi
if [ -n "$special" ]; then if [ -n "$special" ]; then
case $special in case $special in
add) add)
_filedir _filedir
return 0 return 0
;; ;;
showsrc) showsrc)
COMPREPLY=( $( apt-cache dumpavail | \ COMPREPLY=( $( apt-cache dumpavail | \
grep "^Source: $cur" | sort | \ grep "^Source: $cur" | sort | \
uniq | cut -f2 -d" " ) ) uniq | cut -f2 -d" " ) )
return 0 return 0
;; ;;
*) *)
COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" 2> /dev/null ) ) COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" 2> /dev/null ) )
return 0 return 0
;; ;;
esac esac
fi fi
case "$prev" in case "$prev" in
-@(c|p|s|-config-file|-@(pkg|src)-cache)) -@(c|p|s|-config-file|-@(pkg|src)-cache))
_filedir _filedir
return 0 return 0
;; ;;
search) search)
if [[ "$cur" != -* ]]; then if [[ "$cur" != -* ]]; then
return 0 return 0
fi fi
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-h -v -p -s -q -i -f -a -g -c \ COMPREPLY=( $( compgen -W '-h -v -p -s -q -i -f -a -g -c \
-o --help --version --pkg-cache --src-cache \ -o --help --version --pkg-cache --src-cache \
--quiet --important --full --all-versions \ --quiet --important --full --all-versions \
--no-all-versions --generate --no-generate \ --no-all-versions --generate --no-generate \
--names-only --all-names --recurse \ --names-only --all-names --recurse \
--config-file --option --installed' -- "$cur" ) ) --config-file --option --installed' -- "$cur" ) )
else else
COMPREPLY=( $( compgen -W 'add gencaches show showpkg showsrc \ COMPREPLY=( $( compgen -W 'add gencaches show showpkg showsrc \
stats dump dumpavail unmet search search \ stats dump dumpavail unmet search search \
depends rdepends pkgnames dotty xvcg \ depends rdepends pkgnames dotty xvcg \
policy madison' -- "$cur" ) ) policy madison' -- "$cur" ) )
fi fi
return 0 return 0
} && } &&
complete -F _apt_cache $filenames apt-cache complete -F _apt_cache $filenames apt-cache
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,71 +3,65 @@
have apt-build && have apt-build &&
_apt_build() _apt_build()
{ {
local cur prev special i local cur prev special i
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
if [[ ${COMP_WORDS[i]} == @(install|remove|source|info|clean) ]]; then if [[ ${COMP_WORDS[i]} == @(install|remove|source|info|clean) ]]; then
special=${COMP_WORDS[i]} special=${COMP_WORDS[i]}
fi fi
done done
if [ -n "$special" ]; then if [ -n "$special" ]; then
case $special in case $special in
@(install|source|info)) @(install|source|info))
COMPREPLY=( $( apt-cache pkgnames "$cur" 2> /dev/null ) ) COMPREPLY=( $( apt-cache pkgnames "$cur" 2> /dev/null ) )
return 0 return 0
;; ;;
remove) remove)
COMPREPLY=( $( _comp_dpkg_installed_packages \ COMPREPLY=( $( _comp_dpkg_installed_packages "$cur" ) )
"$cur" ) ) return 0
return 0 ;;
;; *)
*) return 0
return 0 ;;
;; esac
esac fi
fi
case "$prev" in case "$prev" in
--@(patch|build-dir|repository-dir))
_filedir
return 0
;;
-@(h|-help))
return 0
;;
esac
--@(patch|build-dir|repository-dir)) if [[ "$cur" == -* ]]; then
_filedir COMPREPLY=( $( compgen -W '--help --show-upgraded -u --build-dir \
return 0 --repository-dir --build-only --build-command --reinstall \
;; --rebuild --remove-builddep --no-wrapper --purge --patch \
--patch-strip -p --yes -y --version -v --no-source' -- "$cur" ) )
-@(h|-help)) else
return 0 COMPREPLY=( $( compgen -W 'update upgrade install remove source \
;; dist-upgrade world clean info clean-build update-repository' \
-- "$cur" ) )
esac fi
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--help --show-upgraded -u --build-dir \
--repository-dir --build-only \
--build-command --reinstall --rebuild \
--remove-builddep --no-wrapper --purge \
--patch --patch-strip -p --yes -y \
--version -v --no-source' -- "$cur" ) )
else
COMPREPLY=( $( compgen -W 'update upgrade install remove \
source dist-upgrade world clean info \
clean-build update-repository ' -- "$cur" ) )
fi
return 0 return 0
} && } &&
complete -F _apt_build $filenames apt-build complete -F _apt_build $filenames apt-build
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -4,99 +4,93 @@ have aptitude && {
have grep-status && { have grep-status && {
_comp_dpkg_hold_packages() _comp_dpkg_hold_packages()
{ {
grep-status -P -e "^$1" -a -FStatus 'hold' -n -s Package grep-status -P -e "^$1" -a -FStatus 'hold' -n -s Package
} }
} || { } || {
_comp_dpkg_hold_packages() _comp_dpkg_hold_packages()
{ {
grep -B 2 'hold' /var/lib/dpkg/status | grep "Package: $1" \ grep -B 2 'hold' /var/lib/dpkg/status | grep "Package: $1" | cut -d\ -f2
| cut -d\ -f2
} }
} }
_aptitude() _aptitude()
{ {
local cur dashoptions prev special i local cur dashoptions prev special i
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
dashoptions='-S -u -i -h --help --version -s --simulate -d \ dashoptions='-S -u -i -h --help --version -s --simulate -d \
--download-only -P --prompt -y --assume-yes -F \ --download-only -P --prompt -y --assume-yes -F \
--display-format -O --sort -w --width -f -r -g \ --display-format -O --sort -w --width -f -r -g \
--with-recommends -R -G --without-recommends -t \ --with-recommends -R -G --without-recommends -t \
--target-release -V --show-versions -D --show-deps\ --target-release -V --show-versions -D --show-deps\
-Z -v --verbose --purge-unused --schedule-only' -Z -v --verbose --purge-unused --schedule-only'
for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do 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 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]} special=${COMP_WORDS[i]}
fi fi
#exclude some mutually exclusive options #exclude some mutually exclusive options
[[ ${COMP_WORDS[i]} == '-u' ]] && dashoptions=${dashoptions/-i} [[ ${COMP_WORDS[i]} == '-u' ]] && dashoptions=${dashoptions/-i}
[[ ${COMP_WORDS[i]} == '-i' ]] && dashoptions=${dashoptions/-u} [[ ${COMP_WORDS[i]} == '-i' ]] && dashoptions=${dashoptions/-u}
done done
if [[ -n "$special" ]]; then if [[ -n "$special" ]]; then
case $special in case $special in
@(install|hold|markauto|unmarkauto|dist-upgrade|full-upgrade|download|show|changelog|why|why-not|build-dep)) @(install|hold|markauto|unmarkauto|dist-upgrade|full-upgrade|download|show|changelog|why|why-not|build-dep))
COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) ) COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) )
return 0 return 0
;; ;;
@(purge|remove|reinstall|forbid-version)) @(purge|remove|reinstall|forbid-version))
COMPREPLY=( $( _comp_dpkg_installed_packages "$cur" ) ) COMPREPLY=( $( _comp_dpkg_installed_packages "$cur" ) )
return 0 return 0
;; ;;
unhold) unhold)
COMPREPLY=( $( _comp_dpkg_hold_packages "$cur" ) ) COMPREPLY=( $( _comp_dpkg_hold_packages "$cur" ) )
return 0 return 0
;; ;;
esac
fi
esac case $prev in
fi # don't complete anything if these options are found
@(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
case $prev in if [[ "$cur" == -* ]]; then
# don't complete anything if these options are found COMPREPLY=( $( compgen -W "$dashoptions" -- "$cur" ) )
@(autoclean|clean|forget-new|search|upgrade|safe-upgrade|update|keep-all)) else
return 0 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
-S) return 0
_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
} }
complete -F _aptitude $default aptitude complete -F _aptitude $default aptitude
} }
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,87 +3,87 @@
have aspell && { have aspell && {
_aspell_dictionary() _aspell_dictionary()
{ {
local datadir local datadir
datadir=$( aspell config data-dir 2>/dev/null || echo /usr/lib/aspell ) datadir=$( aspell config data-dir 2>/dev/null || echo /usr/lib/aspell )
# First, get aliases (dicts dump does not list them) # First, get aliases (dicts dump does not list them)
COMPREPLY=( $( command ls $datadir/*.alias 2>/dev/null ) ) COMPREPLY=( $( command ls $datadir/*.alias 2>/dev/null ) )
COMPREPLY=( ${COMPREPLY[@]%.alias} ) COMPREPLY=( ${COMPREPLY[@]%.alias} )
COMPREPLY=( ${COMPREPLY[@]#$datadir/} ) COMPREPLY=( ${COMPREPLY[@]#$datadir/} )
# Then, add the canonical dicts # Then, add the canonical dicts
COMPREPLY=( "${COMPREPLY[@]}" $( aspell dicts 2>/dev/null ) ) COMPREPLY=( "${COMPREPLY[@]}" $( aspell dicts 2>/dev/null ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) ) COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
} }
_aspell() _aspell()
{ {
local cur prev split=false local cur prev split=false
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
_split_longopt && split=true _split_longopt && split=true
case "$prev" in case "$prev" in
-c|-p|check|--@(conf|personal|repl|per-conf)) -c|-p|check|--@(conf|personal|repl|per-conf))
_filedir _filedir
return 0 return 0
;; ;;
--@(conf-dir|data-dir|dict-dir|home-dir|local-data-dir|prefix)) --@(conf-dir|data-dir|dict-dir|home-dir|local-data-dir|prefix))
_filedir -d _filedir -d
return 0 return 0
;; ;;
dump|create|merge) dump|create|merge)
COMPREPLY=( $( compgen -W 'master personal repl' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'master personal repl' -- "$cur" ) )
return 0 return 0
;; ;;
--mode) --mode)
COMPREPLY=( $( compgen -W 'none url email sgml tex' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'none url email sgml tex' -- "$cur" ) )
return 0 return 0
;; ;;
--sug-mode) --sug-mode)
COMPREPLY=( $( compgen -W 'ultra fast normal bad-speller' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'ultra fast normal bad-speller' -- "$cur" ) )
return 0 return 0
;; ;;
--keymapping) --keymapping)
COMPREPLY=( $( compgen -W 'aspell ispell' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'aspell ispell' -- "$cur" ) )
return 0 return 0
;; ;;
-d|--master) -d|--master)
_aspell_dictionary _aspell_dictionary
return 0 return 0
;; ;;
esac esac
$split && return 0 $split && return 0
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--conf --conf-dir --data-dir --dict-dir \ COMPREPLY=( $( compgen -W '--conf --conf-dir --data-dir --dict-dir \
--encoding --add-filter --rem-filter --mode -e \ --encoding --add-filter --rem-filter --mode -e \
-H -t --add-extra-dicts --rem-extra-dicts \ -H -t --add-extra-dicts --rem-extra-dicts \
--home-dir -W --ignore --ignore-accents \ --home-dir -W --ignore --ignore-accents \
--dont-ignore-accents --ignore-case --dont-ignore-case \ --dont-ignore-accents --ignore-case --dont-ignore-case \
--ignore-repl --dont-ignore-repl --jargon --keyboard \ --ignore-repl --dont-ignore-repl --jargon --keyboard \
--lang --language-tag --local-data-dir -d --master \ --lang --language-tag --local-data-dir -d --master \
--module --add-module-search-order \ --module --add-module-search-order \
--rem-module-search-order --per-conf -p --personal \ --rem-module-search-order --per-conf -p --personal \
--prefix --repl -C -B --run-together --dont-run-together \ --prefix --repl -C -B --run-together --dont-run-together \
--run-together-limit --run-together-min --save-repl \ --run-together-limit --run-together-min --save-repl \
--dont-save-repl --set-prefix --dont-set-prefix --size \ --dont-save-repl --set-prefix --dont-set-prefix --size \
--spelling --strip-accents --dont-strip-accents \ --spelling --strip-accents --dont-strip-accents \
--sug-mode --add-word-list-path --rem-word-list-path \ --sug-mode --add-word-list-path --rem-word-list-path \
-b -x --backup -b|-x --dont-backup --reverse --dont-reverse \ -b -x --backup -b|-x --dont-backup --reverse --dont-reverse \
--time --dont-time --keymapping --add-email-quote \ --time --dont-time --keymapping --add-email-quote \
--rem-email-quote --email-margin --add-tex-command \ --rem-email-quote --email-margin --add-tex-command \
--rem-tex-command --tex-check-comments \ --rem-tex-command --tex-check-comments \
--dont-tex-check-comments --add-tex-extension \ --dont-tex-check-comments --add-tex-extension \
--rem-tex-extension --add-sgml-check --rem-sgml-check \ --rem-tex-extension --add-sgml-check --rem-sgml-check \
--add-sgml-extension --rem-sgml-extension' -- "$cur" ) ) --add-sgml-extension --rem-sgml-extension' -- "$cur" ) )
else else
COMPREPLY=( $( compgen -W '-? help -c check -a pipe -l list \ COMPREPLY=( $( compgen -W '-? help -c check -a pipe -l list \
config config soundslike filter -v version dump \ config config soundslike filter -v version dump \
create merge' -- "$cur" ) ) create merge' -- "$cur" ) )
fi fi
} }
complete -F _aspell $filenames aspell complete -F _aspell $filenames aspell
@ -91,8 +91,8 @@ complete -F _aspell $filenames aspell
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,22 +3,21 @@
have autorpm && have autorpm &&
_autorpm() _autorpm()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
COMPREPLY=( $( compgen -W '--notty --debug --help --version \ COMPREPLY=( $( compgen -W '--notty --debug --help --version auto add \
auto add fullinfo info help install list \ fullinfo info help install list remove set' -- "$cur" ) )
remove set' -- "$cur" ) )
} && } &&
complete -F _autorpm autorpm complete -F _autorpm autorpm
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -2,20 +2,20 @@
# #
_alias() _alias()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
case "$COMP_LINE" in case "$COMP_LINE" in
*[^=]) *[^=])
COMPREPLY=( $( compgen -A alias -- "$cur" ) ) COMPREPLY=( $( compgen -A alias -- "$cur" ) )
;; ;;
*=) *=)
COMPREPLY=( "$( alias ${cur%=} 2>/dev/null | \ COMPREPLY=( "$( alias ${cur%=} 2>/dev/null | sed \
sed -e 's|^alias '"$cur"'\(.*\)$|\1|' )" ) -e 's|^alias '"$cur"'\(.*\)$|\1|' )" )
;; ;;
esac esac
} }
complete -F _alias $nospace alias complete -F _alias $nospace alias
@ -23,25 +23,25 @@ complete -F _alias $nospace alias
# #
_export() _export()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
case "$COMP_LINE" in case "$COMP_LINE" in
*=\$*) *=\$*)
COMPREPLY=( $( compgen -v -P '$' -- "${cur#*=\$}" ) ) COMPREPLY=( $( compgen -v -P '$' -- "${cur#*=\$}" ) )
;; ;;
*[^=]) *[^=])
COMPREPLY=( $( compgen -v -S '=' -- "$cur" ) ) COMPREPLY=( $( compgen -v -S '=' -- "$cur" ) )
;; ;;
*=) *=)
COMPREPLY=( "$( eval echo -n \"$`echo ${cur%=}`\" | COMPREPLY=( "$( eval echo -n \"$`echo ${cur%=}`\" |
( echo -n \' ( echo -n \'
sed -e 's/'\''/'\''\\\'\'''\''/g' sed -e 's/'\''/'\''\\\'\'''\''/g'
echo -n \' ) )" ) echo -n \' ) )" )
;; ;;
esac esac
} }
complete -F _export $default $nospace export complete -F _export $default $nospace export
@ -49,24 +49,23 @@ complete -F _export $default $nospace export
# #
_function() _function()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
if [[ $1 == @(declare|typeset) ]]; then if [[ $1 == @(declare|typeset) ]]; then
if [ "$prev" = -f ]; then if [ "$prev" = -f ]; then
COMPREPLY=( $( compgen -A function -- "$cur" ) ) COMPREPLY=( $( compgen -A function -- "$cur" ) )
elif [[ "$cur" == -* ]]; then elif [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-a -f -F -i -r -x -p' -- \ COMPREPLY=( $( compgen -W '-a -f -F -i -r -x -p' -- "$cur" ) )
"$cur" ) ) fi
fi elif [ $COMP_CWORD -eq 1 ]; then
elif [ $COMP_CWORD -eq 1 ]; then COMPREPLY=( $( compgen -A function -- "$cur" ) )
COMPREPLY=( $( compgen -A function -- "$cur" ) ) else
else COMPREPLY=( "() $( type -- ${COMP_WORDS[1]} | sed -e 1,2d )" )
COMPREPLY=( "() $( type -- ${COMP_WORDS[1]} | sed -e 1,2d )" ) fi
fi
} }
complete -F _function function declare typeset complete -F _function function declare typeset
@ -74,61 +73,61 @@ complete -F _function function declare typeset
# #
_complete() _complete()
{ {
local cur prev options local cur prev options
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in case $prev in
-o) -o)
options="default dirnames filenames" options="default dirnames filenames"
[ -n "$bash205b" ] && options="$options nospace" [ -n "$bash205b" ] && options="$options nospace"
[ -n "$bash3" ] && options="$options bashdefault plusdirs" [ -n "$bash3" ] && options="$options bashdefault plusdirs"
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
return 0 return 0
;; ;;
-A) -A)
COMPREPLY=( $( compgen -W 'alias arrayvar binding \ COMPREPLY=( $( compgen -W 'alias arrayvar binding \
builtin command directory disabled enabled \ builtin command directory disabled enabled \
export file function group helptopic hostname \ export file function group helptopic hostname \
job keyword running service setopt shopt \ job keyword running service setopt shopt \
signal stopped user variable' -- "$cur" ) ) signal stopped user variable' -- "$cur" ) )
return 0 return 0
;; ;;
-C) -C)
COMPREPLY=( $( compgen -A command -- "$cur" ) ) COMPREPLY=( $( compgen -A command -- "$cur" ) )
return 0 return 0
;; ;;
-F) -F)
COMPREPLY=( $( compgen -A function -- "$cur" ) ) COMPREPLY=( $( compgen -A function -- "$cur" ) )
return 0 return 0
;; ;;
-@(p|r)) -@(p|r))
COMPREPLY=( $( complete -p | sed -e 's|.* ||' ) ) COMPREPLY=( $( complete -p | sed -e 's|.* ||' ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) ) COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
# relevant options completion # relevant options completion
options="-a -b -c -d -e -f -g -j -k -s -v -u -A -G -W -P -S -X -F -C" 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" [ -n "$bash205" ] && options="$options -o"
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
else else
COMPREPLY=( $( compgen -A command -- "$cur" ) ) COMPREPLY=( $( compgen -A command -- "$cur" ) )
fi fi
} }
complete -F _complete complete complete -F _complete complete
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,22 +3,21 @@
have nslookup && have nslookup &&
_nslookup() _nslookup()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]#-} cur=${COMP_WORDS[COMP_CWORD]#-}
COMPREPLY=( $( compgen -P '-' -W 'all class= debug d2 domain= \ COMPREPLY=( $( compgen -P '-' -W 'all class= debug d2 domain= srchlist= \
srchlist= defname search port= querytype= \ defname search port= querytype= type= recurse retry root timeout vc \
type= recurse retry root timeout vc \ ignoretc' -- "$cur" ) )
ignoretc' -- "$cur" ) )
} && } &&
complete -F _nslookup nslookup complete -F _nslookup nslookup
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -7,8 +7,7 @@ _bk() {
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
BKCMDS="$( bk help topics | grep '^ bk' | cut -d ' ' -f 4 | \ BKCMDS="$( bk help topics | grep '^ bk' | cut -d ' ' -f 4 | xargs echo )"
xargs echo )"
COMPREPLY=( $( compgen -W "$BKCMDS" -- "$cur" ) ) COMPREPLY=( $( compgen -W "$BKCMDS" -- "$cur" ) )
_filedir _filedir
@ -19,8 +18,8 @@ complete -F _bk bk
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -4,42 +4,39 @@ have btdownloadheadless.py || have btdownloadcurses.py || \
have btdownloadgui.py && have btdownloadgui.py &&
_btdownload() _btdownload()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
--@(responsefile|saveas)) --@(responsefile|saveas))
_filedir _filedir
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--max_uploads --keepalive_interval \ COMPREPLY=( $( compgen -W '--max_uploads --keepalive_interval \
--download_slice_size --request_backlog \ --download_slice_size --request_backlog --max_message_length \
--max_message_length --ip --minport --maxport \ --ip --minport --maxport --responsefile --url --saveas --timeout \
--responsefile --url --saveas --timeout \ --timeout_check_interval --max_slice_length --max_rate_period \
--timeout_check_interval --max_slice_length \ --bind --upload_rate_fudge --display_interval --rerequest_interval \
--max_rate_period --bind --upload_rate_fudge \ --min_peers --http_timeout --max_initiate --max_allow_in \
--display_interval --rerequest_interval \ --check_hashes --max_upload_rate --snub_time --spew \
--min_peers --http_timeout --max_initiate \ --rarest_first_cutoff --min_uploads --report_hash_failures' \
--max_allow_in --check_hashes \ -- "$cur" ) )
--max_upload_rate --snub_time --spew \ else
--rarest_first_cutoff --min_uploads \ _filedir
--report_hash_failures' -- "$cur" ) ) fi
else
_filedir
fi
} && } &&
complete -F _btdownload btdownloadheadless.py btdownloadcurses.py btdownloadgui.py complete -F _btdownload btdownloadheadless.py btdownloadcurses.py btdownloadgui.py
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,457 +3,450 @@
have hcitool && { have hcitool && {
_bluetooth_adresses() _bluetooth_adresses()
{ {
if [ -n "${COMP_BLUETOOTH_SCAN:-}" ]; then if [ -n "${COMP_BLUETOOTH_SCAN:-}" ]; then
COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "$( hcitool scan | \ COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "$( hcitool scan | \
awk '/^\t/{print $1}' )" -- "$cur" ) ) awk '/^\t/{print $1}' )" -- "$cur" ) )
fi fi
} }
_bluetooth_devices() _bluetooth_devices()
{ {
COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "$( hcitool dev | \ COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "$( hcitool dev | \
awk '/^\t/{print $1}' )" -- "$cur" ) ) awk '/^\t/{print $1}' )" -- "$cur" ) )
} }
_bluetooth_services() _bluetooth_services()
{ {
COMPREPLY=( $( compgen -W 'DID SP DUN LAN FAX OPUSH FTP HS HF HFAG \ COMPREPLY=( $( compgen -W 'DID SP DUN LAN FAX OPUSH FTP HS HF HFAG \
SAP NAP GN PANU HCRP HID CIP A2SRC A2SNK AVRCT AVRTG UDIUE \ SAP NAP GN PANU HCRP HID CIP A2SRC A2SNK AVRCT AVRTG UDIUE \
UDITE SYNCML' -- "$cur" ) ) UDITE SYNCML' -- "$cur" ) )
} }
_bluetooth_packet_types() _bluetooth_packet_types()
{ {
COMPREPLY=( $( compgen -W 'DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3' -- \ COMPREPLY=( $( compgen -W 'DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3' \
"$cur" ) ) -- "$cur" ) )
} }
_get_command() _get_command()
{ {
local i local i
command= command=
for (( i=1; i < COMP_CWORD; i++ )); do for (( i=1; i < COMP_CWORD; i++ )); do
if [[ "${COMP_WORDS[i]}" != -* ]]; then if [[ "${COMP_WORDS[i]}" != -* ]]; then
command=${COMP_WORDS[i]} command=${COMP_WORDS[i]}
break break
fi fi
done done
} }
_hcitool() _hcitool()
{ {
local cur prev split=false local cur prev split=false
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
_split_longopt && split=true _split_longopt && split=true
case $prev in case $prev in
-i) -i)
_bluetooth_devices _bluetooth_devices
return 0; return 0;
;; ;;
--role) --role)
COMPREPLY=( $( compgen -W 'm s' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'm s' -- "$cur" ) )
return 0; return 0;
;; ;;
--pkt-type) --pkt-type)
_bluetooth_packet_types _bluetooth_packet_types
return 0; return 0;
;; ;;
esac esac
$split && return 0 $split && return 0
_get_command _get_command
if [ -z $command ]; then if [ -z $command ]; then
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-h -i' -- "$cur" ) ) COMPREPLY=( $( compgen -W '-h -i' -- "$cur" ) )
else else
COMPREPLY=( $( compgen -W 'dev inq scan name info \ COMPREPLY=( $( compgen -W 'dev inq scan name info \
spinq epinq cmd con cc dc sr cpt rssi lq tpl \ spinq epinq cmd con cc dc sr cpt rssi lq tpl \
afh lst auth enc key clkoff clock' -- "$cur" ) ) afh lst auth enc key clkoff clock' -- "$cur" ) )
fi fi
else else
case $command in case $command in
@(name|info|dc|rssi|lq|afh|auth|key|clkoff|lst)) @(name|info|dc|rssi|lq|afh|auth|key|clkoff|lst))
_count_args _count_args
if [ $args -eq 2 ]; then if [ $args -eq 2 ]; then
_bluetooth_adresses _bluetooth_adresses
fi fi
;; ;;
cc) cc)
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--role \ COMPREPLY=( $( compgen -W '--role --pkt-type' -- "$cur" ) )
--pkt-type' -- "$cur" ) ) else
else _count_args
_count_args if [ $args -eq 2 ]; then
if [ $args -eq 2 ]; then _bluetooth_adresses
_bluetooth_adresses fi
fi fi
fi ;;
;; sr)
sr) _count_args
_count_args if [ $args -eq 2 ]; then
if [ $args -eq 2 ]; then _bluetooth_adresses
_bluetooth_adresses else
else COMPREPLY=( $( compgen -W 'master slave' -- "$cur" ) )
COMPREPLY=( $( compgen -W \ fi
'master slave' -- "$cur" ) ) ;;
fi cpt)
;; _count_args
cpt) if [ $args -eq 2 ]; then
_count_args _bluetooth_adresses
if [ $args -eq 2 ]; then else
_bluetooth_adresses _bluetooth_packet_types
else fi
_bluetooth_packet_types ;;
fi @(tpl|enc|clock))
;; _count_args
@(tpl|enc|clock)) if [ $args -eq 2 ]; then
_count_args _bluetooth_adresses
if [ $args -eq 2 ]; then else
_bluetooth_adresses COMPREPLY=( $( compgen -W '0 1' -- "$cur" ) )
else fi
COMPREPLY=( $( compgen -W \ ;;
'0 1' -- "$cur" ) ) esac
fi fi
;;
esac
fi
} }
complete -F _hcitool hcitool complete -F _hcitool hcitool
_sdptool() _sdptool()
{ {
local cur prev split=false local cur prev split=false
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
_split_longopt && split=true _split_longopt && split=true
case $prev in case $prev in
--bdaddr) --bdaddr)
_bluetooth_adresses _bluetooth_adresses
return 0; return 0;
;; ;;
esac esac
$split && return 0 $split && return 0
_get_command _get_command
if [ -z $command ]; then if [ -z $command ]; then
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--help' -- "$cur" ) ) COMPREPLY=( $( compgen -W '--help' -- "$cur" ) )
else else
COMPREPLY=( $( compgen -W 'search browse records add \ COMPREPLY=( $( compgen -W 'search browse records add \
del get setattr setseq' -- "$cur" ) ) del get setattr setseq' -- "$cur" ) )
fi fi
else else
case $command in case $command in
search) search)
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--bdaddr \ COMPREPLY=( $( compgen -W '--bdaddr \
--tree --raw --xml' -- "$cur" ) ) --tree --raw --xml' -- "$cur" ) )
else else
_bluetooth_services _bluetooth_services
fi fi
;; ;;
@(browse|records)) @(browse|records))
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--tree \ COMPREPLY=( $( compgen -W '--tree --raw --xml' -- "$cur" ) )
--raw --xml' -- "$cur" ) ) else
else _bluetooth_adresses
_bluetooth_adresses fi
fi ;;
;; add)
add) if [[ "$cur" == -* ]]; then
if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--handle --channel' -- "$cur" ) )
COMPREPLY=( $( compgen -W '--handle \ else
--channel' -- "$cur" ) ) _bluetooth_services
else fi
_bluetooth_services ;;
fi get)
;; if [[ "$cur" == -* ]]; then
get) COMPREPLY=( $( compgen -W '--bdaddr \
if [[ "$cur" == -* ]]; then --tree --raw --xml' -- "$cur" ) )
COMPREPLY=( $( compgen -W '--bdaddr \ fi
--tree --raw --xml' -- "$cur" ) ) ;;
fi esac
;; fi
esac
fi
} }
complete -F _sdptool sdptool complete -F _sdptool sdptool
_l2ping() _l2ping()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in case $prev in
-i) -i)
_bluetooth_devices _bluetooth_devices
return 0; return 0;
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-i -s -c -t -f -r' -- "$cur" ) ) COMPREPLY=( $( compgen -W '-i -s -c -t -f -r' -- "$cur" ) )
else else
_bluetooth_adresses _bluetooth_adresses
fi fi
} }
complete -F _l2ping l2ping complete -F _l2ping l2ping
_rfcomm() _rfcomm()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in case $prev in
-@(f|-config)) -@(f|-config))
_filedir _filedir
return 0; return 0;
;; ;;
-i) -i)
_bluetooth_devices _bluetooth_devices
_bluetooth_adresses _bluetooth_adresses
return 0; return 0;
;; ;;
esac esac
_get_command _get_command
if [ -z $command ]; then if [ -z $command ]; then
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-h --help -a -r --raw -f \ COMPREPLY=( $( compgen -W '-h --help -a -r --raw -f \
--config -i -A --auth -E --encrypt -S --secure \ --config -i -A --auth -E --encrypt -S --secure \
-M --master' -- "$cur" ) ) -M --master' -- "$cur" ) )
else else
COMPREPLY=( $( compgen -W 'show connect listen watch \ COMPREPLY=( $( compgen -W 'show connect listen watch \
bind release' -- "$cur" ) ) bind release' -- "$cur" ) )
fi fi
else else
_count_args _count_args
if [ $args -eq 2 ]; then if [ $args -eq 2 ]; then
_bluetooth_devices _bluetooth_devices
else else
case $command in case $command in
@(connect|bind)) @(connect|bind))
if [ $args -eq 3 ]; then if [ $args -eq 3 ]; then
_bluetooth_adresses _bluetooth_adresses
fi fi
;; ;;
esac esac
fi fi
fi fi
} }
complete -F _rfcomm rfcomm complete -F _rfcomm rfcomm
_ciptool() _ciptool()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in case $prev in
-i) -i)
_bluetooth_devices _bluetooth_devices
_bluetooth_adresses _bluetooth_adresses
return 0; return 0;
;; ;;
esac esac
_get_command _get_command
if [ -z $command ]; then if [ -z $command ]; then
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-h --help -i' -- "$cur" ) ) COMPREPLY=( $( compgen -W '-h --help -i' -- "$cur" ) )
else else
COMPREPLY=( $( compgen -W 'show search connect release \ COMPREPLY=( $( compgen -W 'show search connect release \
loopback' -- "$cur" ) ) loopback' -- "$cur" ) )
fi fi
else else
case $command in case $command in
@(connect|release|loopback)) @(connect|release|loopback))
_count_args _count_args
if [ $args -eq 2 ]; then if [ $args -eq 2 ]; then
_bluetooth_adresses _bluetooth_adresses
fi fi
;; ;;
esac esac
fi fi
} }
complete -F _ciptool ciptool complete -F _ciptool ciptool
_dfutool() _dfutool()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in case $prev in
-@(d|-device)) -@(d|-device))
_bluetooth_devices _bluetooth_devices
return 0; return 0;
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-h --help -d --device' -- "$cur" ) ) COMPREPLY=( $( compgen -W '-h --help -d --device' -- "$cur" ) )
else else
_count_args _count_args
case $args in case $args in
1) 1)
COMPREPLY=( $( compgen -W 'verify modify \ COMPREPLY=( $( compgen -W 'verify modify \
upgrade archive' -- "$cur" ) ) upgrade archive' -- "$cur" ) )
;; ;;
2) 2)
_filedir _filedir
;; ;;
esac esac
fi fi
} }
complete -F _dfutool dfutool complete -F _dfutool dfutool
_hciconfig() _hciconfig()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
_get_command _get_command
if [ -z $command ]; then if [ -z $command ]; then
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-h --help -a --all' -- "$cur" ) ) COMPREPLY=( $( compgen -W '-h --help -a --all' -- "$cur" ) )
else else
COMPREPLY=( $( compgen -W 'up down reset rstat auth \ COMPREPLY=( $( compgen -W 'up down reset rstat auth \
noauth encrypt noencrypt secmgr nosecmgr \ noauth encrypt noencrypt secmgr nosecmgr \
piscan noscan iscan pscan ptype name class \ piscan noscan iscan pscan ptype name class \
voice iac inqmode inqdata inqtype inqparams \ voice iac inqmode inqdata inqtype inqparams \
pageparms pageto afhmode aclmtu scomtu putkey \ pageparms pageto afhmode aclmtu scomtu putkey \
delkey commands features version revision lm' \ delkey commands features version revision lm' \
-- "$cur" ) ) -- "$cur" ) )
fi fi
else else
case $command in case $command in
@(putkey|delkey)) @(putkey|delkey))
_count_args _count_args
if [ $args -eq 2 ]; then if [ $args -eq 2 ]; then
_bluetooth_adresses _bluetooth_adresses
fi fi
;; ;;
lm) lm)
_count_args _count_args
if [ $args -eq 2 ]; then if [ $args -eq 2 ]; then
COMPREPLY=( $( compgen -W 'MASTER \ COMPREPLY=( $( compgen -W 'MASTER \
SLAVE NONE ACCEPT' -- "$cur" ) ) SLAVE NONE ACCEPT' -- "$cur" ) )
fi fi
;; ;;
ptype) ptype)
_count_args _count_args
if [ $args -eq 2 ]; then if [ $args -eq 2 ]; then
_bluetooth_packet_types _bluetooth_packet_types
fi fi
;; ;;
esac esac
fi fi
} }
complete -F _hciconfig hciconfig complete -F _hciconfig hciconfig
_hciattach() _hciattach()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-n -p -t -b -s -l' -- "$cur" ) ) COMPREPLY=( $( compgen -W '-n -p -t -b -s -l' -- "$cur" ) )
else else
_count_args _count_args
case $args in case $args in
1) 1)
COMPREPLY=( $( command ls /dev/tty* ) ) COMPREPLY=( $( command ls /dev/tty* ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]} \ COMPREPLY=( $( compgen -W '${COMPREPLY[@]} \
${COMPREPLY[@]#/dev/}' -- "$cur" ) ) ${COMPREPLY[@]#/dev/}' -- "$cur" ) )
;; ;;
2) 2)
COMPREPLY=( $( compgen -W 'any ericsson digi \ COMPREPLY=( $( compgen -W 'any ericsson digi \
xircom csr bboxes swave bcsp 0x0105 \ xircom csr bboxes swave bcsp 0x0105 \
0x080a 0x0160 0x0002' -- "$cur" ) ) 0x080a 0x0160 0x0002' -- "$cur" ) )
;; ;;
3) 3)
COMPREPLY=( $( compgen -W '9600 19200 38400 \ COMPREPLY=( $( compgen -W '9600 19200 38400 \
57600 115200 230400 460800 921600' \ 57600 115200 230400 460800 921600' -- "$cur" ) )
-- "$cur" ) ) ;;
;; 4)
4) COMPREPLY=( $( compgen -W 'flow noflow' -- "$cur" ) )
COMPREPLY=( $( compgen -W 'flow noflow' \ ;;
-- "$cur" ) ) 5)
;; _bluetooth_adresses
5) ;;
_bluetooth_adresses esac
;; fi
esac
fi
} }
complete -F _hciattach hciattach complete -F _hciattach hciattach
_hid2hci() _hid2hci()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-h --help -q --quiet -0 --tohci -1 \ COMPREPLY=( $( compgen -W '-h --help -q --quiet -0 --tohci -1 \
--tohid' -- "$cur" ) ) --tohid' -- "$cur" ) )
fi fi
} }
complete -F _hid2hci hid2hci complete -F _hid2hci hid2hci
_avctrl() _avctrl()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-h --help -q --quiet' -- "$cur" ) ) COMPREPLY=( $( compgen -W '-h --help -q --quiet' -- "$cur" ) )
else else
_count_args _count_args
if [ $args -eq 1 ]; then if [ $args -eq 1 ]; then
COMPREPLY=( $( compgen -W 'discover switch' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'discover switch' -- "$cur" ) )
fi fi
fi fi
} }
complete -F _avctrl avctrl complete -F _avctrl avctrl
} }
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,47 +3,46 @@
have brctl && have brctl &&
_brctl() _brctl()
{ {
local cur command local cur command
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
command=${COMP_WORDS[1]} command=${COMP_WORDS[1]}
case $COMP_CWORD in case $COMP_CWORD in
1) 1)
COMPREPLY=( $( compgen -W "addbr delbr addif delif \ COMPREPLY=( $( compgen -W "addbr delbr addif delif \
setageing setbridgeprio setfd sethello \ setageing setbridgeprio setfd sethello \
setmaxage setpathcost setportprio show \ setmaxage setpathcost setportprio show \
showmacs showstp stp" -- "$cur" ) ) showmacs showstp stp" -- "$cur" ) )
;; ;;
2) 2)
case $command in case $command in
show) show)
;; ;;
*) *)
COMPREPLY=( $( compgen -W "$(brctl \ COMPREPLY=( $( compgen -W "$(brctl show | sed '1d' | \
show | sed '1d' | \ awk '{print $1}' )" -- "$cur" ) )
awk '{print $1}' )" -- "$cur" ) ) esac
esac ;;
;; 3)
3) case $command in
case $command in @(add|del)if)
@(add|del)if) _configured_interfaces
_configured_interfaces ;;
;; stp)
stp) COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) ;;
;; esac
esac ;;
;; esac
esac
} && } &&
complete -F _brctl $default brctl complete -F _brctl $default brctl
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,45 +3,45 @@
have bzip2 && have bzip2 &&
_bzip2() _bzip2()
{ {
local cur prev xspec local cur prev xspec
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-c -d -f -h -k -L -q -s \ COMPREPLY=( $( compgen -W '-c -d -f -h -k -L -q -s \
-t -v -V -z -1 -2 -3 -4 -5 -6 -7 -8 -9 \ -t -v -V -z -1 -2 -3 -4 -5 -6 -7 -8 -9 \
--help --decompress --compress --keep --force \ --help --decompress --compress --keep --force \
--test --stdout --quiet --verbose --license \ --test --stdout --quiet --verbose --license \
--version --small --fast --best' -- "$cur" ) ) --version --small --fast --best' -- "$cur" ) )
return 0 return 0
fi fi
local IFS=$'\t\n' local IFS=$'\t\n'
xspec="*.bz2" xspec="*.bz2"
if [[ "$prev" == --* ]]; then if [[ "$prev" == --* ]]; then
[[ "$prev" == --decompress || \ [[ "$prev" == --decompress || \
"$prev" == --list || \ "$prev" == --list || \
"$prev" == --test ]] && xspec="!"$xspec "$prev" == --test ]] && xspec="!"$xspec
[[ "$prev" == --compress ]] && xspec= [[ "$prev" == --compress ]] && xspec=
elif [[ "$prev" == -* ]]; then elif [[ "$prev" == -* ]]; then
[[ "$prev" == -*[dt]* ]] && xspec="!"$xspec [[ "$prev" == -*[dt]* ]] && xspec="!"$xspec
[[ "$prev" == -*z* ]] && xspec= [[ "$prev" == -*z* ]] && xspec=
fi fi
_expand || return 0 _expand || return 0
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) ) $( compgen -d -- "$cur" ) )
} && } &&
complete -F _bzip2 $filenames bzip2 complete -F _bzip2 $filenames bzip2
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,23 +3,22 @@
have cardctl && have cardctl &&
_cardctl() _cardctl()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
if [ $COMP_CWORD -eq 1 ]; then if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $( compgen -W 'status config ident suspend \ COMPREPLY=( $( compgen -W 'status config ident suspend \
resume reset eject insert scheme' \ resume reset eject insert scheme' -- "$cur" ) )
-- "$cur" ) ) fi
fi
} && } &&
complete -F _cardctl cardctl complete -F _cardctl cardctl
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,92 +3,91 @@
have cfagent && { have cfagent && {
_cfagent_options() _cfagent_options()
{ {
COMPREPLY=( $( compgen -W '-a --sysadm -b --force-net-copy -c \ COMPREPLY=( $( compgen -W '-a --sysadm -b --force-net-copy -c \
--no-check-files -C --no-check-mounts -d --debug -D --define \ --no-check-files -C --no-check-mounts -d --debug -D --define \
-e --no-edits -E --enforce-links -f --file -h --help -H \ -e --no-edits -E --enforce-links -f --file -h --help -H \
--no-hard-classes -i --no-ifconfig -I --inform -k --no-copy \ --no-hard-classes -i --no-ifconfig -I --inform -k --no-copy \
-K --no-lock -l --traverse-links -L --delete-stale-links -m \ -K --no-lock -l --traverse-links -L --delete-stale-links -m \
--no-mount -M --no-modules -n --recon --dry-run --just-print \ --no-mount -M --no-modules -n --recon --dry-run --just-print \
-N --negate --undefine -p --parse-only -P --no-processes -q \ -N --negate --undefine -p --parse-only -P --no-processes -q \
--no-splay -s --no-commands -S --silent -t --no-tidy -u \ --no-splay -s --no-commands -S --silent -t --no-tidy -u \
--use-env -U --underscore-classes -v --verbose -V --version \ --use-env -U --underscore-classes -v --verbose -V --version \
-x --no-preconf -X --no-links -w --no-warn --quiet' -- "$cur" ) ) -x --no-preconf -X --no-links -w --no-warn --quiet' -- "$cur" ) )
} }
_cfagent() _cfagent()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in case $prev in
-@(f|-file)) -@(f|-file))
_filedir _filedir
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
_cfagent_options _cfagent_options
fi fi
} }
complete -F _cfagent cfagent complete -F _cfagent cfagent
_cfrun() _cfrun()
{ {
local i section cfinputs local i section cfinputs
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
section=1 section=1
for (( i=1; i < COMP_CWORD; i++ )); do for (( i=1; i < COMP_CWORD; i++ )); do
if [[ "${COMP_WORDS[i]}" == -- ]]; then if [[ "${COMP_WORDS[i]}" == -- ]]; then
section=$((section + 1)) section=$((section + 1))
fi fi
done done
case $section in case $section in
1) 1)
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in case $prev in
-f) -f)
_filedir _filedir
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-f -h -d -S -T -v' \ COMPREPLY=( $( compgen -W '-f -h -d -S -T -v' -- $cur ) )
-- $cur ) ) else
else hostfile=${CFINPUTS:-/var/lib/cfengine/inputs}/cfrun.hosts
hostfile=${CFINPUTS:-/var/lib/cfengine/inputs}/cfrun.hosts for (( i=1; i < COMP_CWORD; i++ )); do
for (( i=1; i < COMP_CWORD; i++ )); do if [[ "${COMP_WORDS[i]}" == -f ]]; then
if [[ "${COMP_WORDS[i]}" == -f ]]; then hostfile=${COMP_WORDS[i+1]}
hostfile=${COMP_WORDS[i+1]} break
break fi
fi done
done [ ! -f $hostfile ] && return 0
[ ! -f $hostfile ] && return 0
COMPREPLY=( $(compgen -W "$( grep -v \ COMPREPLY=( $(compgen -W "$( grep -v \
-E '(=|^$|^#)' $hostfile )" -- "$cur" ) ) -E '(=|^$|^#)' $hostfile )" -- "$cur" ) )
fi fi
;; ;;
2) 2)
_cfagent_options _cfagent_options
;; ;;
esac esac
} }
complete -F _cfrun cfrun complete -F _cfrun cfrun
} }
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,45 +3,43 @@
have chkconfig && have chkconfig &&
_chkconfig() _chkconfig()
{ {
local cur prev split=false local cur prev split=false
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
_split_longopt && split=true _split_longopt && split=true
case "$prev" in case "$prev" in
@(?(--level=)[1-6]|--@(list|add|del|override))) @(?(--level=)[1-6]|--@(list|add|del|override)))
_services _services
return 0 return 0
;; ;;
--level) --level)
COMPREPLY=( $( compgen -W '1 2 3 4 5 6' -- "$cur" ) ) COMPREPLY=( $( compgen -W '1 2 3 4 5 6' -- "$cur" ) )
return 0 return 0
;; ;;
esac esac
$split && return 0 $split && return 0
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--list --add --del --override \ COMPREPLY=( $( compgen -W '--list --add --del --override --level' -- "$cur" ) )
--level' -- "$cur" ) ) else
else if [ $COMP_CWORD -eq 2 -o $COMP_CWORD -eq 4 ]; then
if [ $COMP_CWORD -eq 2 -o $COMP_CWORD -eq 4 ]; then COMPREPLY=( $( compgen -W 'on off reset resetpriorities' -- "$cur" ) )
COMPREPLY=( $( compgen -W 'on off reset \ else
resetpriorities' -- "$cur" ) ) _services
else fi
_services fi
fi
fi
} && } &&
complete -F _chkconfig chkconfig complete -F _chkconfig chkconfig
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -2,26 +2,26 @@
_chsh() _chsh()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
if [ "$prev" = "-s" ]; then if [ "$prev" = "-s" ]; then
_shells _shells
else else
COMPREPLY=( $( compgen -u -- "$cur" ) ) COMPREPLY=( $( compgen -u -- "$cur" ) )
fi fi
return 0 return 0
} }
complete -F _chsh chsh complete -F _chsh chsh
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,34 +3,34 @@
have cksfv && have cksfv &&
_cksfv() _cksfv()
{ {
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
if [ $COMP_CWORD -eq 1 ]; then if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $( compgen -W '-C -f -i -q -v' -- "$cur" ) ) COMPREPLY=( $( compgen -W '-C -f -i -q -v' -- "$cur" ) )
return 0 return 0
fi fi
case "${COMP_WORDS[$COMP_CWORD-1]}" in case "${COMP_WORDS[$COMP_CWORD-1]}" in
-C) -C)
_filedir -d _filedir -d
return 0 return 0
;; ;;
-f) -f)
_filedir 'sfv' _filedir 'sfv'
return 0 return 0
;; ;;
esac esac
_filedir _filedir
return 0 return 0
} && } &&
complete -F _cksfv cksfv complete -F _cksfv cksfv
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -11,12 +11,11 @@ _clisp()
# completing an option (may or may not be separated by a space) # completing an option (may or may not be separated by a space)
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-h --help --version --license -B -K \ COMPREPLY=( $( compgen -W '-h --help --version --license -B -K \
-M -m -L -N -E -q --quiet --silent -w -I -ansi \ -M -m -L -N -E -q --quiet --silent -w -I -ansi \
-traditional -p -C -norc -i -c -l -o -x ' \ -traditional -p -C -norc -i -c -l -o -x ' -- "$cur" ) )
-- "$cur" ) )
else else
_filedir _filedir
fi fi
return 0 return 0
@ -25,8 +24,8 @@ complete -F _clisp $default clisp
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

32
contrib/configure vendored
View File

@ -2,27 +2,31 @@
_configure() _configure()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
# if $COMP_CONFIGURE_HINTS is not null, then completions of the form # if $COMP_CONFIGURE_HINTS is not null, then completions of the form
# --option=SETTING will include 'SETTING' as a contextual hint # --option=SETTING will include 'SETTING' as a contextual hint
[[ "$cur" != -* ]] && return 0 [[ "$cur" != -* ]] && return 0
if [ -n "$COMP_CONFIGURE_HINTS" ]; then 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 ) ) COMPREPLY=( $( $1 --help 2>&1 | awk '/^ --[A-Za-z]/ { print $1; \
else if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,].*//g' | \
COMPREPLY=( $( $1 --help 2>&1 | awk '/^ --[A-Za-z]/ { print $1; if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,=].*//g' | grep ^$cur ) ) grep ^$cur ) )
fi 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
} }
complete -F _configure $default configure complete -F _configure $default configure
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,30 +3,30 @@
have cowsay && have cowsay &&
_cowsay() _cowsay()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in case $prev in
-f) -f)
COMPREPLY=( $( compgen -W '$( cowsay -l | tail -n +2 \ COMPREPLY=( $( compgen -W '$( cowsay -l | tail -n +2)' -- "$cur" ) )
)' -- "$cur" ) ) return 0
return 0 ;;
;; esac
esac
# relevant options completion # relevant options completion
COMPREPLY=( $( compgen -W '-b -d -g -p -s -t -w -y -e -f -h -l -n -T -W' -- "$cur" ) ) COMPREPLY=( $( compgen -W '-b -d -g -p -s -t -w -y -e -f -h -l -n -T -W' \
-- "$cur" ) )
} && } &&
complete -F _cowsay $default cowsay cowthink complete -F _cowsay $default cowsay cowthink
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,48 +3,51 @@
have cpan2dist && have cpan2dist &&
_cpan2dist() _cpan2dist()
{ {
local cur prev packagelist cpandirs local cur prev packagelist cpandirs
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in case $prev in
--format) --format)
# should remove ":" from COMP_WORDBREAKS, but doesn't work (?) # should remove ":" from COMP_WORDBREAKS, but doesn't work (?)
COMPREPLY=( $( compgen -W '$(perl -MCPANPLUS::Dist -e "print map { \"\$_\n\" } CPANPLUS::Dist->dist_types")' -- "$cur" ) ) COMPREPLY=( $( compgen -W '$(perl -MCPANPLUS::Dist -e \
return 0 "print map { \"\$_\n\" } CPANPLUS::Dist->dist_types")' \
;; -- "$cur" ) )
--@(banlist|ignorelist|modulelist|logfile)) return 0
_filedir ;;
return 0 --@(banlist|ignorelist|modulelist|logfile))
;; _filedir
esac return 0
;;
esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--help --skiptest --force --install \ COMPREPLY=( $( compgen -W '--help --skiptest --force --install \
--verbose --keepsource --makefile --buildprereq \ --verbose --keepsource --makefile --buildprereq \
--archive --flushcache --defaults --edit-metafile \ --archive --flushcache --defaults --edit-metafile \
--format --ban --banlist --ignore --ignorelist \ --format --ban --banlist --ignore --ignorelist \
--modulelist --logfile --timeout --set-config \ --modulelist --logfile --timeout --set-config \
--set-program --dist-opts --default-banlist \ --set-program --dist-opts --default-banlist \
--default-ignorelist' -- $cur ) ) --default-ignorelist' -- $cur ) )
else else
cpandirs=( "$HOME/.cpanplus/" "$HOME/.cpan/source/modules/" ) cpandirs=( "$HOME/.cpanplus/" "$HOME/.cpan/source/modules/" )
for dir in ${cpandirs[@]}; do for dir in ${cpandirs[@]}; do
[ -d "$dir" -a -r "$dir/02packages.details.txt.gz" ] && packagelist="$dir/02packages.details.txt.gz" [ -d "$dir" -a -r "$dir/02packages.details.txt.gz" ] && \
done packagelist="$dir/02packages.details.txt.gz"
COMPREPLY=( $( zgrep "^${cur//-/::}" \ done
$packagelist 2>/dev/null \ COMPREPLY=( $( zgrep "^${cur//-/::}" \
| awk '{print $1}' | sed -e 's/::/-/g' ) ) $packagelist 2>/dev/null \
fi | awk '{print $1}' | sed -e 's/::/-/g' ) )
fi
} && } &&
complete -F _cpan2dist $default cpan2dist complete -F _cpan2dist $default cpan2dist
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,99 +3,99 @@
have cpio && { have cpio && {
_cpio_format() _cpio_format()
{ {
COMPREPLY=( $( compgen -W 'bin odc newc crc tar ustar hpbin hpodc' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'bin odc newc crc tar ustar hpbin hpodc' -- "$cur" ) )
} }
_cpio() _cpio()
{ {
local cur prev split=false local cur prev split=false
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
_split_longopt && split=true _split_longopt && split=true
# --name value style option # --name value style option
case $prev in case $prev in
-H|--format) -H|--format)
_cpio_format _cpio_format
return 0 return 0
;; ;;
-@(E|F|I|-?(pattern-)file)) -@(E|F|I|-?(pattern-)file))
_filedir _filedir
return 0 return 0
;; ;;
-R|--owner) -R|--owner)
_usergroup _usergroup
return 0 return 0
;; ;;
--rsh-command) --rsh-command)
COMPREPLY=( $( compgen -c -- "$cur" ) ) COMPREPLY=( $( compgen -c -- "$cur" ) )
return 0 return 0
;; ;;
esac esac
$split && return 0 $split && return 0
if [ $COMP_CWORD -eq 1 ]; then if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $( compgen -W '-o --create -i --extract -p --pass-through' -- "$cur" ) ) COMPREPLY=( $( compgen -W '-o --create -i --extract -p --pass-through' -- "$cur" ) )
else else
case ${COMP_WORDS[1]} in case ${COMP_WORDS[1]} in
-@(o|-create)) -@(o|-create))
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-0 -a -c -v -A -B\ COMPREPLY=( $( compgen -W '-0 -a -c -v -A -B\
-L -V -C -H -M -O -F --file --format\ -L -V -C -H -M -O -F --file --format\
--message --null --reset-access-time\ --message --null --reset-access-time\
--verbose --dot --append --block-size\ --verbose --dot --append --block-size\
--dereference --io-size --quiet\ --dereference --io-size --quiet\
--force-local --rsh-command --help\ --force-local --rsh-command --help\
--version' -- "$cur" ) ) --version' -- "$cur" ) )
fi fi
;; ;;
-@(i|-extract)) -@(i|-extract))
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-b -c -d -f -m -n -r\ COMPREPLY=( $( compgen -W '-b -c -d -f -m -n -r\
-t -s -u -v -B -S -V -C -E -H -M -R -I\ -t -s -u -v -B -S -V -C -E -H -M -R -I\
-F --file --make-directories\ -F --file --make-directories\
--nonmatching\ --nonmatching\
--preserve-modification-time\ --preserve-modification-time\
--numeric-uid-gid --rename -t --list\ --numeric-uid-gid --rename -t --list\
--swap-bytes --swap --dot\ --swap-bytes --swap --dot\
--unconditional --verbose --block-size\ --unconditional --verbose --block-size\
--swap-halfwords --io-size\ --swap-halfwords --io-size\
--pattern-file --format --owner\ --pattern-file --format --owner\
--no-preserve-owner --message\ --no-preserve-owner --message\
--force-local --no-absolute-filenames\ --force-local --no-absolute-filenames\
--sparse --only-verify-crc --quiet\ --sparse --only-verify-crc --quiet\
--rsh-command --help\ --rsh-command --help\
--version' -- "$cur" ) ) --version' -- "$cur" ) )
fi fi
;; ;;
-@(p|-pass-through)) -@(p|-pass-through))
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-0 -a -d -l -m -u -v\ COMPREPLY=( $( compgen -W '-0 -a -d -l -m -u -v\
-L -V -R --null --reset-access-time\ -L -V -R --null --reset-access-time\
--make-directories --link --quiet\ --make-directories --link --quiet\
--preserve-modification-time\ --preserve-modification-time\
--unconditional --verbose --dot\ --unconditional --verbose --dot\
--dereference --owner\ --dereference --owner\
--no-preserve-owner --sparse --help\ --no-preserve-owner --sparse --help\
--version' -- "$cur" ) ) --version' -- "$cur" ) )
else else
_filedir -d _filedir -d
fi fi
;; ;;
esac esac
fi fi
} }
complete -F _cpio cpio complete -F _cpio cpio
} }
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,19 +3,19 @@
have cancel && have cancel &&
_cancel() _cancel()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
COMPREPLY=( $( compgen -W "$( lpstat | cut -d' ' -f1 )" -- "$cur" ) ) COMPREPLY=( $( compgen -W "$( lpstat | cut -d' ' -f1 )" -- "$cur" ) )
} && } &&
complete -F _cancel $filenames cancel complete -F _cancel $filenames cancel
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,270 +3,264 @@
have cvs && { have cvs && {
set_prefix() set_prefix()
{ {
[ -z ${prefix:-} ] || prefix=${cur%/*}/ [ -z ${prefix:-} ] || prefix=${cur%/*}/
[ -r ${prefix:-}CVS/Entries ] || prefix="" [ -r ${prefix:-}CVS/Entries ] || prefix=""
} }
get_entries() get_entries()
{ {
local IFS=$'\n' local IFS=$'\n'
[ -r ${prefix:-}CVS/Entries ] && \ [ -r ${prefix:-}CVS/Entries ] && \
entries=$(cut -d/ -f2 -s ${prefix:-}CVS/Entries) entries=$(cut -d/ -f2 -s ${prefix:-}CVS/Entries)
} }
get_modules() get_modules()
{ {
if [ -n "$prefix" ]; then if [ -n "$prefix" ]; then
COMPREPLY=( $( command ls -d ${cvsroot}/${prefix}/!(CVSROOT) ) ) COMPREPLY=( $( command ls -d ${cvsroot}/${prefix}/!(CVSROOT) ) )
else else
COMPREPLY=( $( command ls -d ${cvsroot}/!(CVSROOT) ) ) COMPREPLY=( $( command ls -d ${cvsroot}/!(CVSROOT) ) )
fi fi
} }
_cvs() _cvs()
{ {
local cur count mode i cvsroot cvsroots pwd local cur count mode i cvsroot cvsroots pwd
local -a flags miss files entries changed newremoved local -a flags miss files entries changed newremoved
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
count=0 count=0
for i in "${COMP_WORDS[@]}"; do for i in "${COMP_WORDS[@]}"; do
[ $count -eq $COMP_CWORD ] && break [ $count -eq $COMP_CWORD ] && break
# Last parameter was the CVSROOT, now go back to mode selection # Last parameter was the CVSROOT, now go back to mode selection
if [ "${COMP_WORDS[((count))]}" == "$cvsroot" -a "$mode" == "cvsroot" ]; then if [ "${COMP_WORDS[((count))]}" == "$cvsroot" -a "$mode" == "cvsroot" ]; then
mode="" mode=""
fi fi
if [ -z "$mode" ]; then if [ -z "$mode" ]; then
case $i in case $i in
-d) -d)
mode=cvsroot mode=cvsroot
cvsroot=${COMP_WORDS[((count+1))]} cvsroot=${COMP_WORDS[((count+1))]}
;; ;;
@(ad?(d)|new)) @(ad?(d)|new))
mode=add mode=add
;; ;;
@(adm?(in)|rcs)) @(adm?(in)|rcs))
mode=admin mode=admin
;; ;;
ann?(notate)) ann?(notate))
mode=annotate mode=annotate
;; ;;
@(checkout|co|get)) @(checkout|co|get))
mode=checkout mode=checkout
;; ;;
@(com?(mit)|ci)) @(com?(mit)|ci))
mode=commit mode=commit
;; ;;
di?(f?(f))) di?(f?(f)))
mode=diff mode=diff
;; ;;
ex?(p?(ort))) ex?(p?(ort)))
mode=export mode=export
;; ;;
?(un)edit) ?(un)edit)
mode=$i mode=$i
;; ;;
hi?(s?(tory))) hi?(s?(tory)))
mode=history mode=history
;; ;;
im?(p?(ort))) im?(p?(ort)))
mode=import mode=import
;; ;;
re?(l?(ease))) re?(l?(ease)))
mode=release mode=release
;; ;;
?(r)log) ?(r)log)
mode=log mode=log
;; ;;
@(rdiff|patch)) @(rdiff|patch))
mode=rdiff mode=rdiff
;; ;;
@(remove|rm|delete)) @(remove|rm|delete))
mode=remove mode=remove
;; ;;
@(rtag|rfreeze)) @(rtag|rfreeze))
mode=rtag mode=rtag
;; ;;
st?(at?(us))) st?(at?(us)))
mode=status mode=status
;; ;;
@(tag|freeze)) @(tag|freeze))
mode=tag mode=tag
;; ;;
up?(d?(ate))) up?(d?(ate)))
mode=update mode=update
;; ;;
*) *)
;; ;;
esac esac
elif [[ "$i" = -* ]]; then elif [[ "$i" = -* ]]; then
flags=( "${flags[@]}" $i ) flags=( "${flags[@]}" $i )
fi fi
count=$((++count)) count=$((++count))
done done
case "$mode" in case "$mode" in
add) add)
if [[ "$cur" != -* ]]; then if [[ "$cur" != -* ]]; then
set_prefix set_prefix
if [ $COMP_CWORD -gt 1 -a -r ${prefix:-}CVS/Entries ]; then if [ $COMP_CWORD -gt 1 -a -r ${prefix:-}CVS/Entries ]; then
get_entries get_entries
[ -z "$cur" ] && \ [ -z "$cur" ] && \
files=$( command ls -Ad !(CVS) ) || \ files=$( command ls -Ad !(CVS) ) || \
files=$( command ls -d ${cur}* 2>/dev/null ) files=$( command ls -d ${cur}* 2>/dev/null )
for i in "${entries[@]}"; do for i in "${entries[@]}"; do
files=( ${files[@]/#$i//} ) files=( ${files[@]/#$i//} )
done done
COMPREPLY=( $( compgen -X '*~' -W '${files[@]}' -- \ COMPREPLY=( $( compgen -X '*~' -W '${files[@]}' -- $cur ) )
$cur ) ) fi
fi else
else COMPREPLY=( $( compgen -W '-k -m' -- "$cur" ) )
COMPREPLY=( $( compgen -W '-k -m' -- "$cur" ) ) fi
fi ;;
;; admin)
admin) if [[ "$cur" = -* ]]; then
if [[ "$cur" = -* ]]; then COMPREPLY=( $( compgen -W '-i -a -A -e -b -c -k -l -u -L -U -m -M \
COMPREPLY=( $( compgen -W '-i -a -A -e -b -c -k -l -u \ -n -N -o -q -I -s -t -t- -T -V -x -z' -- $cur ) )
-L -U -m -M -n -N -o -q -I \ fi
-s -t -t- -T -V -x -z' -- \ ;;
$cur ) ) annotate)
fi if [[ "$cur" = -* ]]; then
;; COMPREPLY=( $( compgen -W '-D -F -f -l -R -r' -- "$cur" ) )
annotate) else
if [[ "$cur" = -* ]]; then get_entries
COMPREPLY=( $( compgen -W '-D -F -f -l -R -r' -- "$cur" ) ) COMPREPLY=( $( compgen -W '${entries[@]}' -- "$cur" ) )
else fi
get_entries ;;
COMPREPLY=( $( compgen -W '${entries[@]}' -- "$cur" ) ) checkout)
fi if [[ "$cur" != -* ]]; then
;; [ -z "$cvsroot" ] && cvsroot=$CVSROOT
checkout) COMPREPLY=( $( cvs -d "$cvsroot" co -c 2> /dev/null | \
if [[ "$cur" != -* ]]; then awk '{print $1}' ) )
[ -z "$cvsroot" ] && cvsroot=$CVSROOT COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
COMPREPLY=( $( cvs -d "$cvsroot" co -c 2> /dev/null | \ else
awk '{print $1}' ) ) COMPREPLY=( $( compgen -W '-A -N -P -R -c -f -l -n -p \
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) ) -s -r -D -d -k -j' -- "$cur" ) )
else fi
COMPREPLY=( $( compgen -W '-A -N -P -R -c -f -l -n -p \ ;;
-s -r -D -d -k -j' -- "$cur" ) ) commit)
fi set_prefix
;;
commit)
set_prefix
if [[ "$cur" != -* ]] && [ -r ${prefix:-}CVS/Entries ]; then if [[ "$cur" != -* ]] && [ -r ${prefix:-}CVS/Entries ]; then
# if $COMP_CVS_REMOTE is not null, 'cvs commit' will # if $COMP_CVS_REMOTE is not null, 'cvs commit' will
# complete on remotely checked-out files (requires # complete on remotely checked-out files (requires
# passwordless access to the remote repository # passwordless access to the remote repository
if [ -n "${COMP_CVS_REMOTE:-}" ]; then if [ -n "${COMP_CVS_REMOTE:-}" ]; then
# this is the least computationally intensive # this is the least computationally intensive
# way found so far, but other changes # way found so far, but other changes
# (something other than changed/removed/new) # (something other than changed/removed/new)
# may be missing # may be missing
changed=( $( cvs -q diff --brief 2>&1 | \ changed=( $( cvs -q diff --brief 2>&1 | \
sed -ne 's/^Files [^ ]* and \([^ ]*\) differ$/\1/p' ) ) sed -ne 's/^Files [^ ]* and \([^ ]*\) differ$/\1/p' ) )
newremoved=( $( cvs -q diff --brief 2>&1 | \ newremoved=( $( cvs -q diff --brief 2>&1 | \
sed -ne 's/^cvs diff: \([^ ]*\) .*, no comparison available$/\1/p' ) ) sed -ne 's/^cvs diff: \([^ ]*\) .*, no comparison available$/\1/p' ) )
COMPREPLY=( $( compgen -W '${changed[@]:-} \ COMPREPLY=( $( compgen -W '${changed[@]:-} \
${newremoved[@]:-}' -- "$cur" ) ) ${newremoved[@]:-}' -- "$cur" ) )
else else
COMPREPLY=( $(compgen $default -- "$cur") ) COMPREPLY=( $(compgen $default -- "$cur") )
fi fi
else else
COMPREPLY=( $( compgen -W '-n -R -l -f -F -m -r' -- \ COMPREPLY=( $( compgen -W '-n -R -l -f -F -m -r' -- $cur ) )
$cur ) ) fi
fi ;;
;; cvsroot)
cvsroot) if [ -r ~/.cvspass ]; then
if [ -r ~/.cvspass ]; then # Ugly escaping because of bash treating ':' specially
# Ugly escaping because of bash treating ':' specially cvsroots=$( sed 's/^[^ ]* //; s/:/\\:/g' ~/.cvspass )
cvsroots=$( sed 's/^[^ ]* //; s/:/\\:/g' ~/.cvspass ) COMPREPLY=( $( compgen -W '$cvsroots' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$cvsroots' -- "$cur" ) ) fi
fi ;;
;; export)
export) if [[ "$cur" != -* ]]; then
if [[ "$cur" != -* ]]; then [ -z "$cvsroot" ] && cvsroot=$CVSROOT
[ -z "$cvsroot" ] && cvsroot=$CVSROOT COMPREPLY=( $( cvs -d "$cvsroot" co -c | awk '{print $1}' ) )
COMPREPLY=( $( cvs -d "$cvsroot" co -c | awk '{print $1}' ) ) COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) ) else
else COMPREPLY=( $( compgen -W '-N -f -l -R -n -r -D -d -k' \
COMPREPLY=( $( compgen -W '-N -f -l -R -n \ -- "$cur" ) )
-r -D -d -k' -- "$cur" ) ) fi
fi ;;
;; diff)
diff) if [[ "$cur" == -* ]]; then
if [[ "$cur" == -* ]]; then _longopt diff
_longopt diff else
else get_entries
get_entries COMPREPLY=( $( compgen -W '${entries[@]:-}' -- "$cur" ) )
COMPREPLY=( $( compgen -W '${entries[@]:-}' -- "$cur" ) ) fi
fi ;;
;; remove)
remove) if [[ "$cur" != -* ]]; then
if [[ "$cur" != -* ]]; then set_prefix
set_prefix if [ $COMP_CWORD -gt 1 -a -r ${prefix:-}CVS/Entries ]; then
if [ $COMP_CWORD -gt 1 -a -r ${prefix:-}CVS/Entries ]; then get_entries
get_entries # find out what files are missing
# find out what files are missing for i in "${entries[@]}"; do
for i in "${entries[@]}"; do [ ! -r "$i" ] && miss=( "${miss[@]}" $i )
[ ! -r "$i" ] && miss=( "${miss[@]}" $i ) done
done COMPREPLY=( $(compgen -W '${miss[@]:-}' -- "$cur") )
COMPREPLY=( $(compgen -W '${miss[@]:-}' -- "$cur") ) fi
fi else
else COMPREPLY=( $( compgen -W '-f -l -R' -- "$cur" ) )
COMPREPLY=( $( compgen -W '-f -l -R' -- "$cur" ) ) fi
fi ;;
;; import)
import) if [[ "$cur" != -* ]]; then
if [[ "$cur" != -* ]]; then # starts with same algorithm as checkout
# starts with same algorithm as checkout [ -z "$cvsroot" ] && cvsroot=$CVSROOT
[ -z "$cvsroot" ] && cvsroot=$CVSROOT prefix=${cur%/*}
prefix=${cur%/*} if [ -r ${cvsroot}/${prefix} ]; then
if [ -r ${cvsroot}/${prefix} ]; then get_modules
get_modules COMPREPLY=( ${COMPREPLY[@]#$cvsroot} )
COMPREPLY=( ${COMPREPLY[@]#$cvsroot} ) COMPREPLY=( ${COMPREPLY[@]#\/} )
COMPREPLY=( ${COMPREPLY[@]#\/} ) fi
fi pwd=$( pwd )
pwd=$( pwd ) pwd=${pwd##*/}
pwd=${pwd##*/} COMPREPLY=( $( compgen -W '${COMPREPLY[@]} $pwd' -- $cur ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]} $pwd' -- \ else
$cur ) ) COMPREPLY=( $( compgen -W '-d -k -I -b -m -W' -- "$cur" ))
else fi
COMPREPLY=( $( compgen -W '-d -k -I -b -m -W' -- "$cur" )) ;;
fi update)
;; if [[ "$cur" = -* ]]; then
update) COMPREPLY=( $( compgen -W '-A -P -C -d -f -l -R -p \
if [[ "$cur" = -* ]]; then -k -r -D -j -I -W' -- "$cur" ) )
COMPREPLY=( $( compgen -W '-A -P -C -d -f -l -R -p \ fi
-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 \
COMPREPLY=( $( compgen -W 'add admin annotate checkout ci co \ patch rcs rdiff release remove \
commit diff delete edit export \ rfreeze rlog rm rtag stat status \
freeze get history import log new \ tag unedit up update -H -Q -q -b \
patch rcs rdiff release remove \ -d -e -f -l -n -t -r -v -w -x -z \
rfreeze rlog rm rtag stat status \ --help --version' -- "$cur" ) )
tag unedit up update -H -Q -q -b \ ;;
-d -e -f -l -n -t -r -v -w -x -z \ *)
--help --version' -- "$cur" ) ) ;;
;; esac
*)
;;
esac
return 0 return 0
} }
complete -F _cvs $default cvs complete -F _cvs $default cvs
} }
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,23 +3,24 @@
have dcop && have dcop &&
_dcop() _dcop()
{ {
local cur compstr local cur compstr
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
if [ -z $cur ]; then if [ -z $cur ]; then
compstr=${COMP_WORDS[*]} compstr=${COMP_WORDS[*]}
else else
compstr=$( command echo ${COMP_WORDS[*]} | sed "s/ $cur$//" ) compstr=$( command echo ${COMP_WORDS[*]} | sed "s/ $cur$//" )
fi fi
COMPREPLY=( $( compgen -W '$( command $compstr | sed s/\(.*\)// )' -- "$cur" ) ) COMPREPLY=( $( compgen -W '$( command $compstr | sed s/\(.*\)// )' \
-- "$cur" ) )
} && } &&
complete -F _dcop dcop complete -F _dcop dcop
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,38 +3,37 @@
have dd && have dd &&
_dd() _dd()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword =` cur=`_get_cword =`
case "$cur" in case "$cur" in
if=*|of=*) if=*|of=*)
cur=${cur#*=} cur=${cur#*=}
_filedir _filedir
return 0 return 0
;; ;;
conv=*) conv=*)
cur=${cur#*=} cur=${cur#*=}
COMPREPLY=( $( compgen -W 'ascii ebcdic ibm block unblock \ COMPREPLY=( $( compgen -W 'ascii ebcdic ibm block unblock \
lcase notrunc ucase swab noerror sync' \ lcase notrunc ucase swab noerror sync' -- "$cur" ) )
-- "$cur" ) ) return 0
return 0 ;;
;; esac
esac
_expand || return 0 _expand || return 0
COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) \ COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) \
$( compgen -W 'bs cbs conv count ibs if obs of seek skip'\ $( compgen -W 'bs cbs conv count ibs if obs of seek skip'\
-S '=' -- "$cur" ) ) -S '=' -- "$cur" ) )
} && } &&
complete -F _dd $nospace $filenames dd complete -F _dd $nospace $filenames dd
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -2,36 +2,36 @@
have dhclient && _dhclient() have dhclient && _dhclient()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-@(cf|lf|pf|sf)) -@(cf|lf|pf|sf))
_filedir _filedir
return 0 return 0
;; ;;
-s) -s)
_known_hosts_real "$cur" _known_hosts_real "$cur"
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-p -d -q -1 -r -lf -pf \ COMPREPLY=( $( compgen -W '-p -d -q -1 -r -lf -pf \
-cf -sf -s -g -n -nw -w' -- "$cur" ) ) -cf -sf -s -g -n -nw -w' -- "$cur" ) )
else else
_available_interfaces _available_interfaces
fi fi
} && } &&
complete -F _dhclient dhclient complete -F _dhclient dhclient
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,76 +3,76 @@
{ have dict || have rdict; } && { { have dict || have rdict; } && {
_dictdata() _dictdata()
{ {
dict $host $port $1 2>/dev/null | sed -ne \ dict $host $port $1 2>/dev/null | sed -ne \
's/^['$'\t '']['$'\t '']*\([^'$'\t '']*\).*$/\1/p' 's/^['$'\t '']['$'\t '']*\([^'$'\t '']*\).*$/\1/p'
} }
_dict() _dict()
{ {
local cur prev host port db dictfile local cur prev host port db dictfile
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
dictfile=/usr/share/dict/words dictfile=/usr/share/dict/words
for (( i=1; i < COMP_CWORD; i++ )); do for (( i=1; i < COMP_CWORD; i++ )); do
case "${COMP_WORDS[i]}" in case "${COMP_WORDS[i]}" in
-@(h|--host)) -@(h|--host))
host=${COMP_WORDS[i+1]} host=${COMP_WORDS[i+1]}
[ -n "$host" ] && host="-h $host" [ -n "$host" ] && host="-h $host"
i=$((++i)) i=$((++i))
;; ;;
-@(p|-port)) -@(p|-port))
port=${COMP_WORDS[i+1]} port=${COMP_WORDS[i+1]}
[ -n "$port" ] && port="-p $port" [ -n "$port" ] && port="-p $port"
i=$((++i)) i=$((++i))
;; ;;
-@(d|-database)) -@(d|-database))
db=${COMP_WORDS[i+1]} db=${COMP_WORDS[i+1]}
[ -n "$db" ] && host="-d $db" [ -n "$db" ] && host="-d $db"
i=$((++i)) i=$((++i))
;; ;;
*) *)
;; ;;
esac esac
done done
if [[ "$cur" = -* ]]; then if [[ "$cur" = -* ]]; then
COMPREPLY=( $( compgen -W '-h --host -p --port -d --database \ COMPREPLY=( $( compgen -W '-h --host -p --port -d --database \
-m --match -s --strategy -c --config -C \ -m --match -s --strategy -c --config -C \
--nocorrect -D --dbs -S --strats -H \ --nocorrect -D --dbs -S --strats -H \
--serverhelp -i --info -I --serverinfo \ --serverhelp -i --info -I --serverinfo \
-a --noauth -u --user -k --key -V --version \ -a --noauth -u --user -k --key -V --version \
-L --license --help -v --verbose -r --raw \ -L --license --help -v --verbose -r --raw \
-P --pager --debug --html --pipesize --client' \ -P --pager --debug --html --pipesize --client' \
-- "$cur" ) ) -- "$cur" ) )
return 0 return 0
fi fi
case "$prev" in case "$prev" in
-@(d|-database|i|info)) -@(d|-database|i|info))
COMPREPLY=( $( compgen -W '$( _dictdata -D )' -- "$cur" ) ) COMPREPLY=( $( compgen -W '$( _dictdata -D )' -- "$cur" ) )
return 0 return 0
;; ;;
-@(s|-strategy)) -@(s|-strategy))
COMPREPLY=( $( compgen -W '$( _dictdata -S )' -- "$cur" ) ) COMPREPLY=( $( compgen -W '$( _dictdata -S )' -- "$cur" ) )
return 0 return 0
;; ;;
*) *)
;; ;;
esac esac
[ -r $dictfile ] && \ [ -r $dictfile ] && \
COMPREPLY=( $( compgen -W '$( cat $dictfile )' -- "$cur" ) ) COMPREPLY=( $( compgen -W '$( cat $dictfile )' -- "$cur" ) )
} }
complete -F _dict $default dict rdict complete -F _dict $default dict rdict
} }
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,16 +3,16 @@ have dpkg && {
have grep-status && { have grep-status && {
_comp_dpkg_installed_packages() _comp_dpkg_installed_packages()
{ {
grep-status -P -e "^$1" -a -FStatus 'install ok installed' -n -s Package grep-status -P -e "^$1" -a -FStatus 'install ok installed' -n -s Package
} }
} || { } || {
_comp_dpkg_installed_packages() _comp_dpkg_installed_packages()
{ {
grep -A 1 "Package: $1" /var/lib/dpkg/status | \ grep -A 1 "Package: $1" /var/lib/dpkg/status | \
grep -B 1 -Ee "ok installed|half-installed|unpacked| \ grep -B 1 -Ee "ok installed|half-installed|unpacked| \
half-configured|config-files" \ half-configured|config-files" \
-Ee "^Essential: yes" | \ -Ee "^Essential: yes" | \
grep "Package: $1" | cut -d\ -f2 grep "Package: $1" | cut -d\ -f2
} }
} }
@ -20,75 +20,74 @@ _comp_dpkg_installed_packages()
# #
_dpkg() _dpkg()
{ {
local cur prev i local cur prev i
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
i=$COMP_CWORD i=$COMP_CWORD
_expand || return 0 _expand || return 0
_split_longopt _split_longopt
# find the last option flag # find the last option flag
if [[ $cur != -* ]]; then if [[ $cur != -* ]]; then
while [[ $prev != -* && $i != 1 ]]; do while [[ $prev != -* && $i != 1 ]]; do
i=$((i-1)) i=$((i-1))
prev=${COMP_WORDS[i-1]} prev=${COMP_WORDS[i-1]}
done done
fi fi
case "$prev" in case "$prev" in
-@(c|i|A|I|f|e|x|X|-@(install|unpack|record-avail|contents|info|fsys-tarfile|field|control|extract))) -@(c|i|A|I|f|e|x|X|-@(install|unpack|record-avail|contents|info|fsys-tarfile|field|control|extract)))
_filedir '?(u)deb' _filedir '?(u)deb'
return 0 return 0
;; ;;
-@(b|-build)) -@(b|-build))
_filedir -d _filedir -d
return 0 return 0
;; ;;
-@(s|p|l|-@(status|print-avail|list))) -@(s|p|l|-@(status|print-avail|list)))
COMPREPLY=( $( apt-cache pkgnames "$cur" 2>/dev/null ) ) COMPREPLY=( $( apt-cache pkgnames "$cur" 2>/dev/null ) )
return 0 return 0
;; ;;
-@(S|-search)) -@(S|-search))
_filedir _filedir
return 0 return 0
;; ;;
-@(r|L|P|-@(remove|purge|listfiles))) -@(r|L|P|-@(remove|purge|listfiles)))
COMPREPLY=( $( _comp_dpkg_installed_packages "$cur" ) ) COMPREPLY=( $( _comp_dpkg_installed_packages "$cur" ) )
return 0 return 0
;; ;;
*) *)
COMPREPLY=( $( compgen -W '-i --install --unpack -A --record-avail \
COMPREPLY=( $( compgen -W '-i --install --unpack -A --record-avail \ --configure -r --remove -P --purge --get-selections \
--configure -r --remove -P --purge --get-selections \ --set-selections --update-avail --merge-avail \
--set-selections --update-avail --merge-avail \ --clear-avail --command-fd --forget-old-unavail -s \
--clear-avail --command-fd --forget-old-unavail -s \ --status -p --print-avail -L --listfiles -l --list \
--status -p --print-avail -L --listfiles -l --list \ -S --search -C --audit --print-architecture \
-S --search -C --audit --print-architecture \ --print-gnu-build-architecture \
--print-gnu-build-architecture \ --print-installation-architecture \
--print-installation-architecture \ --compare-versions --help --version --force-help \
--compare-versions --help --version --force-help \ --force-all --force-auto-select --force-downgrade \
--force-all --force-auto-select --force-downgrade \ --force-configure-any --force-hold --force-bad-path \
--force-configure-any --force-hold --force-bad-path \ --force-not-root --force-overwrite \
--force-not-root --force-overwrite \ --force-overwrite-diverted --force-bad-verify \
--force-overwrite-diverted --force-bad-verify \ --force-depends-version --force-depends \
--force-depends-version --force-depends \ --force-confnew --force-confold --force-confdef \
--force-confnew --force-confold --force-confdef \ --force-confmiss --force-conflicts --force-architecture\
--force-confmiss --force-conflicts --force-architecture\ --force-overwrite-dir --force-remove-reinstreq \
--force-overwrite-dir --force-remove-reinstreq \ --force-remove-essential -Dh \
--force-remove-essential -Dh \ --debug=help --licence --admindir --root --instdir \
--debug=help --licence --admindir --root --instdir \ -O --selected-only -E --skip-same-version \
-O --selected-only -E --skip-same-version \ -G --refuse-downgrade -B --auto-deconfigure \
-G --refuse-downgrade -B --auto-deconfigure \ --no-debsig --no-act -D --debug --status-fd \
--no-debsig --no-act -D --debug --status-fd \ -b --build -I --info -f --field -c --contents \
-b --build -I --info -f --field -c --contents \ -x --extract -X --vextract --fsys-tarfile -e --control \
-x --extract -X --vextract --fsys-tarfile -e --control \ --ignore-depends --abort-after' -- "$cur" ) )
--ignore-depends --abort-after' -- "$cur" ) ) ;;
;; esac
esac
} }
@ -100,34 +99,33 @@ complete -F _dpkg $filenames dpkg dpkg-deb
have dpkg-reconfigure && have dpkg-reconfigure &&
_dpkg_reconfigure() _dpkg_reconfigure()
{ {
local cur prev opt local cur prev opt
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-@(f|-frontend)) -@(f|-frontend))
opt=( $( echo /usr/share/perl5/Debconf/FrontEnd/* ) ) opt=( $( echo /usr/share/perl5/Debconf/FrontEnd/* ) )
opt=( ${opt[@]##*/} ) opt=( ${opt[@]##*/} )
opt=( ${opt[@]%.pm} ) opt=( ${opt[@]%.pm} )
COMPREPLY=( $( compgen -W '${opt[@]}' -- "$cur" ) ) COMPREPLY=( $( compgen -W '${opt[@]}' -- "$cur" ) )
return 0 return 0
;; ;;
-@(p|-priority)) -@(p|-priority))
COMPREPLY=( $( compgen -W 'low medium high critical' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'low medium high critical' -- "$cur" ) )
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-f --frontend -p --priority -a --all \ COMPREPLY=( $( compgen -W '-f --frontend -p --priority -a --all -u \
-u --unseen-only -h --help -s --showold \ --unseen-only -h --help -s --showold --force --terse' -- "$cur" ) )
--force --terse' -- "$cur" ) ) else
else COMPREPLY=( $( _comp_dpkg_installed_packages "$cur" ) )
COMPREPLY=( $( _comp_dpkg_installed_packages "$cur" ) ) fi
fi
} && } &&
complete -F _dpkg_reconfigure $default dpkg-reconfigure complete -F _dpkg_reconfigure $default dpkg-reconfigure
@ -136,135 +134,135 @@ complete -F _dpkg_reconfigure $default dpkg-reconfigure
have dpkg-source && have dpkg-source &&
_dpkg_source() _dpkg_source()
{ {
local cur prev options work i action packopts unpackopts 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" 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" unpackopts="-sp -sn -su"
options=`echo "-x -b $packopts $unpackopts" | xargs echo | sort -u | xargs echo` options=`echo "-x -b $packopts $unpackopts" | xargs echo | sort -u | xargs echo`
COMPREPLY=() COMPREPLY=()
if [ "$1" != "dpkg-source" ]; then if [ "$1" != "dpkg-source" ]; then
return 1 return 1
fi fi
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
action="options" action="options"
for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
if [[ ${COMP_WORDS[$i]} == "-x" ]]; then if [[ ${COMP_WORDS[$i]} == "-x" ]]; then
action=unpack action=unpack
elif [[ ${COMP_WORDS[$i]} == "-b" ]]; then elif [[ ${COMP_WORDS[$i]} == "-b" ]]; then
action=pack action=pack
elif [[ ${COMP_WORDS[$i]} == "-h" ]]; then elif [[ ${COMP_WORDS[$i]} == "-h" ]]; then
action=help action=help
fi fi
done done
# if currently seeing a complete option, return just itself. # if currently seeing a complete option, return just itself.
for i in $options; do for i in $options; do
if [ "$cur" = "$i" ]; then if [ "$cur" = "$i" ]; then
COMPREPLY=( "$cur" ) COMPREPLY=( "$cur" )
return 0 return 0
fi fi
done done
case "$action" in case "$action" in
"unpack") "unpack")
if [ "$cur" = "-" -o "$cur" = "-s" ]; then if [ "$cur" = "-" -o "$cur" = "-s" ]; then
COMPREPLY=( $unpackopts ) COMPREPLY=( $unpackopts )
return 0 return 0
fi fi
case "$prev" in case "$prev" in
"-x") "-x")
COMPREPLY=( $( compgen -d -- "$cur" ) \ COMPREPLY=( $( compgen -d -- "$cur" ) \
$( compgen -f -X '!*.dsc' -- "$cur" ) ) $( compgen -f -X '!*.dsc' -- "$cur" ) )
return 0 return 0
;; ;;
*) *)
COMPREPLY=( $unpackopts $(compgen -d -f -- "$cur" ) ) COMPREPLY=( $unpackopts $(compgen -d -f -- "$cur" ) )
return 0 return 0
;; ;;
esac esac
return 0 return 0
;; ;;
"pack") "pack")
if [ "$cur" = "-" ]; then if [ "$cur" = "-" ]; then
COMPREPLY=( $packopts ) COMPREPLY=( $packopts )
return 0 return 0
fi fi
if [ "$cur" = "-s" ]; then if [ "$cur" = "-s" ]; then
COMPREPLY=( "-sa" "-sk" "-sp" "-su" "-sr" "-ss" "-sn" \ COMPREPLY=( "-sa" "-sk" "-sp" "-su" "-sr" "-ss" "-sn" \
"-sA" "-sK" "-sP" "-sU" "-sR" ) "-sA" "-sK" "-sP" "-sU" "-sR" )
return 0 return 0
fi fi
case "$prev" in case "$prev" in
"-b") "-b")
COMPREPLY=( $( compgen -d -- "$cur" ) ) COMPREPLY=( $( compgen -d -- "$cur" ) )
return 0 return 0
;; ;;
"-c"|"-l"|"-T"|"-i"|"-I") "-c"|"-l"|"-T"|"-i"|"-I")
# -c: get controlfile # -c: get controlfile
# -l: get per-version info from this file # -l: get per-version info from this file
# -T: read variables here, not debian/substvars # -T: read variables here, not debian/substvars
# -i: <regexp> filter out files to ignore diffs of. # -i: <regexp> filter out files to ignore diffs of.
# -I: filter out files when building tarballs. # -I: filter out files when building tarballs.
# return directory names and file names # return directory names and file names
COMPREPLY=( $( compgen -d -f ) ) COMPREPLY=( $( compgen -d -f ) )
return 0 return 0
;; ;;
"-F") "-F")
# -F: force change log format # -F: force change log format
COMPREPLY=( $( ( cd /usr/lib/dpkg/parsechangelog; compgen -f "$cur" ) ) ) COMPREPLY=( $( ( cd /usr/lib/dpkg/parsechangelog; compgen -f "$cur" ) ) )
return 0 return 0
;; ;;
"-V"|"-D") "-V"|"-D")
# -V: set a substitution variable # -V: set a substitution variable
# we don't know anything about possible variables or values # we don't know anything about possible variables or values
# so we don't try to suggest any completion. # so we don't try to suggest any completion.
COMPREPLY=() COMPREPLY=()
return 0 return 0
;; ;;
"-D") "-D")
# -D: override or add a .dsc field and value # -D: override or add a .dsc field and value
# if $cur doesn't contain a = yet, suggest variable names # if $cur doesn't contain a = yet, suggest variable names
if echo -- "$cur" | grep -q "="; then if echo -- "$cur" | grep -q "="; then
# $cur contains a "=" # $cur contains a "="
COMPREPLY=() COMPREPLY=()
return 0 return 0
else else
COMPREPLY=( Format Source Version Binary Maintainer Uploader Architecture Standards-Version Build-Depends Files ) COMPREPLY=( Format Source Version Binary Maintainer Uploader Architecture Standards-Version Build-Depends Files )
return 0 return 0
fi fi
;; ;;
"-U") "-U")
# -U: remove a field # -U: remove a field
# Suggest possible fieldnames # Suggest possible fieldnames
COMPREPLY=( Format Source Version Binary Maintainer Uploader Architecture Standards-Version Build-Depends Files ) COMPREPLY=( Format Source Version Binary Maintainer Uploader Architecture Standards-Version Build-Depends Files )
return 0 return 0
;; ;;
*) *)
COMPREPLY=( $packopts ) COMPREPLY=( $packopts )
return 0 return 0
;; ;;
esac esac
return 0 return 0
;; ;;
*) *)
# if seeing a partial option, return possible completions. # if seeing a partial option, return possible completions.
if [ "$cur" = "-s" ]; then if [ "$cur" = "-s" ]; then
COMPREPLY=( "-sa" "-sk" "-sp" "-su" "-sr" "-ss" "-sn" \ COMPREPLY=( "-sa" "-sk" "-sp" "-su" "-sr" "-ss" "-sn" \
"-sA" "-sK" "-sP" "-sU" "-sR" ) "-sA" "-sK" "-sP" "-sU" "-sR" )
return 0 return 0
fi fi
# else return all possible options. # else return all possible options.
COMPREPLY=( $options ) COMPREPLY=( $options )
return 0 return 0
;; ;;
esac esac
} && } &&
complete -F _dpkg_source dpkg-source complete -F _dpkg_source dpkg-source
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,41 +3,40 @@
have dselect && have dselect &&
_dselect() _dselect()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
--admindir) --admindir)
_filedir -d _filedir -d
return 0 return 0
;; ;;
-@(D|debug))
_filedir
return 0
;;
esac
-@(D|debug)) if [[ "$cur" == -* ]]; then
_filedir COMPREPLY=( $( compgen -W '--admindir --help --version --licence \
return 0 --license --expert --debug' -- "$cur" ) )
;; else
esac COMPREPLY=( $( compgen -W 'access update select install config \
remove quit' -- "$cur" ) )
if [[ "$cur" == -* ]]; then fi
COMPREPLY=( $( compgen -W '--admindir --help --version --licence \
--license --expert --debug' -- "$cur" ) )
else
COMPREPLY=( $( compgen -W 'access update select install config \
remove quit' -- "$cur" ) )
fi
return 0 return 0
} && } &&
complete -F _dselect $filenames dselect complete -F _dselect $filenames dselect
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -5,28 +5,28 @@
have arpspoof && have arpspoof &&
_arpspoof() _arpspoof()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-i) -i)
_interfaces _interfaces
return 0 return 0
;; ;;
-t) -t)
_known_hosts_real "$cur" _known_hosts_real "$cur"
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-i -t' -- "$cur" ) ) COMPREPLY=( $( compgen -W '-i -t' -- "$cur" ) )
else else
_known_hosts_real "$cur" _known_hosts_real "$cur"
fi fi
} && } &&
complete -F _arpspoof arpspoof complete -F _arpspoof arpspoof
@ -36,26 +36,26 @@ complete -F _arpspoof arpspoof
have dnsspoof && have dnsspoof &&
_dnsspoof() _dnsspoof()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-i) -i)
_interfaces _interfaces
return 0 return 0
;; ;;
-f) -f)
_filedir _filedir
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-i -f' -- "$cur" ) ) COMPREPLY=( $( compgen -W '-i -f' -- "$cur" ) )
fi fi
} && } &&
complete -F _dnsspoof dnsspoof complete -F _dnsspoof dnsspoof
@ -65,27 +65,26 @@ complete -F _dnsspoof dnsspoof
have dsniff && have dsniff &&
_dsniff() _dsniff()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-@(r|w|f)) -@(r|w|f))
_filedir _filedir
return 0 return 0
;; ;;
-i) -i)
_interfaces _interfaces
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-c -d -m -n -i -s -f -t \ COMPREPLY=( $( compgen -W '-c -d -m -n -i -s -f -t -r -w' -- "$cur" ) )
-r -w' -- "$cur" ) ) fi
fi
} && } &&
complete -F _dsniff dsniff complete -F _dsniff dsniff
@ -95,22 +94,22 @@ complete -F _dsniff dsniff
have filesnarf || have mailsnarf || have msgsnarf && have filesnarf || have mailsnarf || have msgsnarf &&
_snarf() _snarf()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-i) -i)
_interfaces _interfaces
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-i -v' -- "$cur" ) ) COMPREPLY=( $( compgen -W '-i -v' -- "$cur" ) )
fi fi
} && } &&
complete -F _snarf filesnarf mailsnarf msgsnarf complete -F _snarf filesnarf mailsnarf msgsnarf
@ -120,23 +119,23 @@ complete -F _snarf filesnarf mailsnarf msgsnarf
have macof && have macof &&
_macof() _macof()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-i) -i)
_interfaces _interfaces
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-i -s -d -e -x -y -n' -- "$cur" ) ) COMPREPLY=( $( compgen -W '-i -s -d -e -x -y -n' -- "$cur" ) )
fi fi
} && } &&
complete -F _macof macof complete -F _macof macof
@ -146,16 +145,16 @@ complete -F _macof macof
have sshmitm && have sshmitm &&
_sshmitm() _sshmitm()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-d -I -p' -- "$cur" ) ) COMPREPLY=( $( compgen -W '-d -I -p' -- "$cur" ) )
else else
_known_hosts_real "$cur" _known_hosts_real "$cur"
fi fi
} && } &&
complete -F _sshmitm sshmitm complete -F _sshmitm sshmitm
@ -165,22 +164,22 @@ complete -F _sshmitm sshmitm
have sshow && have sshow &&
_sshow() _sshow()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-i) -i)
_interfaces _interfaces
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-d -i' -- "$cur" ) ) COMPREPLY=( $( compgen -W '-d -i' -- "$cur" ) )
fi fi
} && } &&
complete -F _sshow sshow complete -F _sshow sshow
@ -190,22 +189,22 @@ complete -F _sshow sshow
have tcpkill && have tcpkill &&
_tcpkill() _tcpkill()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-i) -i)
_interfaces _interfaces
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-i -1 -2 -3 -4 -5 -6 -7 -8 -9' -- "$cur" ) ) COMPREPLY=( $( compgen -W '-i -1 -2 -3 -4 -5 -6 -7 -8 -9' -- "$cur" ) )
fi fi
} && } &&
complete -F _tcpkill tcpkill complete -F _tcpkill tcpkill
@ -215,22 +214,22 @@ complete -F _tcpkill tcpkill
have tcpnice && have tcpnice &&
_tcpnice() _tcpnice()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-i) -i)
_interfaces _interfaces
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-A -I -M -i' -- "$cur" ) ) COMPREPLY=( $( compgen -W '-A -I -M -i' -- "$cur" ) )
fi fi
} && } &&
complete -F _tcpnice tcpnice complete -F _tcpnice tcpnice
@ -240,22 +239,22 @@ complete -F _tcpnice tcpnice
have urlsnarf && have urlsnarf &&
_urlsnarf() _urlsnarf()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-i) -i)
_interfaces _interfaces
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-n -i -v' -- "$cur" ) ) COMPREPLY=( $( compgen -W '-n -i -v' -- "$cur" ) )
fi fi
} && } &&
complete -F _urlsnarf urlsnarf complete -F _urlsnarf urlsnarf
@ -265,24 +264,24 @@ complete -F _urlsnarf urlsnarf
have webmitm && have webmitm &&
_webmitm() _webmitm()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-d' -- "$cur" ) ) COMPREPLY=( $( compgen -W '-d' -- "$cur" ) )
else else
_known_hosts_real "$cur" _known_hosts_real "$cur"
fi fi
} && } &&
complete -F _webmitm webmitm complete -F _webmitm webmitm
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -5,117 +5,118 @@
have find && have find &&
_find() _find()
{ {
local cur prev i exprfound onlyonce local cur prev i exprfound onlyonce
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-@(max|min)depth) -@(max|min)depth)
COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9' -- "$cur" ) ) COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9' -- "$cur" ) )
return 0 return 0
;; ;;
-?(a|c)newer|-fls|-fprint?(0|f)|-?(i)?(l)name|-?(i)wholename) -?(a|c)newer|-fls|-fprint?(0|f)|-?(i)?(l)name|-?(i)wholename)
_filedir _filedir
return 0 return 0
;; ;;
-fstype) -fstype)
# this is highly non-portable # this is highly non-portable
[ -e /proc/filesystems ] && [ -e /proc/filesystems ] &&
COMPREPLY=( $( compgen -W "$( cut -d$'\t' -f2 /proc/filesystems )" -- "$cur" ) ) COMPREPLY=( $( compgen -W "$( cut -d$'\t' -f2 /proc/filesystems )" \
return 0 -- "$cur" ) )
;; return 0
-gid) ;;
_gids -gid)
return 0 _gids
;; return 0
-group) ;;
if [ -n "$bash205" ]; then -group)
COMPREPLY=( $( compgen -g -- $cur 2>/dev/null) ) if [ -n "$bash205" ]; then
fi COMPREPLY=( $( compgen -g -- $cur 2>/dev/null) )
return 0 fi
;; return 0
-?(x)type) ;;
COMPREPLY=( $( compgen -W 'b c d p f l s' -- "$cur" ) ) -?(x)type)
return 0 COMPREPLY=( $( compgen -W 'b c d p f l s' -- "$cur" ) )
;; return 0
-uid) ;;
_uids -uid)
return 0 _uids
;; return 0
-user) ;;
COMPREPLY=( $( compgen -u -- "$cur" ) ) -user)
return 0 COMPREPLY=( $( compgen -u -- "$cur" ) )
;; return 0
-exec|-ok) ;;
COMP_WORDS=(COMP_WORDS[0] "$cur") -exec|-ok)
COMP_CWORD=1 COMP_WORDS=(COMP_WORDS[0] "$cur")
_command COMP_CWORD=1
return 0 _command
;; return 0
-[acm]min|-[acm]time|-?(i)?(l)?(whole)name|-inum|-?(i)path|-?(i)regex| \ ;;
-links|-perm|-size|-used|-printf) -[acm]min|-[acm]time|-?(i)?(l)?(whole)name|-inum|-?(i)path|-?(i)regex| \
# do nothing, just wait for a parameter to be given -links|-perm|-size|-used|-printf)
return 0 # do nothing, just wait for a parameter to be given
;; return 0
esac ;;
esac
_expand || return 0 _expand || return 0
# set exprfound to 1 if there is already an expression present # set exprfound to 1 if there is already an expression present
for i in ${COMP_WORDS[@]}; do for i in ${COMP_WORDS[@]}; do
[[ "$i" = [-\(\),\!]* ]] && exprfound=1 && break [[ "$i" = [-\(\),\!]* ]] && exprfound=1 && break
done done
# handle case where first parameter is not a dash option # handle case where first parameter is not a dash option
if [ "$exprfound" != 1 ] && [[ "$cur" != [-\(\),\!]* ]]; then if [ "$exprfound" != 1 ] && [[ "$cur" != [-\(\),\!]* ]]; then
_filedir -d _filedir -d
return 0 return 0
fi fi
# complete using basic options # complete using basic options
COMPREPLY=( $( compgen -W '-daystart -depth -follow -help -maxdepth \ COMPREPLY=( $( compgen -W '-daystart -depth -follow -help -maxdepth \
-mindepth -mount -noleaf -version -xdev -amin -anewer \ -mindepth -mount -noleaf -version -xdev -amin -anewer \
-atime -cmin -cnewer -ctime -empty -false -fstype \ -atime -cmin -cnewer -ctime -empty -false -fstype \
-gid -group -ilname -iname -inum -ipath -iregex \ -gid -group -ilname -iname -inum -ipath -iregex \
-wholename \ -wholename \
-links -lname -mmin -mtime -name -newer -nouser \ -links -lname -mmin -mtime -name -newer -nouser \
-nogroup -perm -regex -size -true -type -uid -used \ -nogroup -perm -regex -size -true -type -uid -used \
-user -xtype -exec -fls -fprint -fprint0 -fprintf -ok \ -user -xtype -exec -fls -fprint -fprint0 -fprintf -ok \
-print -print0 -printf -prune -ls -wholename -iwholename' -- "$cur" ) ) -print -print0 -printf -prune -ls -wholename -iwholename' -- "$cur" ) )
# this removes any options from the list of completions that have # this removes any options from the list of completions that have
# already been specified somewhere on the command line, as long as # already been specified somewhere on the command line, as long as
# these options can only be used once (in a word, "options", in # these options can only be used once (in a word, "options", in
# opposition to "tests" and "actions", as in the find(1) manpage). # opposition to "tests" and "actions", as in the find(1) manpage).
onlyonce=' -daystart -depth -follow -help -maxdepth -mindepth -mount \ onlyonce=' -daystart -depth -follow -help -maxdepth -mindepth -mount \
-noleaf -version -xdev ' -noleaf -version -xdev '
COMPREPLY=( $( echo "${COMP_WORDS[@]}" | \ COMPREPLY=( $( echo "${COMP_WORDS[@]}" | \
(while read -d ' ' i; do (while read -d ' ' i; do
[ "$i" == "" ] || [ "$i" == "" ] ||
[ "${onlyonce/ ${i%% *} / }" == "$onlyonce" ] && [ "${onlyonce/ ${i%% *} / }" == "$onlyonce" ] &&
continue continue
# flatten array with spaces on either side, # flatten array with spaces on either side,
# otherwise we cannot grep on word boundaries of # otherwise we cannot grep on word boundaries of
# first and last word # first and last word
COMPREPLY=" ${COMPREPLY[@]} " COMPREPLY=" ${COMPREPLY[@]} "
# remove word from list of completions # remove word from list of completions
COMPREPLY=( ${COMPREPLY/ ${i%% *} / } ) COMPREPLY=( ${COMPREPLY/ ${i%% *} / } )
done done
echo "${COMPREPLY[@]}") echo "${COMPREPLY[@]}")
) ) ) )
_filedir _filedir
return 0 return 0
} && } &&
complete -F _find $filenames find complete -F _find $filenames find
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,25 +3,24 @@
have civserver && have civserver &&
_civserver() _civserver()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-@(f|g|l|r|-file|-log|-gamelog|-read)) -@(f|g|l|r|-file|-log|-gamelog|-read))
_filedir _filedir
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-d -f -g -h -i -l -m -M -p -q -r -v\ COMPREPLY=( $( compgen -W '-d -f -g -h -i -l -m -M -p -q -r -v\
--debug --file --gamelog --help --info --log --meta \ --debug --file --gamelog --help --info --log --meta \
--Metaserver --port --quitidle --read --version' \ --Metaserver --port --quitidle --read --version' -- "$cur" ) )
-- "$cur" ) ) fi
fi
} && } &&
complete -F _civserver civserver complete -F _civserver civserver
@ -31,41 +30,40 @@ complete -F _civserver civserver
have civclient && have civclient &&
_civclient() _civclient()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-@(l|S|t|-log|-Sound|-tiles)) -@(l|S|t|-log|-Sound|-tiles))
_filedir _filedir
return 0 return 0
;; ;;
-@(P|-Plugin)) -@(P|-Plugin))
COMPREPLY=( $( compgen -W 'none esd sdl' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'none esd sdl' -- "$cur" ) )
return 0 return 0
;; ;;
-@(s|-server)) -@(s|-server))
_known_hosts_real "$cur" _known_hosts_real "$cur"
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-a -d -h -l -m -n -p -P -s -S -t -v\ COMPREPLY=( $( compgen -W '-a -d -h -l -m -n -p -P -s -S -t -v\
--autoconnect --debug --help --log --meta --name \ --autoconnect --debug --help --log --meta --name --port \
--port --Plugin --server --Sound --tiles --version' \ --Plugin --server --Sound --tiles --version' -- "$cur" ) )
-- "$cur" ) ) fi
fi
} && } &&
complete -F _civclient civclient complete -F _civclient civclient
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -11,40 +11,40 @@
have gcc && have gcc &&
_gcc() _gcc()
{ {
local cur cc backend local cur cc backend
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
_expand || return 0 _expand || return 0
case "$1" in case "$1" in
gcj) gcj)
backend=jc1 backend=jc1
;; ;;
gpc) gpc)
backend=gpc1 backend=gpc1
;; ;;
*77) *77)
backend=f771 backend=f771
;; ;;
*) *)
backend=cc1 # (near-)universal backend backend=cc1 # (near-)universal backend
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
cc=$( $1 -print-prog-name=$backend ) cc=$( $1 -print-prog-name=$backend )
# sink stderr: # sink stderr:
# for C/C++/ObjectiveC it's useless # for C/C++/ObjectiveC it's useless
# for FORTRAN/Java it's an error # for FORTRAN/Java it's an error
COMPREPLY=( $( compgen -W "$( $cc --help 2>/dev/null | \ COMPREPLY=( $( compgen -W "$( $cc --help 2>/dev/null | \
tr '\t' ' ' | \ tr '\t' ' ' | \
sed -e '/^ *-/!d' -e 's/ *-\([^ ]*\).*/-\1/' | \ sed -e '/^ *-/!d' -e 's/ *-\([^ ]*\).*/-\1/' | \
sort -u )" -- "$cur" ) ) sort -u )" -- "$cur" ) )
else else
_filedir _filedir
fi fi
} && } &&
complete $filenames -F _gcc gcc g++ c++ g77 gcj gpc complete $filenames -F _gcc gcc g++ c++ g77 gcj gpc
[ $USERLAND = GNU -o $UNAME = Cygwin ] && \ [ $USERLAND = GNU -o $UNAME = Cygwin ] && \
@ -52,8 +52,8 @@ complete $filenames -F _gcc gcc g++ c++ g77 gcj gpc
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -11,11 +11,10 @@ _gcl()
# completing an option (may or may not be separated by a space) # completing an option (may or may not be separated by a space)
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-eval -load -f -batch -dir -libdir \ COMPREPLY=( $( compgen -W '-eval -load -f -batch -dir -libdir \
-compile -o-file -c-file -h-file -data-file -system-p '\ -compile -o-file -c-file -h-file -data-file -system-p '-- "$cur" ) )
-- "$cur" ) )
else else
_filedir _filedir
fi fi
return 0 return 0
@ -24,8 +23,8 @@ complete -F _gcl $default gcl
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,42 +3,41 @@
have gdb && have gdb &&
_gdb() _gdb()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
if [ $COMP_CWORD -eq 1 ]; then if [ $COMP_CWORD -eq 1 ]; then
local IFS local IFS
if [[ "$cur" == */* ]]; then if [[ "$cur" == */* ]]; then
# compgen -c works as expected if $cur contains any slashes. # compgen -c works as expected if $cur contains any slashes.
IFS=$'\n' IFS=$'\n'
COMPREPLY=( $( PATH="$PATH:." compgen -d -c -- "$cur" ) ) COMPREPLY=( $( PATH="$PATH:." compgen -d -c -- "$cur" ) )
else else
# otherwise compgen -c contains Bash's built-in commands, # otherwise compgen -c contains Bash's built-in commands,
# functions and aliases. Thus we need to retrieve the program # functions and aliases. Thus we need to retrieve the program
# names manually. # names manually.
IFS=":" IFS=":"
local path_array=( $(echo "$PATH" | sed 's/::\+/:/g;s/^:\|:$//g') ) local path_array=( $(echo "$PATH" | sed 's/::\+/:/g;s/^:\|:$//g') )
IFS=$'\n' IFS=$'\n'
COMPREPLY=( $( compgen -d -W '$(find "${path_array[@]}" . \ COMPREPLY=( $( compgen -d -W '$(find "${path_array[@]}" . \
-mindepth 1 -maxdepth 1 -not -type d -executable -printf "%f\\n" 2>/dev/null)' \ -mindepth 1 -maxdepth 1 -not -type d -executable \
-- "$cur" ) ) -printf "%f\\n" 2>/dev/null)' -- "$cur" ) )
fi fi
elif [ $COMP_CWORD -eq 2 ]; then elif [ $COMP_CWORD -eq 2 ]; then
prev=${prev##*/} prev=${prev##*/}
COMPREPLY=( $( compgen -fW "$( command ps axo comm,pid | \ COMPREPLY=( $( compgen -fW "$( command ps axo comm,pid | \
awk '{if ($1 ~ /^'"$prev"'/) print $2}' )" \ awk '{if ($1 ~ /^'"$prev"'/) print $2}' )" -- "$cur" ) )
-- "$cur" ) ) fi
fi
} && } &&
complete -F _gdb $default gdb complete -F _gdb $default gdb
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,77 +3,77 @@
(have mkisofs || have genisoimage) && (have mkisofs || have genisoimage) &&
_mkisofs() _mkisofs()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-@(o|abstract|biblio|check-session|copyright|log-file|root-info|prep-boot|*-list)) -@(o|abstract|biblio|check-session|copyright|log-file|root-info|prep-boot|*-list))
_filedir _filedir
return 0 return 0
;; ;;
-*-charset) -*-charset)
COMPREPLY=( $( compgen -W '$( mkisofs -input-charset \ COMPREPLY=( $( compgen -W '$( mkisofs -input-charset \
help 2>&1 | tail -n +3 )' -- "$cur" ) ) help 2>&1 | tail -n +3 )' -- "$cur" ) )
return 0 return 0
;; ;;
-uid) -uid)
_uids _uids
return 0 return 0
;; ;;
-gid) -gid)
_gids _gids
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-abstract -A -allow-lowercase \ COMPREPLY=( $( compgen -W '-abstract -A -allow-lowercase \
-allow-multidot -biblio -cache-inodes \ -allow-multidot -biblio -cache-inodes \
-no-cache-inodes -b -eltorito-alt-boot -B -G \ -no-cache-inodes -b -eltorito-alt-boot -B -G \
-hard-disk-boot -no-emul-boot -no-boot \ -hard-disk-boot -no-emul-boot -no-boot \
-boot-load-seg -boot-load-size \ -boot-load-seg -boot-load-size \
-boot-info-table -C -c -check-oldname \ -boot-info-table -C -c -check-oldname \
-check-session -copyright -d -D -dir-mode \ -check-session -copyright -d -D -dir-mode \
-dvd-video -f -file-mode -gid -gui \ -dvd-video -f -file-mode -gid -gui \
-graft-points -hide -hide-list -hidden \ -graft-points -hide -hide-list -hidden \
-hidden-list -hide-joliet -hide-joliet-list \ -hidden-list -hide-joliet -hide-joliet-list \
-hide-joliet-trans-tbl -hide-rr-moved \ -hide-joliet-trans-tbl -hide-rr-moved \
-input-charset -output-charset -iso-level -J \ -input-charset -output-charset -iso-level -J \
-joliet-long -jcharset -l -L -log-file -m \ -joliet-long -jcharset -l -L -log-file -m \
-exclude-list -max-iso9660-filenames -M -N \ -exclude-list -max-iso9660-filenames -M -N \
-new-dir-mode -nobak -no-bak -force-rr -no-rr \ -new-dir-mode -nobak -no-bak -force-rr -no-rr \
-no-split-symlink-components \ -no-split-symlink-components \
-no-split-symlink-fields -o -pad -no-pad \ -no-split-symlink-fields -o -pad -no-pad \
-path-list -P -p -print-size -quiet -R -r \ -path-list -P -p -print-size -quiet -R -r \
-relaxed-filenames -sort -split-output \ -relaxed-filenames -sort -split-output \
-stream-media-size -stream-file-name -sysid -T\ -stream-media-size -stream-file-name -sysid -T\
-table-name -ucs-level -udf -uid \ -table-name -ucs-level -udf -uid \
-use-fileversion -U -no-iso-translate -V \ -use-fileversion -U -no-iso-translate -V \
-volset -volset-size -volset-seqno -v -x -z \ -volset -volset-size -volset-seqno -v -x -z \
-hfs -apple -map -magic -hfs-creator \ -hfs -apple -map -magic -hfs-creator \
-hfs-type -probe -no-desktop -mac-name \ -hfs-type -probe -no-desktop -mac-name \
-boot-hfs-file -part -auto -cluster-size \ -boot-hfs-file -part -auto -cluster-size \
-hide-hfs -hide-hfs-list -hfs-volid \ -hide-hfs -hide-hfs-list -hfs-volid \
-icon-position -root-info -prep-boot \ -icon-position -root-info -prep-boot \
-input-hfs-charset -output-hfs-charset \ -input-hfs-charset -output-hfs-charset \
-hfs-unlock -hfs-bless -hfs-parms --cap \ -hfs-unlock -hfs-bless -hfs-parms --cap \
--netatalk --double --ethershare --ushare \ --netatalk --double --ethershare --ushare \
--exchange --sgi --xinet --macbin --single \ --exchange --sgi --xinet --macbin --single \
--dave --sfm --osx-double --osx-hfs' -- "$cur" )) --dave --sfm --osx-double --osx-hfs' -- "$cur" ))
else else
_filedir _filedir
fi fi
} && } &&
complete -F _mkisofs $filenames mkisofs genisoimage complete -F _mkisofs $filenames mkisofs genisoimage
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,55 +3,54 @@
have getent && have getent &&
_getent() _getent()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in case $prev in
passwd) passwd)
COMPREPLY=( $( compgen -u "$cur" ) ) COMPREPLY=( $( compgen -u "$cur" ) )
return 0 return 0
;; ;;
group) group)
COMPREPLY=( $( compgen -g "$cur" ) ) COMPREPLY=( $( compgen -g "$cur" ) )
return 0 return 0
;; ;;
services) services)
COMPREPLY=( $( compgen -s "$cur" ) ) COMPREPLY=( $( compgen -s "$cur" ) )
return 0 return 0
;; ;;
hosts) hosts)
COMPREPLY=( $( compgen -A hostname "$cur" ) ) COMPREPLY=( $( compgen -A hostname "$cur" ) )
return 0 return 0
;; ;;
protocols|networks|ahosts|ahostsv4|ahostsv6|rpc) protocols|networks|ahosts|ahostsv4|ahostsv6|rpc)
COMPREPLY=( $( getent "$prev" | \ COMPREPLY=( $( getent "$prev" | \
sed -ne 's|^\('"$cur"'[^[:space:]]*\).*|\1|p' ) ) sed -ne 's|^\('"$cur"'[^[:space:]]*\).*|\1|p' ) )
return 0 return 0
;; ;;
aliases|shadow) aliases|shadow)
COMPREPLY=( $( getent "$prev" | \ COMPREPLY=( $( getent "$prev" | \
sed -ne 's|^\('"$cur"'[^:]*\).*|\1|p' ) ) sed -ne 's|^\('"$cur"'[^:]*\).*|\1|p' ) )
return 0 return 0
;; ;;
esac esac
if [ $COMP_CWORD -eq 1 ]; then if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $( compgen -W 'passwd group hosts services \ COMPREPLY=( $( compgen -W 'passwd group hosts services protocols \
protocols networks ahosts ahostsv4 \ networks ahosts ahostsv4 ahostsv6 aliases ethers netgroup rpc \
ahostsv6 aliases ethers netgroup \ shadow' -- "$cur" ) )
rpc shadow' -- "$cur" ) ) fi
fi
} && } &&
complete -F _getent getent complete -F _getent getent
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,41 +3,40 @@
have gkrellm || have gkrellm2 && have gkrellm || have gkrellm2 &&
_gkrellm() _gkrellm()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-@(t|-theme)) -@(t|-theme))
_filedir -d _filedir -d
return 0 return 0
;; ;;
-@(p|-plugin)) -@(p|-plugin))
_filedir 'so' _filedir 'so'
return 0 return 0
;; ;;
-@(s|-server)) -@(s|-server))
_known_hosts_real "$cur" _known_hosts_real "$cur"
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--help -t --theme -s --server \ COMPREPLY=( $( compgen -W '--help -t --theme -s --server \
-g --geometry -wm -w --withdrawn -c --config -nc \ -g --geometry -wm -w --withdrawn -c --config -nc \
-f --force-host-config -demo -p --plugin -P \ -f --force-host-config -demo -p --plugin -P --port' -- "$cur" ) )
--port' -- "$cur" ) ) fi
fi
} && } &&
complete -F _gkrellm gkrellm gkrellm2 complete -F _gkrellm gkrellm gkrellm2
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,36 +3,35 @@
have gnatmake && have gnatmake &&
_gnatmake() _gnatmake()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
# relevant (and less relevant ;-) )options completion # relevant (and less relevant ;-) )options completion
COMPREPLY=( $( compgen -W '-a -c -f -i -j -k -m -M -n -o \ 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 \ -q -s -v -z -aL -A -aO -aI -I -I- -L -nostdinc \
-nostdlib -cargs -bargs -largs -fstack-check \ -nostdlib -cargs -bargs -largs -fstack-check \
-fno-inline -g -O1 -O0 -O2 -O3 -gnata -gnatA \ -fno-inline -g -O1 -O0 -O2 -O3 -gnata -gnatA \
-gnatb -gnatc -gnatd -gnatD -gnate -gnatE \ -gnatb -gnatc -gnatd -gnatD -gnate -gnatE \
-gnatf -gnatF -gnatg -gnatG -gnath -gnati \ -gnatf -gnatF -gnatg -gnatG -gnath -gnati \
-gnatk -gnatl -gnatL -gnatm -gnatn -gnato \ -gnatk -gnatl -gnatL -gnatm -gnatn -gnato \
-gnatO -gnatp -gnatP -gnatq -gnatR -gnats \ -gnatO -gnatp -gnatP -gnatq -gnatR -gnats \
-gnatt -gnatT -gnatu -gnatU -gnatv -gnatws \ -gnatt -gnatT -gnatu -gnatU -gnatv -gnatws \
-gnatwe -gnatwl -gnatwu -gnatW -gnatx -gnatX \ -gnatwe -gnatwl -gnatwu -gnatW -gnatx -gnatX \
-gnaty -gnatz -gnatZ -gnat83' -- "$cur" ) ) -gnaty -gnatz -gnatZ -gnat83' -- "$cur" ) )
else else
# source file completion # source file completion
_filedir '@(adb|ads)' _filedir '@(adb|ads)'
fi
fi
} && } &&
complete -F _gnatmake $filenames gnatmake complete -F _gnatmake $filenames gnatmake
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,43 +3,47 @@
have gpg && have gpg &&
_gpg() _gpg()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-@(s|-sign|-clearsign|-decrypt-files|-load-extension)) -@(s|-sign|-clearsign|-decrypt-files|-load-extension))
_filedir _filedir
return 0 return 0
;; ;;
--@(export|@(?(l|nr|nrl)sign|edit)-key)) --@(export|@(?(l|nr|nrl)sign|edit)-key))
# return list of public keys # return list of public keys
COMPREPLY=( $( compgen -W "$( gpg --list-keys 2>/dev/null | sed -ne 's@^pub.*/\([^ ]*\).*$@\1@p;s@^.*\(<\([^>]*\)>\).*$@\2@p')" -- "$cur" )) COMPREPLY=( $( compgen -W "$( gpg --list-keys 2>/dev/null | \
return 0 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" )) -@(r|-recipient))
if [ -e ~/.gnupg/gpg.conf ]; then COMPREPLY=( $( compgen -W "$( gpg --list-keys 2>/dev/null | \
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$( sed -ne 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' ~/.gnupg/gpg.conf )" -- "$cur") ) sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ))
fi if [ -e ~/.gnupg/gpg.conf ]; then
return 0 COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$( sed -ne \
;; 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' \
esac ~/.gnupg/gpg.conf )" -- "$cur") )
fi
return 0
;;
esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-s -b -e -f -c -d -a -r -u -Z -o -v\ COMPREPLY=( $( compgen -W '-s -b -e -f -c -d -a -r -u -Z -o -v\
-q -n -N $(gpg --dump-options)' -- "$cur" ) ) -q -n -N $(gpg --dump-options)' -- "$cur" ) )
fi fi
} && } &&
complete -F _gpg $default gpg complete -F _gpg $default gpg
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,47 +3,51 @@
have gpg2 && { have gpg2 && {
_gpg2 () _gpg2 ()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
--homedir) --homedir)
_filedir -d _filedir -d
return 0 return 0
;; ;;
-@(s|-sign|-clearsign|-options|-decrypt)) -@(s|-sign|-clearsign|-options|-decrypt))
_filedir _filedir
return 0 return 0
;; ;;
--@(export|@(?(l|nr|nrl)sign|edit)-key)) --@(export|@(?(l|nr|nrl)sign|edit)-key))
# return list of public keys # return list of public keys
COMPREPLY=( $( compgen -W "$( gpg2 --list-keys 2>/dev/null | sed -ne 's@^pub.*/\([^ ]*\).*$@\1@p;s@^.*\(<\([^>]*\)>\).*$@\2@p')" -- "$cur" )) COMPREPLY=( $( compgen -W "$( gpg2 --list-keys 2>/dev/null | \
return 0 sed -ne 's@^pub.*/\([^ ]*\).*$@\1@p;s@^.*\(<\([^>]*\)>\).*$@\2@p')" -- "$cur" ))
;; return 0
-@(r|-recipient)) ;;
COMPREPLY=( $( compgen -W "$( gpg2 --list-keys 2>/dev/null | sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" )) -@(r|-recipient))
if [ -e ~/.gnupg/gpg.conf ]; then COMPREPLY=( $( compgen -W "$( gpg2 --list-keys 2>/dev/null | \
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$( sed -ne 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' ~/.gnupg/gpg.conf)" -- "$cur")) sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ))
fi if [ -e ~/.gnupg/gpg.conf ]; then
return 0 COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$( sed -ne \
;; 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' \
esac ~/.gnupg/gpg.conf)" -- "$cur"))
fi
return 0
;;
esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-s -b -e -c -d -k -K -a -r -u -z -o -v \ COMPREPLY=( $( compgen -W '-s -b -e -c -d -k -K -a -r -u -z -o -v \
-n -N -i -h -R -t $(gpg2 --dump-options)' -- "$cur" ) ) -n -N -i -h -R -t $(gpg2 --dump-options)' -- "$cur" ) )
fi fi
} && } &&
complete -F _gpg2 $default gpg2 complete -F _gpg2 $default gpg2
} }
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,47 +3,46 @@
have gzip && have gzip &&
_gzip() _gzip()
{ {
local cur prev xspec helpopts local cur prev xspec helpopts
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
helpopts=`_parse_help gzip` helpopts=`_parse_help gzip`
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$helpopts -2 -3 -4 -5 -6 -7 -8" \ COMPREPLY=( $( compgen -W "$helpopts -2 -3 -4 -5 -6 -7 -8" -- "$cur" ) )
-- "$cur" ) ) return 0
return 0 fi
fi
local IFS=$'\t\n' local IFS=$'\t\n'
xspec="*.?(t)gz" xspec="*.?(t)gz"
if [[ "$prev" == --* ]]; then if [[ "$prev" == --* ]]; then
[[ "$prev" == --decompress || \ [[ "$prev" == --decompress || \
"$prev" == --list || \ "$prev" == --list || \
"$prev" == --test ]] && xspec="!"$xspec "$prev" == --test ]] && xspec="!"$xspec
[[ "$prev" == --force ]] && xspec= [[ "$prev" == --force ]] && xspec=
elif [[ "$prev" == -* ]]; then elif [[ "$prev" == -* ]]; then
[[ "$prev" == -*[dlt]* ]] && xspec="!"$xspec [[ "$prev" == -*[dlt]* ]] && xspec="!"$xspec
[[ "$prev" == -*f* ]] && xspec= [[ "$prev" == -*f* ]] && xspec=
elif [ "$prev" = '>' -o "$prev" = '>>' ]; then elif [ "$prev" = '>' -o "$prev" = '>>' ]; then
xspec= xspec=
elif [ "$prev" = '<' ]; then elif [ "$prev" = '<' ]; then
xspec= xspec=
fi fi
_expand || return 0 _expand || return 0
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) ) $( compgen -d -- "$cur" ) )
} && } &&
complete -F _gzip $filenames gzip complete -F _gzip $filenames gzip
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -1,13 +0,0 @@
# harbour completion by Dave Pearson <davep@davep.org>
# http://www.harbour-project.org/
complete -f -X '!*.@([Pp][Rr][Gg]|[Cc][Ll][Pp])' harbour gharbour hbpp
complete -f -X '!*.[Hh][Rr][Bb]' hbrun
# Local variables:
# mode: shell-script
# sh-basic-offset: 8
# sh-indent-comment: t
# indent-tabs-mode: t
# End:
# ex: ts=8 sw=8 noet filetype=sh

View File

@ -4,136 +4,131 @@ have ktutil && {
_heimdal_principals() _heimdal_principals()
{ {
COMPREPLY=( $( compgen -W "$( kadmin -l dump 2>/dev/null | \ COMPREPLY=( $( compgen -W "$( kadmin -l dump 2>/dev/null | \
awk '{print $1}' )" -- "$cur" ) ) awk '{print $1}' )" -- "$cur" ) )
} }
_heimdal_realms() _heimdal_realms()
{ {
COMPREPLY=( $( compgen -W "( kadmin -l dump 2>/dev/null | \ COMPREPLY=( $( compgen -W "( kadmin -l dump 2>/dev/null | \
awk '{print $1}' | awk -F @ '{print $2}' )" -- "$cur" ) ) awk '{print $1}' | awk -F @ '{print $2}' )" -- "$cur" ) )
} }
_heimdal_encodings() _heimdal_encodings()
{ {
COMPREPLY=( $( compgen -W 'des-cbc-mcrc des-cbc-md4 des-cbc-md5 \ COMPREPLY=( $( compgen -W 'des-cbc-mcrc des-cbc-md4 des-cbc-md5 \
des3-cbc-sha1 arcfour-hmac-md5 aes128-cts-hmac-sha1-96 \ des3-cbc-sha1 arcfour-hmac-md5 aes128-cts-hmac-sha1-96 \
aes256-cts-hmac-sha1-96' -- "$cur" ) ) aes256-cts-hmac-sha1-96' -- "$cur" ) )
} }
_ktutil() _ktutil()
{ {
local cur prev command options split=false local cur prev command options split=false
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
_split_longopt && split=true _split_longopt && split=true
case $prev in case $prev in
-p|--principal) -p|--principal)
_heimdal_principals _heimdal_principals
return 0 return 0
;; ;;
-e|--enctype) -e|--enctype)
_heimdal_encodings _heimdal_encodings
return 0 return 0
;; ;;
-a|--admin-server) -a|--admin-server)
_known_hosts_real "$cur" _known_hosts_real "$cur"
return 0 return 0
;; ;;
-r|--realm) -r|--realm)
_heimdal_realms _heimdal_realms
return 0 return 0
;; ;;
-@(s|k|-@(srv|key)tab)) -@(s|k|-@(srv|key)tab))
_filedir _filedir
return 0 return 0
;; ;;
esac esac
$split && return 0 $split && return 0
commands='add change copy get list remove rename purge srvconvert \ commands='add change copy get list remove rename purge srvconvert \
srv2keytab srvcreate key2srvtab' srv2keytab srvcreate key2srvtab'
for (( i=1; i < COMP_CWORD; i++ )); do for (( i=1; i < COMP_CWORD; i++ )); do
case ${COMP_WORDS[i]} in case ${COMP_WORDS[i]} in
-@(k|-keytab)) -@(k|-keytab))
i=$(($i+1)) i=$(($i+1))
;; ;;
-*) -*)
;; ;;
*) *)
command=${COMP_WORDS[i]} command=${COMP_WORDS[i]}
break break
;; ;;
esac esac
done done
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
case $command in case $command in
add) add)
options='-p --principal -V -e --enctype -w \ options='-p --principal -V -e --enctype -w --password -r \
--password -r --random -s --no-salt \ --random -s --no-salt -h --hex'
-h --hex' ;;
;; change)
change) options='-r --realm -a --admin-server -s --server-port'
options='-r --realm -a --admin-server -s \ ;;
--server-port' get)
;; options='-p --principal -e --enctype -r --realm -a \
get) --admin-server -s server --server-port'
options='-p --principal -e --enctype -r \ ;;
--realm -a --admin-server -s server \ list)
--server-port' options='--keys --timestamp'
;; ;;
list) remove)
options='--keys --timestamp' options='-p --principal -V --kvno -e --enctype'
;; ;;
remove) purge)
options='-p --principal -V --kvno -e --enctype' options='--age'
;; ;;
purge) @(srv2keytab|key2srvtab))
options='--age' options='-s --srvtab'
;; ;;
@(srv2keytab|key2srvtab)) *)
options='-s --srvtab' options='-k --keytab -v --verbose --version -v --help'
;; ;;
*) esac
options='-k --keytab -v --verbose --version \ COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
-v --help' else
;; case $command in
esac copy)
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) _filedir
else ;;
case $command in get)
copy) _heimdal_principals
_filedir ;;
;; rename)
get) _heimdal_principals
_heimdal_principals ;;
;; *)
rename) COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) )
_heimdal_principals ;;
;; esac
*) fi
COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) )
;;
esac
fi
} }
complete -F _ktutil ktutil complete -F _ktutil ktutil
} }
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,33 +3,33 @@
have iconv && have iconv &&
_iconv() _iconv()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-@(f|t|-@(from|to)-code)) -@(f|t|-@(from|to)-code))
COMPREPLY=( $( compgen -W \ COMPREPLY=( $( compgen -W \
'$( iconv --list | sed -e "s@//@@;" )' -- "$cur" ) ) '$( iconv --list | sed -e "s@//@@;" )' -- "$cur" ) )
return 0 return 0
;; ;;
esac esac
if [[ "$cur" = -* ]]; then if [[ "$cur" = -* ]]; then
COMPREPLY=( $( compgen -W '--from-code -f --to-code -t --list COMPREPLY=( $( compgen -W '--from-code -f --to-code -t --list
--output -o --verbose' -- "$cur" ) ) --output -o --verbose' -- "$cur" ) )
return 0 return 0
fi fi
} && } &&
complete -F _iconv $default iconv complete -F _iconv $default iconv
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,541 +3,530 @@
have convert && { have convert && {
_ImageMagick() _ImageMagick()
{ {
local prev local prev
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-channel) -channel)
COMPREPLY=( $( compgen -W 'Red Green Blue Opacity \ COMPREPLY=( $( compgen -W 'Red Green Blue Opacity \
Matte Cyan Magenta Yellow Black' -- "$cur" ) ) Matte Cyan Magenta Yellow Black' -- "$cur" ) )
return 0 return 0
;; ;;
-colormap) -colormap)
COMPREPLY=( $( compgen -W 'shared private' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'shared private' -- "$cur" ) )
return 0 return 0
;; ;;
-colorspace) -colorspace)
COMPREPLY=( $( compgen -W 'GRAY OHTA RGB Transparent \ COMPREPLY=( $( compgen -W 'GRAY OHTA RGB Transparent \
XYZ YCbCr YIQ YPbPr YUV CMYK' -- "$cur" ) ) XYZ YCbCr YIQ YPbPr YUV CMYK' -- "$cur" ) )
return 0 return 0
;; ;;
-compose) -compose)
COMPREPLY=( $( compgen -W 'Over In Out Atop Xor Plus \ COMPREPLY=( $( compgen -W 'Over In Out Atop Xor Plus \
Minus Add Subtract Difference Multiply Bumpmap\ Minus Add Subtract Difference Multiply Bumpmap\
Copy CopyRed CopyGreen CopyBlue CopyOpacity' \ Copy CopyRed CopyGreen CopyBlue CopyOpacity' -- "$cur" ) )
-- "$cur" ) ) return 0
return 0 ;;
;; -compress)
-compress) COMPREPLY=( $( compgen -W 'None BZip Fax Group4 JPEG \
COMPREPLY=( $( compgen -W 'None BZip Fax Group4 JPEG \ Lossless LZW RLE Zip' -- "$cur" ) )
Lossless LZW RLE Zip' -- "$cur" ) ) return 0
return 0 ;;
;; -dispose)
-dispose) COMPREPLY=( $( compgen -W 'Undefined None Background Previous' \
COMPREPLY=( $( compgen -W 'Undefined None Background \ -- "$cur" ) )
Previous' -- "$cur" ) ) return 0
return 0 ;;
;; -encoding)
-encoding) COMPREPLY=( $( compgen -W 'AdobeCustom AdobeExpert \
COMPREPLY=( $( compgen -W 'AdobeCustom AdobeExpert \ AdobeStandard AppleRoman BIG5 GB2312 Latin2 \
AdobeStandard AppleRoman BIG5 GB2312 Latin2 \ None SJIScode Symbol Unicode Wansung' -- "$cur"))
None SJIScode Symbol Unicode Wansung' -- "$cur")) return 0
return 0 ;;
;; -endian)
-endian) COMPREPLY=( $( compgen -W 'MSB LSB' -- "$cur" ) )
COMPREPLY=( $( compgen -W 'MSB LSB' -- "$cur" ) ) return 0
return 0 ;;
;; -filter)
-filter) COMPREPLY=( $( compgen -W 'Point Box Triangle Hermite \
COMPREPLY=( $( compgen -W 'Point Box Triangle Hermite \ Hanning Hamming Blackman Gaussian Quadratic \
Hanning Hamming Blackman Gaussian Quadratic \ Cubic Catrom Mitchell Lanczos Bessel Sinc' -- "$cur" ) )
Cubic Catrom Mitchell Lanczos Bessel Sinc' \ return 0
-- "$cur" ) ) ;;
return 0 -format)
;; COMPREPLY=( $( compgen -W "$( convert -list format | \
-format) awk '/ [r-][w-][+-] / {print $1}' | \
COMPREPLY=( $( compgen -W "$( convert -list format | \ tr -d '*' | tr [:upper:] [:lower:] )" -- "$cur" ) )
awk '/ [r-][w-][+-] / {print $1}' | \ return 0
tr -d '*' | tr [:upper:] [:lower:] )" \ ;;
-- "$cur" ) ) -gravity)
return 0 COMPREPLY=( $( compgen -W 'Northwest North NorthEast \
;; West Center East SouthWest South SouthEast' -- "$cur" ) )
-gravity) return 0
COMPREPLY=( $( compgen -W 'Northwest North NorthEast \ ;;
West Center East SouthWest South SouthEast' \ -intent)
-- "$cur" ) ) COMPREPLY=( $( compgen -W 'Absolute Perceptual \
return 0 Relative Saturation' -- "$cur" ) )
;; return 0
-intent) ;;
COMPREPLY=( $( compgen -W 'Absolute Perceptual \ -interlace)
Relative Saturation' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'None Line Plane Partition' -- "$cur" ) )
return 0 return 0
;; ;;
-interlace) -limit)
COMPREPLY=( $( compgen -W 'None Line Plane Partition' \ COMPREPLY=( $( compgen -W 'Disk File Map Memory' -- "$cur" ) )
-- "$cur" ) ) return 0
return 0 ;;
;; -list)
-limit) COMPREPLY=( $( compgen -W 'Delegate Format Magic Module Resource \
COMPREPLY=( $( compgen -W 'Disk File Map Memory' \ Type' -- "$cur" ) )
-- "$cur" ) ) return 0
return 0 ;;
;; -map)
-list) COMPREPLY=( $( compgen -W 'best default gray red green blue' \
COMPREPLY=( $( compgen -W 'Delegate Format Magic \ -- "$cur" ) )
Module Resource Type' -- "$cur" ) ) _filedir
return 0 return 0
;; ;;
-map) -noise)
COMPREPLY=( $( compgen -W 'best default gray red \ COMPREPLY=( $( compgen -W 'Uniform Gaussian Multiplicative \
green blue' -- "$cur" ) ) Impulse Laplacian Poisson' -- "$cur" ) )
_filedir return 0
return 0 ;;
;; -preview)
-noise) COMPREPLY=( $( compgen -W 'Rotate Shear Roll Hue \
COMPREPLY=( $( compgen -W 'Uniform Gaussian \ Saturation Brightness Gamma Spiff \
Multiplicative \ Dull Grayscale Quantize Despeckle \
Impulse Laplacian Poisson' -- "$cur" ) ) ReduceNoise AddNoise Sharpen Blur \
return 0 Treshold EdgeDetect Spread Shade \
;; Raise Segment Solarize Swirl Implode \
-preview) Wave OilPaint CharcoalDrawing JPEG' -- "$cur" ) )
COMPREPLY=( $( compgen -W 'Rotate Shear Roll Hue \ return 0
Saturation Brightness Gamma Spiff \ ;;
Dull Grayscale Quantize Despeckle \ -@(mask|profile|texture|tile|write))
ReduceNoise AddNoise Sharpen Blur \ _filedir
Treshold EdgeDetect Spread Shade \ return 0
Raise Segment Solarize Swirl Implode \ ;;
Wave OilPaint CharcoalDrawing JPEG' \ -type)
-- "$cur" ) ) COMPREPLY=( $( compgen -W 'Bilevel Grayscale Palette PaletteMatte \
return 0 TrueColor TrueColorMatte ColorSeparation ColorSeparationlMatte \
;; Optimize' -- "$cur" ) )
-@(mask|profile|texture|tile|write)) return 0
_filedir ;;
return 0 -units)
;; COMPREPLY=( $( compgen -W 'Undefined PixelsPerInch \
-type) PixelsPerCentimeter' -- "$cur" ) )
COMPREPLY=( $( compgen -W 'Bilevel Grayscale Palette \ return 0
PaletteMatte TrueColor TrueColorMatte \ ;;
ColorSeparation ColorSeparationlMatte \ -virtual-pixel)
Optimize' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'Constant Edge mirror tile' -- "$cur" ) )
return 0 return 0
;; ;;
-units) -visual)
COMPREPLY=( $( compgen -W 'Undefined PixelsPerInch \ COMPREPLY=( $( compgen -W 'StaticGray GrayScale StaticColor \
PixelsPerCentimeter' -- "$cur" ) ) PseudoColor TrueColor DirectColor defaut visualid' -- "$cur" ))
return 0 return 0
;; ;;
-virtual-pixel) esac
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
} }
_convert() _convert()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
_ImageMagick _ImageMagick
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-adaptive-blur -adaptive-resize \ COMPREPLY=( $( compgen -W '-adaptive-blur -adaptive-resize \
-adaptive-sharpen -adjoin -affine -alpha -annotate \ -adaptive-sharpen -adjoin -affine -alpha -annotate \
-antialias -append -attenuate -authenticate \ -antialias -append -attenuate -authenticate \
-auto-orient -average -background -bench -bias \ -auto-orient -average -background -bench -bias \
-black-point-compensation -black-threshold \ -black-point-compensation -black-threshold \
-blue-primary -blur -border -bordercolor -caption \ -blue-primary -blur -border -bordercolor -caption \
-channel -charcoal -chop -clip -clip-mask -clip-path \ -channel -charcoal -chop -clip -clip-mask -clip-path \
-clone -clut -coalesce -colorize -colors -colorspace \ -clone -clut -coalesce -colorize -colors -colorspace \
-combine -comment -compose -composite -compress \ -combine -comment -compose -composite -compress \
-contrast -contrast-stretch -convolve -crop -cycle \ -contrast -contrast-stretch -convolve -crop -cycle \
-debug -decipher -deconstruct -define -delay -delete \ -debug -decipher -deconstruct -define -delay -delete \
-density -depth -despeckle -display -dispose -distort \ -density -depth -despeckle -display -dispose -distort \
-dither -draw -edge -emboss -encipher -encoding \ -dither -draw -edge -emboss -encipher -encoding \
-endian -enhance -equalize -evaluate -extent -extract \ -endian -enhance -equalize -evaluate -extent -extract \
-family -fill -filter -flatten -flip -floodfill -flop \ -family -fill -filter -flatten -flip -floodfill -flop \
-font -format -frame -fuzz -fx -gamma -gaussian-blur \ -font -format -frame -fuzz -fx -gamma -gaussian-blur \
-geometry -gravity -green-primary -help -identify \ -geometry -gravity -green-primary -help -identify \
-implode -insert -intent -interlace -interpolate \ -implode -insert -intent -interlace -interpolate \
-label -lat -layers -level -limit -linear-stretch \ -label -lat -layers -level -limit -linear-stretch \
-liquid-rescale -list -log -loop -map -mask \ -liquid-rescale -list -log -loop -map -mask \
-mattecolor -median -modulate -monitor -monochrome \ -mattecolor -median -modulate -monitor -monochrome \
-morph -mosaic -motion-blur -negate -noise -normalize \ -morph -mosaic -motion-blur -negate -noise -normalize \
-opaque -ordered-dither -orient -page -paint -ping \ -opaque -ordered-dither -orient -page -paint -ping \
-pointsize -polaroid -posterize -preview -print \ -pointsize -polaroid -posterize -preview -print \
-process -profile -quality -quantize -quiet \ -process -profile -quality -quantize -quiet \
-radial-blur -raise -random-threshold -recolor \ -radial-blur -raise -random-threshold -recolor \
-red-primary -regard-warnings -region -render -repage \ -red-primary -regard-warnings -region -render -repage \
-resample -resize -respect-parenthesis -reverse -roll \ -resample -resize -respect-parenthesis -reverse -roll \
-rotate -sample -sampling-factor -scale -scene -seed \ -rotate -sample -sampling-factor -scale -scene -seed \
-segment -separate -sepia-tone -set -shade -shadow \ -segment -separate -sepia-tone -set -shade -shadow \
-sharpen -shave -shear -sigmoidal-contrast -size \ -sharpen -shave -shear -sigmoidal-contrast -size \
-sketch -solarize -splice -spread -stretch -strip \ -sketch -solarize -splice -spread -stretch -strip \
-stroke -strokewidth -style -swap -swirl -taint \ -stroke -strokewidth -style -swap -swirl -taint \
-texture -threshold -thumbnail -tile -tile-offset \ -texture -threshold -thumbnail -tile -tile-offset \
-tint -transform -transparent -transparent-color \ -tint -transform -transparent -transparent-color \
-transpose -transverse -treedepth -trim -type \ -transpose -transverse -treedepth -trim -type \
-undercolor -unique-colors -units -unsharp -verbose \ -undercolor -unique-colors -units -unsharp -verbose \
-version -view -vignette -virtual-pixel -wave \ -version -view -vignette -virtual-pixel -wave \
-weight -white-point -white-threshold \ -weight -white-point -white-threshold \
-write' -- "$cur" ) ) -write' -- "$cur" ) )
elif [[ "$cur" == +* ]]; then elif [[ "$cur" == +* ]]; then
COMPREPLY=( $( compgen -W '+adjoin +append +compress \ COMPREPLY=( $( compgen -W '+adjoin +append +compress \
+contrast +debug +dither +endian +gamma +label +map \ +contrast +debug +dither +endian +gamma +label +map \
+mask +matte +negate +noise +page +raise +render \ +mask +matte +negate +noise +page +raise +render \
+write' -- "$cur" ) ) +write' -- "$cur" ) )
else else
_filedir _filedir
fi fi
} }
complete -F _convert $filenames convert complete -F _convert $filenames convert
_mogrify() _mogrify()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
_ImageMagick _ImageMagick
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-adaptive-blur -adaptive-resize \ COMPREPLY=( $( compgen -W '-adaptive-blur -adaptive-resize \
-adaptive-sharpen -adjoin -affine -alpha -annotate \ -adaptive-sharpen -adjoin -affine -alpha -annotate \
-antialias -attenuate -authenticate -auto-orient \ -antialias -attenuate -authenticate -auto-orient \
-background -bias -black-point-compensation \ -background -bias -black-point-compensation \
-black-threshold -blue-primary -blur -border \ -black-threshold -blue-primary -blur -border \
-bordercolor -caption -channel -charcoal -chop -clip \ -bordercolor -caption -channel -charcoal -chop -clip \
-clip-mask -clip-path -clut -colorize -colors \ -clip-mask -clip-path -clut -colorize -colors \
-colorspace -comment -compose -compress -contrast \ -colorspace -comment -compose -compress -contrast \
-contrast-stretch -convolve -cycle -debug -decipher \ -contrast-stretch -convolve -cycle -debug -decipher \
-define -delay -density -depth -despeckle -display \ -define -delay -density -depth -despeckle -display \
-dispose -distort -dither -draw -edge -emboss \ -dispose -distort -dither -draw -edge -emboss \
-encipher -encoding -endian -enhance -equalize \ -encipher -encoding -endian -enhance -equalize \
-evaluate -extent -extract -family -fill -filter \ -evaluate -extent -extract -family -fill -filter \
-flip -floodfill -flop -font -format -frame -fuzz \ -flip -floodfill -flop -font -format -frame -fuzz \
-gamma -gaussian-blur -geometry -gravity \ -gamma -gaussian-blur -geometry -gravity \
-green-primary -help -identify -implode -intent \ -green-primary -help -identify -implode -intent \
-interlace -interpolate -label -lat -layers -level \ -interlace -interpolate -label -lat -layers -level \
-limit -linear-stretch -liquid-rescale -list -log \ -limit -linear-stretch -liquid-rescale -list -log \
-loop -mask -mattecolor -median -modulate -monitor \ -loop -mask -mattecolor -median -modulate -monitor \
-monochrome -motion-blur -negate -noise -normalize \ -monochrome -motion-blur -negate -noise -normalize \
-opaque -ordered-dither -orient -page -paint -path \ -opaque -ordered-dither -orient -page -paint -path \
-ping -pointsize -polaroid -posterize -preview -print \ -ping -pointsize -polaroid -posterize -preview -print \
-profile -quality -quantize -quiet -radial-blur \ -profile -quality -quantize -quiet -radial-blur \
-raise -random-threshold -recolor -red-primary \ -raise -random-threshold -recolor -red-primary \
-regard-warnings -region -render -repage -resample \ -regard-warnings -region -render -repage -resample \
-resize -roll -rotate -sample -sampling-factor -scale \ -resize -roll -rotate -sample -sampling-factor -scale \
-scene -seed -segment -sepia-tone -set -shade -shadow \ -scene -seed -segment -sepia-tone -set -shade -shadow \
-sharpen -shave -shear -sigmoidal-contrast -size \ -sharpen -shave -shear -sigmoidal-contrast -size \
-sketch -solarize -splice -spread -stretch -strip \ -sketch -solarize -splice -spread -stretch -strip \
-stroke -strokewidth -style -swirl -taint -texture \ -stroke -strokewidth -style -swirl -taint -texture \
-threshold -thumbnail -tile -tile-offset -tint \ -threshold -thumbnail -tile -tile-offset -tint \
-transform -transparent -transparent-color -transpose \ -transform -transparent -transparent-color -transpose \
-transverse -treedepth -trim -type -undercolor \ -transverse -treedepth -trim -type -undercolor \
-unique-colors -units -unsharp -verbose -version \ -unique-colors -units -unsharp -verbose -version \
-view -vignette -virtual-pixel -wave -weight \ -view -vignette -virtual-pixel -wave -weight \
-white-point -white-threshold' -- "$cur" ) ) -white-point -white-threshold' -- "$cur" ) )
elif [[ "$cur" == +* ]]; then elif [[ "$cur" == +* ]]; then
COMPREPLY=( $( compgen -W '+compress +contrast +debug +dither \ COMPREPLY=( $( compgen -W '+compress +contrast +debug +dither \
+endian +gamma +label +map +mask +matte +negate +page \ +endian +gamma +label +map +mask +matte +negate +page \
+raise' -- "$cur" ) ) +raise' -- "$cur" ) )
else else
_filedir _filedir
fi fi
} }
complete -F _mogrify $filenames mogrify complete -F _mogrify $filenames mogrify
_display() _display()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
_ImageMagick _ImageMagick
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-alpha -antialias -authenticate \ COMPREPLY=( $( compgen -W '-alpha -antialias -authenticate \
-auto-orient -backdrop -background -border \ -auto-orient -backdrop -background -border \
-bordercolor -borderwidth -channel -clip \ -bordercolor -borderwidth -channel -clip \
-clip-path -coalesce -colormap -colors -colorspace \ -clip-path -coalesce -colormap -colors -colorspace \
-comment -compress -contrast -crop -debug -decipher \ -comment -compress -contrast -crop -debug -decipher \
-define -delay -density -depth -despeckle -display \ -define -delay -density -depth -despeckle -display \
-dispose -dither -edge -endian -enhance -extract \ -dispose -dither -edge -endian -enhance -extract \
-filter -flatten -flip -flop -font -foreground \ -filter -flatten -flip -flop -font -foreground \
-format -frame -gamma -geometry -help -iconGeometry \ -format -frame -gamma -geometry -help -iconGeometry \
-iconic -identify -immutable -interlace -interpolate \ -iconic -identify -immutable -interlace -interpolate \
-label -limit -list -log -loop -map -mattecolor \ -label -limit -list -log -loop -map -mattecolor \
-monitor -monochrome -name -negate -page -profile \ -monitor -monochrome -name -negate -page -profile \
-quality -quantize -quiet -raise -regard-warnings \ -quality -quantize -quiet -raise -regard-warnings \
-remote -repage -resample -resize \ -remote -repage -resample -resize \
-respect-parenthesis -roll -rotate -sample \ -respect-parenthesis -roll -rotate -sample \
-sampling-factor -scenes -seed -segment -set \ -sampling-factor -scenes -seed -segment -set \
-shared-memory -sharpen -size -strip -texture -title \ -shared-memory -sharpen -size -strip -texture -title \
-transparent-color -treedepth -trim -update \ -transparent-color -treedepth -trim -update \
-usePixmap -verbose -version -virtual-pixel -visual \ -usePixmap -verbose -version -virtual-pixel -visual \
-window -window-group -write' -- "$cur" ) ) -window -window-group -write' -- "$cur" ) )
elif [[ "$cur" == +* ]]; then elif [[ "$cur" == +* ]]; then
COMPREPLY=( $( compgen -W '+compress +contrast +debug +dither \ COMPREPLY=( $( compgen -W '+compress +contrast +debug +dither \
+endian +gamma +label +map +matte +negate +page \ +endian +gamma +label +map +matte +negate +page \
+raise +write' -- "$cur" ) ) +raise +write' -- "$cur" ) )
else else
_filedir _filedir
fi fi
} }
complete -F _display $filenames display complete -F _display $filenames display
_animate() _animate()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
_ImageMagick _ImageMagick
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-alpha -authenticate -backdrop \ COMPREPLY=( $( compgen -W '-alpha -authenticate -backdrop \
-background -bordercolor -borderwidth -channel \ -background -bordercolor -borderwidth -channel \
-coalesce -colormap -colors -colorspace -crop -debug \ -coalesce -colormap -colors -colorspace -crop -debug \
-decipher -define -delay -density -depth -display \ -decipher -define -delay -density -depth -display \
-dispose -dither -extract -filter -flatten -font \ -dispose -dither -extract -filter -flatten -font \
-foreground -format -gamma -geometry -help \ -foreground -format -gamma -geometry -help \
-iconGeometry -iconic -identify -immutable -interlace \ -iconGeometry -iconic -identify -immutable -interlace \
-interpolate -limit -list -log -loop -map -mattecolor \ -interpolate -limit -list -log -loop -map -mattecolor \
-mattecolor -monitor -monochrome -name -page -pause \ -mattecolor -monitor -monochrome -name -page -pause \
-quantize -quiet -regard-warnings -remote -repage \ -quantize -quiet -regard-warnings -remote -repage \
-resample -resize -respect-parenthesis -rotate \ -resample -resize -respect-parenthesis -rotate \
-sampling-factor -scenes -seed -set -shared-memory \ -sampling-factor -scenes -seed -set -shared-memory \
-size -strip -title -transparent-color -treedepth \ -size -strip -title -transparent-color -treedepth \
-trim -verbose -version -virtual-pixel -visual \ -trim -verbose -version -virtual-pixel -visual \
-window' -- "$cur" ) ) -window' -- "$cur" ) )
elif [[ "$cur" == +* ]]; then elif [[ "$cur" == +* ]]; then
COMPREPLY=( $( compgen -W '+debug +dither +gamma +map +matte' -- "$cur" ) ) COMPREPLY=( $( compgen -W '+debug +dither +gamma +map +matte' \
else -- "$cur" ) )
_filedir else
fi _filedir
fi
} }
complete -F _animate $filenames animate complete -F _animate $filenames animate
_identify() _identify()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
_ImageMagick _ImageMagick
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-alpha -antialias -authenticate \ COMPREPLY=( $( compgen -W '-alpha -antialias -authenticate \
-channel -colorspace -crop -debug -define -density \ -channel -colorspace -crop -debug -define -density \
-depth -extract -format -fuzz -gamma -help -interlace \ -depth -extract -format -fuzz -gamma -help -interlace \
-interpolate -limit -list -log -monitor -ping -quiet \ -interpolate -limit -list -log -monitor -ping -quiet \
-regard-warnings -respect-parenthesis \ -regard-warnings -respect-parenthesis \
-sampling-factor -seed -set -size -strip -units \ -sampling-factor -seed -set -size -strip -units \
-verbose -version -virtual-pixel' -- "$cur" ) ) -verbose -version -virtual-pixel' -- "$cur" ) )
elif [[ "$cur" == +* ]]; then elif [[ "$cur" == +* ]]; then
COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) ) COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) )
else else
_filedir _filedir
fi fi
} }
complete -F _identify $filenames identify complete -F _identify $filenames identify
_montage() _montage()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
_ImageMagick _ImageMagick
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-adjoin -affine -alpha \ COMPREPLY=( $( compgen -W '-adjoin -affine -alpha \
-authenticate -background -blue-primary -blur -border \ -authenticate -background -blue-primary -blur -border \
-bordercolor -borderwidth -caption -channel -clone \ -bordercolor -borderwidth -caption -channel -clone \
-coalesce -colors -colorspace -comment -compose \ -coalesce -colors -colorspace -comment -compose \
-compress -crop -debug -define -density -depth \ -compress -crop -debug -define -density -depth \
-display -dispose -dither -draw -encoding -endian \ -display -dispose -dither -draw -encoding -endian \
-extract -fill -filter -flatten -flip -flop -font \ -extract -fill -filter -flatten -flip -flop -font \
-format -frame -gamma -geometry -gravity \ -format -frame -gamma -geometry -gravity \
-green-primary -help -identify -interlace \ -green-primary -help -identify -interlace \
-interpolate -label -limit -list -log -mattecolor \ -interpolate -label -limit -list -log -mattecolor \
-mode -monitor -monochrome -origin -page -pointsize \ -mode -monitor -monochrome -origin -page -pointsize \
-polaroid -profile -quality -quantize -quiet \ -polaroid -profile -quality -quantize -quiet \
-red-primary -regard-warnings -repage -resize \ -red-primary -regard-warnings -repage -resize \
-respect-parenthesis -rotate -sampling-factor -scenes \ -respect-parenthesis -rotate -sampling-factor -scenes \
-seed -set -shadow -size -strip -stroke -texture \ -seed -set -shadow -size -strip -stroke -texture \
-thumbnail -tile -title -transform -transparent \ -thumbnail -tile -title -transform -transparent \
-transparent-color -treedepth -trim -type -units \ -transparent-color -treedepth -trim -type -units \
-verbose -version -virtual-pixel \ -verbose -version -virtual-pixel \
-white-point' -- "$cur" ) ) -white-point' -- "$cur" ) )
elif [[ "$cur" == +* ]]; then elif [[ "$cur" == +* ]]; then
COMPREPLY=( $( compgen -W '+adjoin +compress +debug +dither \ COMPREPLY=( $( compgen -W '+adjoin +compress +debug +dither \
+endian +gamma +label +matte +page' -- "$cur" ) ) +endian +gamma +label +matte +page' -- "$cur" ) )
else else
_filedir _filedir
fi fi
} }
complete -F _montage $filenames montage complete -F _montage $filenames montage
_composite() _composite()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
_ImageMagick _ImageMagick
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-affine -alpha -authenticate \ COMPREPLY=( $( compgen -W '-affine -alpha -authenticate \
-blend -blue-primary -border -bordercolor -channel \ -blend -blue-primary -border -bordercolor -channel \
-colors -colorspace -comment -compose -compress \ -colors -colorspace -comment -compose -compress \
-debug -decipher -define -density -depth -displace \ -debug -decipher -define -density -depth -displace \
-display -dispose -dissolve -dither -encipher \ -display -dispose -dissolve -dither -encipher \
-encoding -endian -extract -filter -font -format \ -encoding -endian -extract -filter -font -format \
-geometry -gravity -green-primary -help -identify \ -geometry -gravity -green-primary -help -identify \
-interlace -interpolate -label -limit -list -log \ -interlace -interpolate -label -limit -list -log \
-monitor -monochrome -negate -page -profile -quality \ -monitor -monochrome -negate -page -profile -quality \
-quantize -quiet -red-primary -regard-warnings \ -quantize -quiet -red-primary -regard-warnings \
-repage -resize -respect-parenthesis -rotate \ -repage -resize -respect-parenthesis -rotate \
-sampling-factor -scene -seed -sharpen -shave -size \ -sampling-factor -scene -seed -sharpen -shave -size \
-stegano -stereo -strip -swap -thumbnail -tile \ -stegano -stereo -strip -swap -thumbnail -tile \
-transform -transparent-color -treedepth -type -units \ -transform -transparent-color -treedepth -type -units \
-unsharp -verbose -version -virtual-pixel -watermark \ -unsharp -verbose -version -virtual-pixel -watermark \
-white-point -write' -- "$cur" ) ) -white-point -write' -- "$cur" ) )
elif [[ "$cur" == +* ]]; then elif [[ "$cur" == +* ]]; then
COMPREPLY=( $( compgen -W '+compress +debug +dither +endian +label \ COMPREPLY=( $( compgen -W '+compress +debug +dither +endian +label \
+matte +negate +page +write' -- "$cur" ) ) +matte +negate +page +write' -- "$cur" ) )
else else
_filedir _filedir
fi fi
} }
complete -F _composite $filenames composite complete -F _composite $filenames composite
_compare() _compare()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
_ImageMagick _ImageMagick
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-alpha -authenticate -channel \ COMPREPLY=( $( compgen -W '-alpha -authenticate -channel \
-colorspace -compress -debug -decipher -define \ -colorspace -compress -debug -decipher -define \
-density -depth -encipher -extract -format -fuzz \ -density -depth -encipher -extract -format -fuzz \
-help -highlight-color -identify -interlace -limit \ -help -highlight-color -identify -interlace -limit \
-list -log -metric -monitor -passphrase -profile \ -list -log -metric -monitor -passphrase -profile \
-quality -quantize -quiet -regard-warnings \ -quality -quantize -quiet -regard-warnings \
-respect-parenthesis -sampling-factor -seed -set \ -respect-parenthesis -sampling-factor -seed -set \
-size -transparent-color -type -verbose -version \ -size -transparent-color -type -verbose -version \
-virtual-pixel' -- "$cur" ) ) -virtual-pixel' -- "$cur" ) )
elif [[ "$cur" == +* ]]; then elif [[ "$cur" == +* ]]; then
COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) ) COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) )
else else
_filedir _filedir
fi fi
} }
complete -F _compare $filenames compare complete -F _compare $filenames compare
_conjure() _conjure()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
_ImageMagick _ImageMagick
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-debug -help -list -log -monitor \ COMPREPLY=( $( compgen -W '-debug -help -list -log -monitor -quiet \
-quiet -regard-warnings -seed -verbose \ -regard-warnings -seed -verbose -version' -- "$cur" ) )
-version' -- "$cur" ) ) elif [[ "$cur" == +* ]]; then
elif [[ "$cur" == +* ]]; then COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) )
COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) ) else
else _filedir
_filedir fi
fi
} }
complete -F _conjure $filenames conjure complete -F _conjure $filenames conjure
_import() _import()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
_ImageMagick _ImageMagick
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-adjoin -annotate -border -channel \ COMPREPLY=( $( compgen -W '-adjoin -annotate -border -channel \
-colors -colorspace -comment -compress -crop -debug \ -colors -colorspace -comment -compress -crop -debug \
-define -delay -density -depth -descend -display \ -define -delay -density -depth -descend -display \
-dispose -dither -encipher -encoding -endian -filter \ -dispose -dither -encipher -encoding -endian -filter \
-format -frame -geometry -gravity -help -identify \ -format -frame -geometry -gravity -help -identify \
-interlace -interpolate -label -limit -list -log \ -interlace -interpolate -label -limit -list -log \
-monitor -monochrome -negate -page -pause -pointsize \ -monitor -monochrome -negate -page -pause -pointsize \
-quality -quantize -quiet -regard-warnings -repage \ -quality -quantize -quiet -regard-warnings -repage \
-resize -respect-parenthesis -rotate -sampling-factor \ -resize -respect-parenthesis -rotate -sampling-factor \
-scene -screen -seed -set -silent -snaps -strip \ -scene -screen -seed -set -silent -snaps -strip \
-thumbnail -transparent -transparent-color -treedepth \ -thumbnail -transparent -transparent-color -treedepth \
-trim -type -verbose -version -virtual-pixel \ -trim -type -verbose -version -virtual-pixel \
-window' -- "$cur" ) ) -window' -- "$cur" ) )
elif [[ "$cur" == +* ]]; then elif [[ "$cur" == +* ]]; then
COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) ) COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) )
else else
_filedir _filedir
fi fi
} }
complete -F _import $filenames import complete -F _import $filenames import
_stream() _stream()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
_ImageMagick _ImageMagick
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-authenticate -channel -colorspace \ COMPREPLY=( $( compgen -W '-authenticate -channel -colorspace \
-compress -debug -define -density -depth -extract \ -compress -debug -define -density -depth -extract \
-help -identify -interlace -interpolate -limit -list \ -help -identify -interlace -interpolate -limit -list \
-log -map -monitor -quantize -quiet -regard-warnings \ -log -map -monitor -quantize -quiet -regard-warnings \
-respect-parenthesis -sampling-factor -seed -set \ -respect-parenthesis -sampling-factor -seed -set \
-size -storage-type -transparent-color -verbose \ -size -storage-type -transparent-color -verbose \
-version -virtual-pixel' -- "$cur" ) ) -version -virtual-pixel' -- "$cur" ) )
elif [[ "$cur" == +* ]]; then elif [[ "$cur" == +* ]]; then
COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) ) COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) )
else else
_filedir _filedir
fi fi
} }
complete -F _stream $filenames stream complete -F _stream $filenames stream
} }
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,56 +3,56 @@
have info && have info &&
_info() _info()
{ {
local cur i infopath local cur i infopath
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
_expand || return 0 _expand || return 0
# default completion if parameter contains / # default completion if parameter contains /
if [[ "$cur" == */* ]]; then if [[ "$cur" == */* ]]; then
_filedir _filedir
return 0 return 0
fi fi
infopath='/usr/share/info' infopath='/usr/share/info'
if [ "${INFOPATH: -1:1}" == ':' ]; then if [ "${INFOPATH: -1:1}" == ':' ]; then
infopath=${INFOPATH}${infopath} infopath=${INFOPATH}${infopath}
elif [ ${INFOPATH:+set} ]; then elif [ ${INFOPATH:+set} ]; then
infopath=$INFOPATH infopath=$INFOPATH
fi fi
infopath=$infopath: infopath=$infopath:
if [ -n "$cur" ]; then if [ -n "$cur" ]; then
infopath="${infopath//://$cur* }" infopath="${infopath//://$cur* }"
else else
infopath="${infopath//:// }" infopath="${infopath//:// }"
fi fi
# redirect stderr for when path doesn't exist # redirect stderr for when path doesn't exist
COMPREPLY=( $( eval command ls "$infopath" 2>/dev/null ) ) COMPREPLY=( $( eval command ls "$infopath" 2>/dev/null ) )
# weed out directory path names and paths to info pages # weed out directory path names and paths to info pages
COMPREPLY=( ${COMPREPLY[@]##*/?(:)} ) COMPREPLY=( ${COMPREPLY[@]##*/?(:)} )
# weed out info dir file # weed out info dir file
for (( i=0 ; i < ${#COMPREPLY[@]} ; ++i )); do for (( i=0 ; i < ${#COMPREPLY[@]} ; ++i )); do
if [ "${COMPREPLY[$i]}" == 'dir' ]; then if [ "${COMPREPLY[$i]}" == 'dir' ]; then
unset COMPREPLY[$i]; unset COMPREPLY[$i];
fi; fi;
done done
# strip suffix from info pages # strip suffix from info pages
COMPREPLY=( ${COMPREPLY[@]%.@(gz|bz2|xz|lzma)} ) COMPREPLY=( ${COMPREPLY[@]%.@(gz|bz2|xz|lzma)} )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" ) ) COMPREPLY=( $( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" ) )
return 0 return 0
} && } &&
complete -F _info $filenames info complete -F _info $filenames info
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,39 +3,37 @@
have ipmitool && have ipmitool &&
_ipmitool() _ipmitool()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-I) -I)
COMPREPLY=( $( compgen -W 'open imb lan lanplus free' \ COMPREPLY=( $( compgen -W 'open imb lan lanplus free' -- "$cur" ) )
-- "$cur" ) ) return 0
return 0 ;;
;; esac
esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-h -V -v -c -d -I -H -p -U -f -S -a \ COMPREPLY=( $( compgen -W '-h -V -v -c -d -I -H -p -U -f -S -a \
-e -C -k -y -K -A -P -E -K -m -b -r -B -T -l -o -O' \ -e -C -k -y -K -A -P -E -K -m -b -r -B -T -l -o -O' -- "$cur" ) )
-- "$cur" ) ) else
else COMPREPLY=( $( compgen -W 'raw i2c spd lan chassis power event \
COMPREPLY=( $( compgen -W 'raw i2c spd lan chassis power event \ mc sdr sensor fru gendev sel pef sol tsol isol user \
mc sdr sensor fru gendev sel pef sol tsol isol user \ channel session sunoem kontronoem picmg fwum firewall \
channel session sunoem kontronoem picmg fwum firewall \ exec set hpm ekanalyzer' -- "$cur" ) )
exec set hpm ekanalyzer' -- "$cur" ) ) fi
fi
} && } &&
complete -F _ipmitool ipmitool complete -F _ipmitool ipmitool
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,68 +3,68 @@
have iptables && have iptables &&
_iptables() _iptables()
{ {
local cur prev table chain local cur prev table chain
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
chain='s/^Chain \([^ ]\+\).*$/\1/p' chain='s/^Chain \([^ ]\+\).*$/\1/p'
if [[ $COMP_LINE == *-t\ *filter* ]]; then if [[ $COMP_LINE == *-t\ *filter* ]]; then
table="-t filter" table="-t filter"
elif [[ $COMP_LINE == *-t\ *nat* ]]; then elif [[ $COMP_LINE == *-t\ *nat* ]]; then
table="-t nat" table="-t nat"
elif [[ $COMP_LINE == *-t\ *mangle* ]]; then elif [[ $COMP_LINE == *-t\ *mangle* ]]; then
table="-t mangle" table="-t mangle"
fi fi
_split_longopt _split_longopt
case "$prev" in case "$prev" in
-*[AIDRPFXLZ]) -*[AIDRPFXLZ])
COMPREPLY=( $( compgen -W '`iptables $table -nL | \ COMPREPLY=( $( compgen -W '`iptables $table -nL | \
sed -ne "s/^Chain \([^ ]\+\).*$/\1/p"`' -- "$cur" ) ) sed -ne "s/^Chain \([^ ]\+\).*$/\1/p"`' -- "$cur" ) )
;; ;;
-*t) -*t)
COMPREPLY=( $( compgen -W 'nat filter mangle' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'nat filter mangle' -- "$cur" ) )
;; ;;
-j) -j)
if [ "$table" = "-t filter" -o "$table" = "" ]; then if [ "$table" = "-t filter" -o "$table" = "" ]; then
COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \ COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \
`iptables $table -nL | sed -ne "$chain" \ `iptables $table -nL | sed -ne "$chain" \
-e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \ -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \
"$cur" ) ) "$cur" ) )
elif [ "$table" = "-t nat" ]; then elif [ "$table" = "-t nat" ]; then
COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \ COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \
MIRROR SNAT DNAT MASQUERADE `iptables $table -nL | \ MIRROR SNAT DNAT MASQUERADE `iptables $table -nL | \
sed -ne "$chain" -e "s/OUTPUT|PREROUTING|POSTROUTING//"`' \ sed -ne "$chain" -e "s/OUTPUT|PREROUTING|POSTROUTING//"`' \
-- "$cur" ) ) -- "$cur" ) )
elif [ "$table" = "-t mangle" ]; then elif [ "$table" = "-t mangle" ]; then
COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \ COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \
MARK TOS `iptables $table -nL | sed -ne "$chain" \ MARK TOS `iptables $table -nL | sed -ne "$chain" \
-e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \ -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \
"$cur" ) ) "$cur" ) )
fi fi
;; ;;
*) *)
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-i -o -s -d -p -f -m --append \ COMPREPLY=( $( compgen -W '-i -o -s -d -p -f -m --append \
--delete --insert --replace --list --flush --zero --new \ --delete --insert --replace --list --flush --zero --new \
--delete-chain --policy --rename-chain --proto --source \ --delete-chain --policy --rename-chain --proto --source \
--destination --in-interface --jump --match --numeric \ --destination --in-interface --jump --match --numeric \
--out-interface --table --verbose --line-numbers --exact \ --out-interface --table --verbose --line-numbers --exact \
--fragment --modprobe --set-counters --version' -- "$cur") ) --fragment --modprobe --set-counters --version' -- "$cur") )
fi fi
;; ;;
esac esac
} && } &&
complete -F _iptables iptables complete -F _iptables iptables
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,17 +3,18 @@
have isql && have isql &&
_isql() _isql()
{ {
local cur local cur
cur=`_get_cword` cur=`_get_cword`
[ -f "$ODBCINI" ] && COMPREPLY=( $( grep \\["$cur" "$ODBCINI" | tr -d \\[\\] ) ) [ -f "$ODBCINI" ] \
&& COMPREPLY=( $( grep \\["$cur" "$ODBCINI" | tr -d \\[\\] ) )
} && } &&
complete -F _isql isql complete -F _isql isql
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,34 +3,34 @@
have jar && have jar &&
_jar() _jar()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
if [ $COMP_CWORD = 1 ]; then if [ $COMP_CWORD = 1 ]; then
COMPREPLY=( $( compgen -W 'c t x u' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'c t x u' -- "$cur" ) )
return 0 return 0
fi fi
case "${COMP_WORDS[1]}" in case "${COMP_WORDS[1]}" in
*c*f) *c*f)
_filedir _filedir
;; ;;
*f) *f)
_filedir '?([ejw]ar|zip|[EJW]AR|ZIP)' _filedir '?([ejw]ar|zip|[EJW]AR|ZIP)'
;; ;;
*) *)
_filedir _filedir
;; ;;
esac esac
} && } &&
complete -F _jar $filenames jar complete -F _jar $filenames jar
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -4,168 +4,168 @@
have java && { have java && {
_java_path() _java_path()
{ {
cur=${cur##*:} cur=${cur##*:}
_filedir '@(jar|zip)' _filedir '@(jar|zip)'
} }
# exact classpath determination # exact classpath determination
_java_find_classpath() _java_find_classpath()
{ {
local i local i
# search first in current options # search first in current options
for (( i=1; i < COMP_CWORD; i++ )); do for (( i=1; i < COMP_CWORD; i++ )); do
if [[ "${COMP_WORDS[i]}" == -@(cp|classpath) ]]; then if [[ "${COMP_WORDS[i]}" == -@(cp|classpath) ]]; then
classpath=${COMP_WORDS[i+1]} classpath=${COMP_WORDS[i+1]}
break break
fi fi
done done
# default to environment # default to environment
[ -z "$classpath" ] && classpath=$CLASSPATH [ -z "$classpath" ] && classpath=$CLASSPATH
# default to current directory # default to current directory
[ -z "$classpath" ] && classpath=. [ -z "$classpath" ] && classpath=.
} }
# exact sourcepath determination # exact sourcepath determination
_java_find_sourcepath() _java_find_sourcepath()
{ {
local i local i
# search first in current options # search first in current options
for (( i=1; i < COMP_CWORD; i++ )); do for (( i=1; i < COMP_CWORD; i++ )); do
if [[ "${COMP_WORDS[i]}" == -sourcepath ]]; then if [[ "${COMP_WORDS[i]}" == -sourcepath ]]; then
sourcepath=${COMP_WORDS[i+1]} sourcepath=${COMP_WORDS[i+1]}
break break
fi fi
done done
# default to classpath # default to classpath
if [ -z "$sourcepath" ]; then if [ -z "$sourcepath" ]; then
_java_find_classpath _java_find_classpath
sourcepath=$classpath sourcepath=$classpath
fi fi
} }
# available classes completion # available classes completion
_java_classes() _java_classes()
{ {
local classpath i local classpath i
# find which classpath to use # find which classpath to use
_java_find_classpath _java_find_classpath
# convert package syntax to path syntax # convert package syntax to path syntax
cur=${cur//.//} cur=${cur//.//}
# parse each classpath element for classes # parse each classpath element for classes
for i in ${classpath//:/ }; do for i in ${classpath//:/ }; do
if [ -r $i ] && [[ "$i" == *.@(jar|zip) ]]; then if [ -r $i ] && [[ "$i" == *.@(jar|zip) ]]; then
if type zipinfo &>/dev/null; then if type zipinfo &>/dev/null; then
COMPREPLY=( "${COMPREPLY[@]}" $( zipinfo -1 \ COMPREPLY=( "${COMPREPLY[@]}" $( zipinfo -1 \
"$i" "$cur*" 2>/dev/null | \ "$i" "$cur*" 2>/dev/null | \
grep '^[^$]*\.class$' ) ) grep '^[^$]*\.class$' ) )
else else
COMPREPLY=( "${COMPREPLY[@]}" $( jar tf "$i" \ COMPREPLY=( "${COMPREPLY[@]}" $( jar tf "$i" \
"$cur" | grep '^[^$]*\.class$' ) ) "$cur" | grep '^[^$]*\.class$' ) )
fi fi
elif [ -d $i ]; then elif [ -d $i ]; then
i=${i%/} i=${i%/}
# See Debian bug #496828 # See Debian bug #496828
COMPREPLY=( "${COMPREPLY[@]}" $( find "$i" -type f \ COMPREPLY=( "${COMPREPLY[@]}" $( find "$i" -type f \
-maxdepth 1 -path "$i/$cur*.class" 2>/dev/null | \ -maxdepth 1 -path "$i/$cur*.class" 2>/dev/null | \
grep -v "\\$" | sed -e "s|^$i/||" ) ) grep -v "\\$" | sed -e "s|^$i/||" ) )
# FIXME: if we have foo.class and foo/, the completion # FIXME: if we have foo.class and foo/, the completion
# returns "foo/"... how to give precedence to files # returns "foo/"... how to give precedence to files
# over directories? # over directories?
fi fi
done done
# remove class extension # remove class extension
COMPREPLY=( ${COMPREPLY[@]%.class} ) COMPREPLY=( ${COMPREPLY[@]%.class} )
# convert path syntax to package syntax # convert path syntax to package syntax
COMPREPLY=( ${COMPREPLY[@]//\//.} ) COMPREPLY=( ${COMPREPLY[@]//\//.} )
} }
# available packages completion # available packages completion
_java_packages() _java_packages()
{ {
local sourcepath i local sourcepath i
# find which sourcepath to use # find which sourcepath to use
_java_find_sourcepath _java_find_sourcepath
# convert package syntax to path syntax # convert package syntax to path syntax
cur=${cur//.//} cur=${cur//.//}
# parse each sourcepath element for packages # parse each sourcepath element for packages
for i in ${sourcepath//:/ }; do for i in ${sourcepath//:/ }; do
if [ -d $i ]; then if [ -d $i ]; then
COMPREPLY=( "${COMPREPLY[@]}" $( command ls -F -d \ COMPREPLY=( "${COMPREPLY[@]}" $( command ls -F -d \
$i/$cur* 2>/dev/null | sed -e 's|^'$i'/||' ) ) $i/$cur* 2>/dev/null | sed -e 's|^'$i'/||' ) )
fi fi
done done
# keep only packages # keep only packages
COMPREPLY=( $( echo "${COMPREPLY[@]}" | tr " " "\n" | grep "/$" ) ) COMPREPLY=( $( echo "${COMPREPLY[@]}" | tr " " "\n" | grep "/$" ) )
# remove packages extension # remove packages extension
COMPREPLY=( ${COMPREPLY[@]%/} ) COMPREPLY=( ${COMPREPLY[@]%/} )
# convert path syntax to package syntax # convert path syntax to package syntax
cur=${COMPREPLY[@]//\//.} cur=${COMPREPLY[@]//\//.}
} }
# java completion # java completion
# #
_java() _java()
{ {
local cur prev i local cur prev i
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
for ((i=1; i < $COMP_CWORD; i++)); do for ((i=1; i < $COMP_CWORD; i++)); do
case ${COMP_WORDS[$i]} in case ${COMP_WORDS[$i]} in
-cp|-classpath) -cp|-classpath)
((i++)) # skip the classpath string. ((i++)) # skip the classpath string.
;; ;;
-*) -*)
# this is an option, not a class/jarfile name. # this is an option, not a class/jarfile name.
;; ;;
*) *)
# once we've seen a class, just do filename completion # once we've seen a class, just do filename completion
_filedir _filedir
return 0 return 0
;; ;;
esac esac
done done
case $prev in case $prev in
-@(cp|classpath)) -@(cp|classpath))
_java_path _java_path
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
# relevant options completion # relevant options completion
COMPREPLY=( $( compgen -W '-client -hotspot -server -classic \ COMPREPLY=( $( compgen -W '-client -hotspot -server -classic \
-cp -classpath -D -verbose -verbose:class \ -cp -classpath -D -verbose -verbose:class \
-verbose:gc -version:jni -version \ -verbose:gc -version:jni -version \
-showversion -? -help -X -jar \ -showversion -? -help -X -jar \
-ea -enableassertions -da -disableassertions \ -ea -enableassertions -da -disableassertions \
-esa -enablesystemassertions \ -esa -enablesystemassertions \
-dsa -disablesystemassertions ' -- "$cur" ) ) -dsa -disablesystemassertions ' -- "$cur" ) )
else else
if [[ "$prev" == -jar ]]; then if [[ "$prev" == -jar ]]; then
# jar file completion # jar file completion
_filedir jar _filedir jar
else else
# classes completion # classes completion
_java_classes _java_classes
fi fi
fi fi
} }
complete -F _java $filenames java complete -F _java $filenames java
} }
@ -173,89 +173,88 @@ complete -F _java $filenames java
have javadoc && have javadoc &&
_javadoc() _javadoc()
{ {
COMPREPLY=() COMPREPLY=()
local cur prev local cur prev
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in case $prev in
-@(overview|helpfile|stylesheetfile)) -@(overview|helpfile|stylesheetfile))
_filedir _filedir
return 0 return 0
;; ;;
-d) -d)
_filedir -d _filedir -d
return 0 return 0
;; ;;
-@(classpath|bootclasspath|docletpath|sourcepath|extdirs)) -@(classpath|bootclasspath|docletpath|sourcepath|extdirs))
_java_path _java_path
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
# relevant options completion # relevant options completion
COMPREPLY=( $( compgen -W '-overview -public -protected \ COMPREPLY=( $( compgen -W '-overview -public -protected \
-package -private -help -doclet -docletpath \ -package -private -help -doclet -docletpath \
-sourcepath -classpath -exclude -subpackages \ -sourcepath -classpath -exclude -subpackages \
-breakiterator -bootclasspath -source -extdirs \ -breakiterator -bootclasspath -source -extdirs \
-verbose -locale -encoding -J -d -use -version \ -verbose -locale -encoding -J -d -use -version \
-author -docfilessubdirs -splitindex \ -author -docfilessubdirs -splitindex \
-windowtitle -doctitle -header -footer -bottom \ -windowtitle -doctitle -header -footer -bottom \
-link -linkoffline -excludedocfilessubdir \ -link -linkoffline -excludedocfilessubdir \
-group -nocomment -nodeprecated -noqualifier \ -group -nocomment -nodeprecated -noqualifier \
-nosince -nodeprecatedlist -notree -noindex \ -nosince -nodeprecatedlist -notree -noindex \
-nohelp -nonavbar -quiet -serialwarn -tag \ -nohelp -nonavbar -quiet -serialwarn -tag \
-taglet -tagletpath -charset -helpfile \ -taglet -tagletpath -charset -helpfile \
-linksource -stylesheetfile -docencoding' -- \ -linksource -stylesheetfile -docencoding' -- "$cur" ) )
"$cur" ) ) else
else # source files completion
# source files completion _filedir java
_filedir java # packages completion
# packages completion _java_packages
_java_packages fi
fi
} && } &&
complete -F _javadoc $filenames javadoc complete -F _javadoc $filenames javadoc
have javac && have javac &&
_javac() _javac()
{ {
COMPREPLY=() COMPREPLY=()
local cur prev local cur prev
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in case $prev in
-d) -d)
_filedir -d _filedir -d
return 0 return 0
;; ;;
-@(classpath|bootclasspath|sourcepath|extdirs)) -@(classpath|bootclasspath|sourcepath|extdirs))
_java_path _java_path
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
# relevant options completion # relevant options completion
COMPREPLY=( $( compgen -W '-g -g:none -g:lines -g:vars\ COMPREPLY=( $( compgen -W '-g -g:none -g:lines -g:vars\
-g:source -O -nowarn -verbose -deprecation -classpath\ -g:source -O -nowarn -verbose -deprecation -classpath\
-sourcepath -bootclasspath -extdirs -d -encoding -source\ -sourcepath -bootclasspath -extdirs -d -encoding -source\
-target -help' -- "$cur" ) ) -target -help' -- "$cur" ) )
else else
# source files completion # source files completion
_filedir java _filedir java
fi fi
} && } &&
complete -F _javac $filenames javac complete -F _javac $filenames javac
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -5,25 +5,25 @@
_kldload() _kldload()
{ {
local cur moddir local cur moddir
moddir=/modules/ moddir=/modules/
[ -d $moddir ] || moddir=/boot/kernel/ [ -d $moddir ] || moddir=/boot/kernel/
cur=`_get_cword` cur=`_get_cword`
COMPREPLY=( $( compgen -f "$moddir$cur" ) ) COMPREPLY=( $( compgen -f "$moddir$cur" ) )
COMPREPLY=( ${COMPREPLY[@]#$moddir} ) COMPREPLY=( ${COMPREPLY[@]#$moddir} )
COMPREPLY=( ${COMPREPLY[@]%.ko} ) COMPREPLY=( ${COMPREPLY[@]%.ko} )
return 0 return 0
} }
complete -F _kldload $filenames kldload complete -F _kldload $filenames kldload
_kldunload() _kldunload()
{ {
local cur local cur
cur=`_get_cword` cur=`_get_cword`
COMPREPLY=( $(kldstat | sed -ne "s/^.*[ \t]\+\($cur[a-z_]\+\).ko$/\1/p") ) COMPREPLY=( $(kldstat | sed -ne "s/^.*[ \t]\+\($cur[a-z_]\+\).ko$/\1/p") )
} }
complete -F _kldunload $filenames kldunload complete -F _kldunload $filenames kldunload
@ -31,8 +31,8 @@ complete -F _kldunload $filenames kldunload
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,43 +3,47 @@
have larch && have larch &&
_larch() _larch()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
if [ $COMP_CWORD -eq 1 ] || [[ "$prev" == -* ]]; then if [ $COMP_CWORD -eq 1 ] || [[ "$prev" == -* ]]; then
COMPREPLY=( $( compgen -W ' \ COMPREPLY=( $( compgen -W ' \
my-id my-default-archive register-archive whereis-archive archives \ my-id my-default-archive register-archive whereis-archive archives \
init-tree tree-root tree-version set-tree-version inventory tagging-method \ init-tree tree-root tree-version set-tree-version inventory \
tree-lint missing-tags add delete move explicit-default set-manifest \ tagging-method tree-lint missing-tags add delete \
manifest check-manifest mkpatch dopatch patch-report empty-patch \ move explicit-default set-manifest manifest check-manifest mkpatch \
make-archive make-category make-branch make-version categories \ dopatch patch-report empty-patch make-archive make-category \
branches versions revisions cat-archive-log archive-cache-revision \ make-branch make-version categories branches versions revisions \
archive-cached-revisions archive-uncache-revision category-readme \ cat-archive-log archive-cache-revision archive-cached-revisions \
branch-readme version-readme make-log logs add-log log-ls cat-log \ archive-uncache-revision category-readme branch-readme \
log-header-field changelog log-for-merge merge-points new-on-branch \ version-readme make-log logs add-log log-ls cat-log \
import commit get get-patch lock-branch lock-revision push-mirror \ log-header-field changelog log-for-merge merge-points \
build-config update-config replay-config record-config show-config \ new-on-branch import commit get get-patch lock-branch \
config-history update replay delta-patch star-merge tag prepare-branch \ lock-revision push-mirror build-config update-config replay-config \
finish-branch join-branch whats-missing what-changed file-diffs pristines \ record-config show-config config-history update replay delta-patch \
lock-pristine my-revision-library library-find library-add library-remove \ star-merge tag prepare-branch finish-branch join-branch \
library-archives library-categories library-branches library-versions \ whats-missing what-changed file-diffs pristines lock-pristine \
library-revisions library-log library-file touched-files-prereqs \ my-revision-library library-find library-add library-remove \
patch-set-web update-distributions distribution-name notify my-notifier \ library-archives library-categories library-branches \
mail-new-categories mail-new-branches mail-new-versions mail-new-revisions \ library-versions library-revisions library-log library-file \
notify-library notify-browser push-new-revisions sendmail-mailx' "$cur" )) touched-files-prereqs patch-set-web update-distributions \
fi 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 return 0
} && } &&
complete -F _larch $default larch complete -F _larch $default larch
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,73 +3,71 @@
have ldapvi && have ldapvi &&
_ldapvi() _ldapvi()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-@(h|-host)) -@(h|-host))
_known_hosts_real "$cur" _known_hosts_real "$cur"
return 0 return 0
;; ;;
-@(Y|-sasl-mech)) -@(Y|-sasl-mech))
COMPREPLY=( $( compgen -W 'EXTERNAL GSSAPI DIGEST-MD5 \ COMPREPLY=( $( compgen -W 'EXTERNAL GSSAPI DIGEST-MD5 \
CRAM-MD5 PLAIN ANONYMOUS' -- "$cur" ) ) CRAM-MD5 PLAIN ANONYMOUS' -- "$cur" ) )
return 0 return 0
;; ;;
--bind) --bind)
COMPREPLY=( $( compgen -W 'simple sasl' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'simple sasl' -- "$cur" ) )
return 0 return 0
;; ;;
--bind-dialog) --bind-dialog)
COMPREPLY=( $( compgen -W 'never auto always' \ COMPREPLY=( $( compgen -W 'never auto always' -- $cur ) )
-- $cur ) ) return 0
return 0 ;;
;; --scope)
--scope) COMPREPLY=( $( compgen -W 'base one sub' -- "$cur" ) )
COMPREPLY=( $( compgen -W 'base one sub' -- "$cur" ) ) return 0
return 0 ;;
;; --deref)
--deref) COMPREPLY=( $( compgen -W 'never searching finding always' \
COMPREPLY=( $( compgen -W 'never searching finding \ -- "$cur" ) )
always' -- "$cur" ) ) return 0
return 0 ;;
;; --encoding)
--encoding) COMPREPLY=( $( compgen -W 'ASCII UTF-8 binary' -- "$cur" ) )
COMPREPLY=( $( compgen -W 'ASCII UTF-8 binary' \ return 0
-- "$cur" ) ) ;;
return 0 --tls)
;; COMPREPLY=( $( compgen -W 'never allow try strict' \
--tls) -- "$cur" ) )
COMPREPLY=( $( compgen -W 'never allow try strict' \ return 0
-- "$cur" ) ) ;;
return 0 esac
;;
esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--discover --out --in --delete \ COMPREPLY=( $( compgen -W '--discover --out --in --delete \
--rename -h --host -D --user -w --password --bind \ --rename -h --host -D --user -w --password --bind \
--bind-dialog -I --sasl-interactive --bind-dialog -O \ --bind-dialog -I --sasl-interactive --bind-dialog -O \
--sasl-secprops -Q --sasl-quiet -R --sasl-realm -U \ --sasl-secprops -Q --sasl-quiet -R --sasl-realm -U \
--sasl-authcid -X --sasl-authzid -Y --sasl-mech -b \ --sasl-authcid -X --sasl-authzid -Y --sasl-mech -b \
--base -s --scope -S --sort --add -o --class --config \ --base -s --scope -S --sort --add -o --class --config \
-c --continue --deleteoldrdn -a --deref -d --discover \ -c --continue --deleteoldrdn -a --deref -d --discover \
-A --empty --ncoding -H --help --ldap-conf -m --may -M \ -A --empty --ncoding -H --help --ldap-conf -m --may -M \
--managedsait --noquestions -! --noninteractive -q \ --managedsait --noquestions -! --noninteractive -q \
--quiet -R --read -Z --starttls --tls -v --verbose \ --quiet -R --read -Z --starttls --tls -v --verbose \
--ldapsearch --ldapmodify --ldapdelete --ldapmoddn' \ --ldapsearch --ldapmodify --ldapdelete --ldapmoddn' \
-- "$cur" ) ) -- "$cur" ) )
fi fi
} && } &&
complete -F _ldapvi ldapvi complete -F _ldapvi ldapvi
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,24 +3,24 @@
have lftp && have lftp &&
_lftp() _lftp()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
if [ $COMP_CWORD -eq 1 ] && [ -f ~/.lftp/bookmarks ]; then if [ $COMP_CWORD -eq 1 ] && [ -f ~/.lftp/bookmarks ]; then
COMPREPLY=( $( compgen -W '$( sed -ne "s/^\(.*\)'$'\t''.*$/\1/p" \ COMPREPLY=( $( compgen -W '$( sed -ne "s/^\(.*\)'$'\t''.*$/\1/p" \
~/.lftp/bookmarks )' -- "$cur" ) ) ~/.lftp/bookmarks )' -- "$cur" ) )
fi fi
return 0 return 0
} && } &&
complete -F _lftp $default lftp complete -F _lftp $default lftp
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,60 +3,59 @@
have lilo && { have lilo && {
_lilo_labels() _lilo_labels()
{ {
COMPREPLY=( $( compgen -W "$( awk -F'=' '/label/ {print $2}' \ COMPREPLY=( $( compgen -W "$( awk -F'=' '/label/ {print $2}' \
/etc/lilo.conf | sed -e 's/\"//g' )" -- "$cur" ) ) /etc/lilo.conf | sed -e 's/\"//g' )" -- "$cur" ) )
} }
_lilo() _lilo()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in case $prev in
-@(C|i|m|s|S)) -@(C|i|m|s|S))
_filedir _filedir
return 0 return 0
;; ;;
-r) -r)
_filedir -d _filedir -d
return 0 return 0
;; ;;
-@(I|D|R)) -@(I|D|R))
# label completion # label completion
_lilo_labels _lilo_labels
return 0 return 0
;; ;;
-@(A|b|M|u|U)) -@(A|b|M|u|U))
# device completion # device completion
cur=${cur:=/dev/} cur=${cur:=/dev/}
_filedir _filedir
return 0 return 0
;; ;;
-T) -T)
# topic completion # topic completion
COMPREPLY=( $( compgen -W 'help ChRul EBDA geom geom= \ COMPREPLY=( $( compgen -W 'help ChRul EBDA geom geom= \
table= video' -- "$cur" ) ) table= video' -- "$cur" ) )
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
# relevant options completion # relevant options completion
COMPREPLY=( $( compgen -W '-A -b -c -C -d -f -g -i -I -l -L -m \ COMPREPLY=( $( compgen -W '-A -b -c -C -d -f -g -i -I -l -L -m \
-M -p -P -q -r -R -s -S -t -T -u -U -v -V -w -x -z' -- \ -M -p -P -q -r -R -s -S -t -T -u -U -v -V -w -x -z' -- "$cur" ) )
"$cur" ) ) fi
fi
} }
complete -F _lilo lilo complete -F _lilo lilo
} }
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -1,11 +0,0 @@
# lilypond completion by Laurent Martelli <laurent@bearteam.org>
complete -f -X '!*.ly' lilypond ly2dvi
# Local variables:
# mode: shell-script
# sh-basic-offset: 8
# sh-indent-comment: t
# indent-tabs-mode: t
# End:
# ex: ts=8 sw=8 noet filetype=sh

View File

@ -3,42 +3,41 @@
have links && have links &&
_links() _links()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
case "$cur" in case "$cur" in
--*) --*)
COMPREPLY=( $( compgen -W '--help' -- "$cur" ) ) COMPREPLY=( $( compgen -W '--help' -- "$cur" ) )
;; ;;
-*) -*)
COMPREPLY=( $( compgen -W '-async-dns -max-connections \ COMPREPLY=( $( compgen -W '-async-dns -max-connections \
-max-connections-to-host -retries \ -max-connections-to-host -retries -receive-timeout \
-receive-timeout -unrestartable-receive-timeout\ -unrestartable-receive-timeout -format-cache-size \
-format-cache-size -memory-cache-size \ -memory-cache-size -http-proxy -ftp-proxy -download-dir \
-http-proxy -ftp-proxy -download-dir \ -assume-codepage -anonymous -dump -no-connect \
-assume-codepage -anonymous -dump -no-connect \ -source -version -help' -- "$cur" ) )
-source -version -help' -- "$cur" ) ) ;;
;; *)
*) if [ -r ~/.links/links.his ]; then
if [ -r ~/.links/links.his ]; then COMPREPLY=( $( compgen -W '$( < ~/.links/links.his )' \
COMPREPLY=( $( compgen -W '$( < ~/.links/links.his )' \ -- "$cur" ) )
-- "$cur" ) ) fi
fi _filedir '@(htm|html)'
_filedir '@(htm|html)' return 0
return 0 ;;
;; esac
esac
return 0 return 0
} && } &&
complete -F _links $filenames links complete -F _links $filenames links
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -11,12 +11,11 @@ _lisp()
# completing an option (may or may not be separated by a space) # completing an option (may or may not be separated by a space)
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-core -lib -batch -quit -edit -eval -init \ COMPREPLY=( $( compgen -W '-core -lib -batch -quit -edit -eval -init \
-dynamic-space-size -hinit -noinit -nositeinit -load \ -dynamic-space-size -hinit -noinit -nositeinit -load -slave ' \
-slave ' \ -- "$cur" ) )
-- "$cur" ) )
else else
_filedir _filedir
fi fi
return 0 return 0
@ -25,8 +24,8 @@ complete -F _lisp $default lisp
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

File diff suppressed because it is too large Load Diff

View File

@ -3,45 +3,45 @@
have lzma && have lzma &&
_lzma() _lzma()
{ {
local cur prev xspec local cur prev xspec
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-c -d -f -h -k -L -q -s \ COMPREPLY=( $( compgen -W '-c -d -f -h -k -L -q -s \
-v -V -z -1 -2 -3 -4 -5 -6 -7 -8 -9 \ -v -V -z -1 -2 -3 -4 -5 -6 -7 -8 -9 \
--help --decompress --compress --keep --force \ --help --decompress --compress --keep --force \
--test --stdout --quiet --verbose --license \ --test --stdout --quiet --verbose --license \
--version --small --fast --best --text' -- "$cur" ) ) --version --small --fast --best --text' -- "$cur" ) )
return 0 return 0
fi fi
local IFS=$'\t\n' local IFS=$'\t\n'
xspec="*.lzma" xspec="*.lzma"
if [[ "$prev" == --* ]]; then if [[ "$prev" == --* ]]; then
[[ "$prev" == --decompress || \ [[ "$prev" == --decompress || \
"$prev" == --list || \ "$prev" == --list || \
"$prev" == --test ]] && xspec="!"$xspec "$prev" == --test ]] && xspec="!"$xspec
[[ "$prev" == --compress ]] && xspec= [[ "$prev" == --compress ]] && xspec=
elif [[ "$prev" == -* ]]; then elif [[ "$prev" == -* ]]; then
[[ "$prev" == -*[dt]* ]] && xspec="!"$xspec [[ "$prev" == -*[dt]* ]] && xspec="!"$xspec
[[ "$prev" == -*z* ]] && xspec= [[ "$prev" == -*z* ]] && xspec=
fi fi
_expand || return 0 _expand || return 0
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) ) $( compgen -d -- "$cur" ) )
} && } &&
complete -F _lzma $filenames lzma complete -F _lzma $filenames lzma
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,56 +3,72 @@
have lzop && have lzop &&
_lzop() _lzop()
{ {
local cur prev xspec local cur prev xspec
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
# TODO: -p: takes a dir argument, without a separating space # TODO: -p: takes a dir argument, without a separating space
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-d -x -l -t -h -I -V -L -1 -2 -3 \ COMPREPLY=( $( compgen -W '-d -x -l -t -h -I -V -L -1 -2 -3 \
-4 -5 -6 -7 -8 -9 -q -v -c -f -F -n -N -P -k -U -o \ -4 -5 -6 -7 -8 -9 -q -v -c -f -F -n -N -P -k -U -o \
-S --fast --best --decompress --uncompress --extract \ -S --fast --best --decompress --uncompress --extract \
--test --list --ls --info --sysinfo --license --help \ --test --list --ls --info --sysinfo --license --help \
--version --stdout --to-stdout --output --path \ --version --stdout --to-stdout --output --path \
--force --no-checksum --no-name --name --no-mode \ --force --no-checksum --no-name --name --no-mode \
--no-time --suffix --keep --unlink --delete --crc32 \ --no-time --suffix --keep --unlink --delete --crc32 \
--no-warn --ignore-warn --quiet --silent --verbose \ --no-warn --ignore-warn --quiet --silent --verbose \
--no-stdin --filter --checksum --no-color --mono \ --no-stdin --filter --checksum --no-color --mono \
--color' -- "$cur" ) ) --color' -- "$cur" ) )
return 0 return 0
fi fi
case "$prev" in case "$prev" in
-o|--output) _filedir ; return 0 ;; -o|--output)
--path) _filedir -d ; return 0 ;; _filedir
-S|--suffix) return 0 ;; return 0
esac ;;
--path)
_filedir -d
return 0
;;
-S|--suffix)
return 0
;;
esac
xspec="*.?(t)lzo" xspec="*.?(t)lzo"
case "$prev" in case "$prev" in
--@(@(de|un)compress|extract|list|ls|info|test)) --@(@(de|un)compress|extract|list|ls|info|test))
xspec="!"$xspec ;; xspec="!"$xspec
--force) xspec= ;; ;;
--*) ;; --force)
-*f*|'<'|'>') xspec= ;; xspec=
-*[dltx]*) xspec="!"$xspec ;; ;;
esac --*)
;;
-*f*|'<'|'>')
xspec=
;;
-*[dltx]*)
xspec="!"$xspec
;;
esac
_expand || return 0 _expand || return 0
local IFS=$'\t\n' local IFS=$'\t\n'
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \ COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) ) $( compgen -d -- "$cur" ) )
} && } &&
complete -F _lzop $filenames lzop complete -F _lzop $filenames lzop
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,21 +3,20 @@
have list_lists && { have list_lists && {
_mailman_lists() _mailman_lists()
{ {
COMPREPLY=( $( compgen -W '$( list_lists -b )' -- "$cur" ) ) COMPREPLY=( $( compgen -W '$( list_lists -b )' -- "$cur" ) )
} }
_list_lists() _list_lists()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-a --advertised \ COMPREPLY=( $( compgen -W '-a --advertised --virtual-host-overview -V \
--virtual-host-overview -V -b --bare \ -b --bare -h --help' -- "$cur" ) )
-h --help' -- "$cur" ) ) fi
fi
} && } &&
complete -F _list_lists list_lists complete -F _list_lists list_lists
@ -26,34 +25,34 @@ complete -F _list_lists list_lists
have add_members && have add_members &&
_add_members() _add_members()
{ {
local cur prev split=false local cur prev split=false
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
_split_longopt && split=true _split_longopt && split=true
case "$prev" in case "$prev" in
-@(r|d|-regular-members-file|-digest-members-file)) -@(r|d|-regular-members-file|-digest-members-file))
_filedir _filedir
return 0 return 0
;; ;;
-@(w|a|-welcome-msg|-admin-notify)) -@(w|a|-welcome-msg|-admin-notify))
COMPREPLY=( $( compgen -W 'y n' -- "$cur") ) COMPREPLY=( $( compgen -W 'y n' -- "$cur") )
return 0 return 0
;; ;;
esac esac
$split && return 0 $split && return 0
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--regular-members-file -r \ COMPREPLY=( $( compgen -W '--regular-members-file -r \
--digest-members-file -d --welcome-msg -w \ --digest-members-file -d --welcome-msg -w \
--admin-notify -a --help -h' -- "$cur" ) ) --admin-notify -a --help -h' -- "$cur" ) )
else else
_mailman_lists _mailman_lists
fi fi
} && } &&
complete -F _add_members add_members complete -F _add_members add_members
@ -61,30 +60,29 @@ complete -F _add_members add_members
have remove_members && have remove_members &&
_remove_members() _remove_members()
{ {
local cur prev split=false local cur prev split=false
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
_split_longopt && split=true _split_longopt && split=true
case "$prev" in case "$prev" in
-@(f|-file)) -@(f|-file))
_filedir _filedir
return 0 return 0
;; ;;
esac esac
$split && return 0 $split && return 0
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--file -f --all -a \ COMPREPLY=( $( compgen -W '--file -f --all -a --fromall --nouserack -n \
--fromall --nouserack -n --noadminack -N \ --noadminack -N --help -h' -- "$cur" ) )
--help -h' -- "$cur" ) ) else
else _mailman_lists
_mailman_lists fi
fi
} && } &&
complete -F _remove_members remove_members complete -F _remove_members remove_members
@ -92,27 +90,27 @@ complete -F _remove_members remove_members
have find_member && have find_member &&
_find_member() _find_member()
{ {
local cur prev split=false local cur prev split=false
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
_split_longopt && split=true _split_longopt && split=true
case "$prev" in case "$prev" in
-@(l|x|-listname|-exclude)) -@(l|x|-listname|-exclude))
_mailman_lists _mailman_lists
return 0 return 0
;; ;;
esac esac
$split && return 0 $split && return 0
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-l --listname -x \ COMPREPLY=( $( compgen -W '-l --listname -x --exclude --owners -w \
--exclude --owners -w --help -h' -- "$cur" ) ) --help -h' -- "$cur" ) )
fi fi
} && } &&
complete -F _find_member find_member complete -F _find_member find_member
@ -120,27 +118,27 @@ complete -F _find_member find_member
have clone_member && have clone_member &&
_clone_member() _clone_member()
{ {
local cur prev split=false local cur prev split=false
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
_split_longopt && split=true _split_longopt && split=true
case "$prev" in case "$prev" in
-@(l|-listname)) -@(l|-listname))
_mailman_lists _mailman_lists
return 0 return 0
;; ;;
esac esac
$split && return 0 $split && return 0
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-l --listname --remove -r \ COMPREPLY=( $( compgen -W '-l --listname --remove -r --admin -a \
--admin -a --quiet -q --nomodify -n --help -h' -- "$cur" ) ) --quiet -q --nomodify -n --help -h' -- "$cur" ) )
fi fi
} && } &&
complete -F _clone_member clone_member complete -F _clone_member clone_member
@ -148,34 +146,34 @@ complete -F _clone_member clone_member
have sync_members && have sync_members &&
_sync_members() _sync_members()
{ {
local cur prev split=false local cur prev split=false
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
_split_longopt && split=true _split_longopt && split=true
case "$prev" in case "$prev" in
-@(w|g|d|--welcome-msg|-goodbye-msg|-digest)) -@(w|g|d|--welcome-msg|-goodbye-msg|-digest))
COMPREPLY=( $( compgen -W 'y n' -- "$cur") ) COMPREPLY=( $( compgen -W 'y n' -- "$cur") )
return 0 return 0
;; ;;
-@(d|-file)) -@(d|-file))
_filedir _filedir
return 0 return 0
;; ;;
esac esac
$split && return 0 $split && return 0
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--no-change -n --welcome-msg -w \ COMPREPLY=( $( compgen -W '--no-change -n --welcome-msg -w \
--goodbye-msg -g --digest -d --notifyadmin -a \ --goodbye-msg -g --digest -d --notifyadmin -a -f --file -h --help' \
-f --file -h --help' -- "$cur" ) ) -- "$cur" ) )
else else
_mailman_lists _mailman_lists
fi fi
} && } &&
complete -F _sync_members sync_members complete -F _sync_members sync_members
@ -183,16 +181,16 @@ complete -F _sync_members sync_members
have unshunt && have unshunt &&
_unshunt() _unshunt()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-h --help' -- "$cur" ) ) COMPREPLY=( $( compgen -W '-h --help' -- "$cur" ) )
else else
_filedir -d _filedir -d
fi fi
} && } &&
complete -F _unshunt unshunt complete -F _unshunt unshunt
@ -200,17 +198,17 @@ complete -F _unshunt unshunt
have list_admins && have list_admins &&
_list_admins() _list_admins()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--all-vhost -v \ COMPREPLY=( $( compgen -W '--all-vhost -v --all -a -h --help' \
--all -a -h --help' -- "$cur" ) ) -- "$cur" ) )
else else
_mailman_lists _mailman_lists
fi fi
} && } &&
complete -F _list_admins list_admins complete -F _list_admins list_admins
@ -218,17 +216,17 @@ complete -F _list_admins list_admins
have list_owners && have list_owners &&
_list_owners() _list_owners()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-w --with-listnames \ COMPREPLY=( $( compgen -W '-w --with-listnames -m --moderators -h \
-m --moderators -h --help' -- "$cur" ) ) --help' -- "$cur" ) )
else else
_mailman_lists _mailman_lists
fi fi
} && } &&
complete -F _list_owners list_owners complete -F _list_owners list_owners
@ -236,38 +234,38 @@ complete -F _list_owners list_owners
have list_members && have list_members &&
_list_members() _list_members()
{ {
local cur prev split=false local cur prev split=false
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
_split_longopt && split=true _split_longopt && split=true
case "$prev" in case "$prev" in
-@(o|-output)) -@(o|-output))
_filedir _filedir
return 0 return 0
;; ;;
-@(d|-digest)) -@(d|-digest))
COMPREPLY=( $( compgen -W 'mime plain' -- "$cur") ) COMPREPLY=( $( compgen -W 'mime plain' -- "$cur") )
return 0 return 0
;; ;;
-@(n|-nomail)) -@(n|-nomail))
COMPREPLY=( $( compgen -W 'byadmin byuser bybounce unknown' -- "$cur") ) COMPREPLY=( $( compgen -W 'byadmin byuser bybounce unknown' \
return 0 -- "$cur") )
;; return 0
esac ;;
esac
$split && return 0 $split && return 0
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--output -o --regular -r \ COMPREPLY=( $( compgen -W '--output -o --regular -r --digest -d \
--digest -d --nomail -n --fullnames -f \ --nomail -n --fullnames -f --preserve -p -h --help' -- "$cur" ) )
--preserve -p -h --help' -- "$cur" ) ) else
else _mailman_lists
_mailman_lists fi
fi
} && } &&
complete -F _list_members list_members complete -F _list_members list_members
@ -275,27 +273,27 @@ complete -F _list_members list_members
have change_pw && have change_pw &&
_change_pw() _change_pw()
{ {
local cur prev split=false local cur prev split=false
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
_split_longopt && split=true _split_longopt && split=true
case "$prev" in case "$prev" in
-@(l|-listname)) -@(l|-listname))
_mailman_lists _mailman_lists
return 0 return 0
;; ;;
esac esac
$split && return 0 $split && return 0
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-a --all --domain -d --listname -l \ COMPREPLY=( $( compgen -W '-a --all --domain -d --listname -l \
--password -p --quiet -q -h --help' -- "$cur" ) ) --password -p --quiet -q -h --help' -- "$cur" ) )
fi fi
} && } &&
complete -F _change_pw change_pw complete -F _change_pw change_pw
@ -303,17 +301,17 @@ complete -F _change_pw change_pw
have withlist && have withlist &&
_withlist() _withlist()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-l --lock -i --interactive \ COMPREPLY=( $( compgen -W '-l --lock -i --interactive \
-r --run -a --all -q --quiet -h --help' -- "$cur" ) ) -r --run -a --all -q --quiet -h --help' -- "$cur" ) )
else else
_mailman_lists _mailman_lists
fi fi
} && } &&
complete -F _withlist withlist complete -F _withlist withlist
@ -321,16 +319,17 @@ complete -F _withlist withlist
have newlist && have newlist &&
_newlist() _newlist()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-l --language -q --quiet -h --help' -- "$cur" ) ) COMPREPLY=( $( compgen -W '-l --language -q --quiet -h --help' \
else -- "$cur" ) )
_mailman_lists else
fi _mailman_lists
fi
} && } &&
complete -F _newlist newlist complete -F _newlist newlist
@ -338,17 +337,16 @@ complete -F _newlist newlist
have rmlist && have rmlist &&
_rmlist() _rmlist()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--archives -a \ COMPREPLY=( $( compgen -W '--archives -a -h --help' -- "$cur" ) )
-h --help' -- "$cur" ) ) else
else _mailman_lists
_mailman_lists fi
fi
} && } &&
complete -F _rmlist rmlist complete -F _rmlist rmlist
@ -356,29 +354,29 @@ complete -F _rmlist rmlist
have config_list && have config_list &&
_config_list() _config_list()
{ {
local cur prev split=false local cur prev split=false
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
_split_longopt && split=true _split_longopt && split=true
case "$prev" in case "$prev" in
-@(i|o|-inputfile|-outputfile)) -@(i|o|-inputfile|-outputfile))
_filedir _filedir
return 0 return 0
;; ;;
esac esac
$split && return 0 $split && return 0
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--inputfile -i --outputfile -o \ COMPREPLY=( $( compgen -W '--inputfile -i --outputfile -o \
--checkonly -c --verbose -v -h --help' -- "$cur" ) ) --checkonly -c --verbose -v -h --help' -- "$cur" ) )
else else
_mailman_lists _mailman_lists
fi fi
} && } &&
complete -F _config_list $filenames config_list complete -F _config_list $filenames config_list
@ -386,46 +384,46 @@ complete -F _config_list $filenames config_list
have arch && have arch &&
_arch() _arch()
{ {
local cur prev split=false local cur prev split=false
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
_split_longopt && split=true _split_longopt && split=true
case "$prev" in case "$prev" in
-@(w|g|d|--welcome-msg|-goodbye-msg|-digest)) -@(w|g|d|--welcome-msg|-goodbye-msg|-digest))
COMPREPLY=( $( compgen -W 'y n' -- "$cur") ) COMPREPLY=( $( compgen -W 'y n' -- "$cur") )
return 0 return 0
;; ;;
-@(d|-file)) -@(d|-file))
_filedir _filedir
return 0 return 0
;; ;;
esac esac
$split && return 0 $split && return 0
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--wipe -s --start -e --end \ COMPREPLY=( $( compgen -W '--wipe -s --start -e --end -q --quiet -h \
-q --quiet -h --help' -- "$cur" ) ) --help' -- "$cur" ) )
else else
args=$COMP_CWORD args=$COMP_CWORD
for (( i=1; i < COMP_CWORD; i++ )); do for (( i=1; i < COMP_CWORD; i++ )); do
if [[ "${COMP_WORDS[i]}" == -* ]]; then if [[ "${COMP_WORDS[i]}" == -* ]]; then
args=$(($args-1)) args=$(($args-1))
fi fi
done done
case $args in case $args in
1) 1)
_mailman_lists _mailman_lists
;; ;;
2) 2)
_filedir _filedir
;; ;;
esac esac
fi fi
} && } &&
complete -F _arch $filenames arch complete -F _arch $filenames arch
@ -433,15 +431,15 @@ complete -F _arch $filenames arch
have cleanarch && have cleanarch &&
_cleanarch() _cleanarch()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-s --status -n --dry-run \ COMPREPLY=( $( compgen -W '-s --status -n --dry-run -q --quiet -h \
-q --quiet -h --help' -- "$cur" ) ) --help' -- "$cur" ) )
fi fi
} && } &&
complete -F _cleanarch cleanarch complete -F _cleanarch cleanarch
@ -449,29 +447,29 @@ complete -F _cleanarch cleanarch
have inject && have inject &&
_inject() _inject()
{ {
local cur prev split=false local cur prev split=false
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
_split_longopt && split=true _split_longopt && split=true
case "$prev" in case "$prev" in
-@(l|-listname)) -@(l|-listname))
_mailman_lists _mailman_lists
return 0 return 0
;; ;;
esac esac
$split && return 0 $split && return 0
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-l --listname -q --queue \ COMPREPLY=( $( compgen -W '-l --listname -q --queue -h --help' \
-h --help' -- "$cur" ) ) -- "$cur" ) )
else else
_filedir _filedir
fi fi
} && } &&
complete -F _inject $filenames inject complete -F _inject $filenames inject
@ -479,16 +477,17 @@ complete -F _inject $filenames inject
have dumpdb && have dumpdb &&
_dumpdb() _dumpdb()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--marshal -m --pickle -p --noprint -n -h --help' -- "$cur" ) ) COMPREPLY=( $( compgen -W '--marshal -m --pickle -p --noprint -n -h \
else --help' -- "$cur" ) )
_filedir else
fi _filedir
fi
} && } &&
complete -F _dumpdb $filenames dumpdb complete -F _dumpdb $filenames dumpdb
@ -496,17 +495,17 @@ complete -F _dumpdb $filenames dumpdb
have check_db && have check_db &&
_check_db() _check_db()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--all -a --verbose -v \ COMPREPLY=( $( compgen -W '--all -a --verbose -v -h --help' \
-h --help' -- "$cur" ) ) -- "$cur" ) )
else else
_mailman_lists _mailman_lists
fi fi
} && } &&
complete -F _check_db check_db complete -F _check_db check_db
@ -514,14 +513,14 @@ complete -F _check_db check_db
have check_perms && have check_perms &&
_check_perms() _check_perms()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-f -v -h' -- "$cur" ) ) COMPREPLY=( $( compgen -W '-f -v -h' -- "$cur" ) )
fi fi
} && } &&
complete -F _check_perms check_perms complete -F _check_perms check_perms
@ -529,14 +528,14 @@ complete -F _check_perms check_perms
have genaliases && have genaliases &&
_genaliases() _genaliases()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-q --quiet -h --help' -- "$cur" ) ) COMPREPLY=( $( compgen -W '-q --quiet -h --help' -- "$cur" ) )
fi fi
} && } &&
complete -F _genaliases genaliases complete -F _genaliases genaliases
@ -544,14 +543,14 @@ complete -F _genaliases genaliases
have mmsitepass && have mmsitepass &&
_mmsitepass() _mmsitepass()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-c --listcreator -h --help' -- "$cur" ) ) COMPREPLY=( $( compgen -W '-c --listcreator -h --help' -- "$cur" ) )
fi fi
} && } &&
complete -F _mmsitepass mmsitepass complete -F _mmsitepass mmsitepass
@ -559,18 +558,18 @@ complete -F _mmsitepass mmsitepass
have qrunner && have qrunner &&
_qrunner() _qrunner()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
_split_longopt && return 0 _split_longopt && return 0
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-r --runner --once -o \ COMPREPLY=( $( compgen -W '-r --runner --once -o \
-l --list -v --verbose -s --subproc -h --help' -- "$cur" ) ) -l --list -v --verbose -s --subproc -h --help' -- "$cur" ) )
fi fi
} && } &&
complete -F _qrunner qrunner complete -F _qrunner qrunner
@ -578,25 +577,25 @@ complete -F _qrunner qrunner
have mailmanctl && have mailmanctl &&
_mailmanctl() _mailmanctl()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-n --no-restart -u --run-as-user \ COMPREPLY=( $( compgen -W '-n --no-restart -u --run-as-user \
-s --stale-lock-cleanup --quiet -q -h --help' -- "$cur" ) ) -s --stale-lock-cleanup --quiet -q -h --help' -- "$cur" ) )
else else
COMPREPLY=( $( compgen -W 'start stop restart reopen' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'start stop restart reopen' -- "$cur" ) )
fi fi
} && } &&
complete -F _mailmanctl mailmanctl complete -F _mailmanctl mailmanctl
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,77 +3,77 @@
have make || have gmake || have gnumake || have pmake && have make || have gmake || have gnumake || have pmake &&
_make() _make()
{ {
local file makef makef_dir="." makef_inc cur prev i split=false local file makef makef_dir="." makef_inc cur prev i split=false
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
_split_longopt && split=true _split_longopt && split=true
case $prev in case $prev in
-@(f|o|W|-@(?(make|old-|new-)file|assume-@(old|new)|what-if))) -@(f|o|W|-@(?(make|old-|new-)file|assume-@(old|new)|what-if)))
_filedir _filedir
return 0 return 0
;; ;;
-I|-C|--directory|--include-dir) -I|-C|--directory|--include-dir)
_filedir -d _filedir -d
return 0 return 0
;; ;;
esac esac
$split && return 0 $split && return 0
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-b -m -B -C -d -e -f -h -i -I\ 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 \ -j -l -k -n -o -p -q -r -R - s -S -t -v -w -W \
--always-make --directory --debug \ --always-make --directory --debug \
--environment-overrides --file --makefile --help \ --environment-overrides --file --makefile --help \
--ignore-errors --include-dir --jobs --load-average \ --ignore-errors --include-dir --jobs --load-average \
--max-load --keep-going --just-print --dry-run \ --max-load --keep-going --just-print --dry-run \
--recon --old-file --assume-old --print-data-base \ --recon --old-file --assume-old --print-data-base \
--question --no-builtin-rules --no-builtin-variables \ --question --no-builtin-rules --no-builtin-variables \
--silent --quiet --no-keep-goind --stop --touch \ --silent --quiet --no-keep-goind --stop --touch \
--version --print-directory --no-print-directory \ --version --print-directory --no-print-directory \
--what-if --new-file --assume-new \ --what-if --new-file --assume-new \
--warn-undefined-variables' -- "$cur" ) ) --warn-undefined-variables' -- "$cur" ) )
else else
# before we check for makefiles, see if a path was specified # before we check for makefiles, see if a path was specified
# with -C # with -C
for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do
if [[ ${COMP_WORDS[i]} == -C ]]; then if [[ ${COMP_WORDS[i]} == -C ]]; then
# eval for tilde expansion # eval for tilde expansion
eval makef_dir=${COMP_WORDS[i+1]} eval makef_dir=${COMP_WORDS[i+1]}
break break
fi fi
done done
# before we scan for targets, see if a Makefile name was # before we scan for targets, see if a Makefile name was
# specified with -f # specified with -f
for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do
if [[ ${COMP_WORDS[i]} == -f ]]; then if [[ ${COMP_WORDS[i]} == -f ]]; then
# eval for tilde expansion # eval for tilde expansion
eval makef=${COMP_WORDS[i+1]} eval makef=${COMP_WORDS[i+1]}
break break
fi fi
done done
[ -n "$makef" ] && makef="-f ${makef}" [ -n "$makef" ] && makef="-f ${makef}"
[ -n "$makef_dir" ] && makef_dir="-C ${makef_dir}" [ -n "$makef_dir" ] && makef_dir="-C ${makef_dir}"
COMPREPLY=( $( compgen -W "$( make -qp $makef $makef_dir 2>/dev/null | \ COMPREPLY=( $( compgen -W "$( make -qp $makef $makef_dir 2>/dev/null | \
awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ \ awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ \
{split($1,A,/ /);for(i in A)print A[i]}' )" \ {split($1,A,/ /);for(i in A)print A[i]}' )" \
-- "$cur" ) ) -- "$cur" ) )
fi fi
} && } &&
complete -F _make $filenames make gmake gnumake pmake complete -F _make $filenames make gmake gnumake pmake
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -5,69 +5,69 @@
-o $UNAME = OpenBSD ] && -o $UNAME = OpenBSD ] &&
_man() _man()
{ {
local cur i prev sect manpath manext mansect uname local cur i prev sect manpath manext mansect uname
manext="@([0-9lnp]|[0-9][px]|man|3pm)?(.@(gz|bz2|lzma))" manext="@([0-9lnp]|[0-9][px]|man|3pm)?(.@(gz|bz2|lzma))"
mansect="@([0-9lnp]|[0-9][px]|3pm)" mansect="@([0-9lnp]|[0-9][px]|3pm)"
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
if [[ "$prev" == -l ]]; then if [[ "$prev" == -l ]]; then
_filedir $manext _filedir $manext
return 0 return 0
fi fi
_expand || return 0 _expand || return 0
# file based completion if parameter contains / # file based completion if parameter contains /
if [[ "$cur" == */* ]]; then if [[ "$cur" == */* ]]; then
_filedir $manext _filedir $manext
return 0 return 0
fi fi
uname=$( uname -s ) uname=$( uname -s )
if [[ $uname == @(Linux|GNU|GNU/*|FreeBSD|Cygwin|CYGWIN_*) ]]; then if [[ $uname == @(Linux|GNU|GNU/*|FreeBSD|Cygwin|CYGWIN_*) ]]; then
manpath=$( manpath 2>/dev/null || command man --path ) manpath=$( manpath 2>/dev/null || command man --path )
else else
manpath=$MANPATH manpath=$MANPATH
fi fi
if [ -z "$manpath" ]; then if [ -z "$manpath" ]; then
COMPREPLY=( $( compgen -c -- "$cur" ) ) COMPREPLY=( $( compgen -c -- "$cur" ) )
return 0 return 0
fi fi
# determine manual section to search # determine manual section to search
[[ "$prev" == $mansect ]] && sect=$prev || sect='*' [[ "$prev" == $mansect ]] && sect=$prev || sect='*'
manpath=$manpath: manpath=$manpath:
if [ -n "$cur" ]; then if [ -n "$cur" ]; then
manpath="${manpath//://*man$sect/$cur* } ${manpath//://*cat$sect/$cur* }" manpath="${manpath//://*man$sect/$cur* } ${manpath//://*cat$sect/$cur* }"
else else
manpath="${manpath//://*man$sect/ } ${manpath//://*cat$sect/ }" manpath="${manpath//://*man$sect/ } ${manpath//://*cat$sect/ }"
fi fi
# redirect stderr for when path doesn't exist # redirect stderr for when path doesn't exist
COMPREPLY=( $( eval command ls "$manpath" 2>/dev/null ) ) COMPREPLY=( $( eval command ls "$manpath" 2>/dev/null ) )
# weed out directory path names and paths to man pages # weed out directory path names and paths to man pages
COMPREPLY=( ${COMPREPLY[@]##*/?(:)} ) COMPREPLY=( ${COMPREPLY[@]##*/?(:)} )
# strip suffix from man pages # strip suffix from man pages
COMPREPLY=( ${COMPREPLY[@]%.@(gz|bz2|lzma)} ) COMPREPLY=( ${COMPREPLY[@]%.@(gz|bz2|lzma)} )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" ) ) COMPREPLY=( $( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" ) )
if [[ "$prev" != $mansect ]]; then if [[ "$prev" != $mansect ]]; then
# File based completion for the rest, prepending ./ if needed # File based completion for the rest, prepending ./ if needed
# (man 1.6f needs that for man pages in current dir) # (man 1.6f needs that for man pages in current dir)
local start=${#COMPREPLY[@]} local start=${#COMPREPLY[@]}
_filedir $manext _filedir $manext
for (( i=$start; i < ${#COMPREPLY[@]}; i++ )); do for (( i=$start; i < ${#COMPREPLY[@]}; i++ )); do
[[ ${COMPREPLY[i]} == */* ]] || COMPREPLY[i]=./${COMPREPLY[i]} [[ ${COMPREPLY[i]} == */* ]] || COMPREPLY[i]=./${COMPREPLY[i]}
done done
fi fi
return 0 return 0
} }
[ $USERLAND = GNU -o $UNAME = Darwin \ [ $USERLAND = GNU -o $UNAME = Darwin \
-o $UNAME = FreeBSD -o $UNAME = SunOS -o $UNAME = Cygwin \ -o $UNAME = FreeBSD -o $UNAME = SunOS -o $UNAME = Cygwin \
@ -76,8 +76,8 @@ complete -F _man $filenames man apropos whatis
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,48 +3,48 @@
have mc && have mc &&
_mc() _mc()
{ {
local cur prev split=false local cur prev split=false
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
_split_longopt && split=true _split_longopt && split=true
case "$prev" in case "$prev" in
-e|--edit|-v|--view|-l|--ftplog|-P|--printwd) -e|--edit|-v|--view|-l|--ftplog|-P|--printwd)
_filedir _filedir
return 0 return 0
;; ;;
-C|--colors|-D|--debuglevel) -C|--colors|-D|--debuglevel)
# argument required but no completions available # argument required but no completions available
return 0 return 0
;; ;;
-h|--help|-V|--version) -h|--help|-V|--version)
# all other arguments are noop with these # all other arguments are noop with these
return 0 return 0
;; ;;
esac esac
$split && return 0 $split && return 0
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-a --stickchars -b --nocolor -c \ COMPREPLY=( $( compgen -W '-a --stickchars -b --nocolor -c \
--color -C --colors -d --nomouse -e --edit -f \ --color -C --colors -d --nomouse -e --edit -f \
--datadir -k --resetsoft -l --ftplog -P --printwd \ --datadir -k --resetsoft -l --ftplog -P --printwd \
-s --slow -t --termcap -u --nosubshell -U --subshell \ -s --slow -t --termcap -u --nosubshell -U --subshell \
-v --view -V --version -x --xterm -D --debuglevel -h \ -v --view -V --version -x --xterm -D --debuglevel -h \
--help' -- "$cur" ) ) --help' -- "$cur" ) )
else else
_filedir -d _filedir -d
fi fi
} && } &&
complete -F _mc $filenames mc complete -F _mc $filenames mc
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,84 +3,83 @@
have mcrypt || have mdecrypt && have mcrypt || have mdecrypt &&
_mcrypt() _mcrypt()
{ {
local cur prev i decrypt local cur prev i decrypt
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-@(g|-openpgp-z)) -@(g|-openpgp-z))
COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9' \ COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9' -- "$cur" ) )
-- "$cur" ) ) return 0
return 0 ;;
;; -@(o|-keymode))
-@(o|-keymode)) COMPREPLY=( $( compgen -W '$( mcrypt --list-keymodes \
COMPREPLY=( $( compgen -W '$( mcrypt --list-keymodes \ 2>/dev/null )' -- "$cur" ) )
2>/dev/null )' -- "$cur" ) ) return 0
return 0 ;;
;; -@(m|-mode))
-@(m|-mode)) COMPREPLY=( $( compgen -W "$( mcrypt --list \
COMPREPLY=( $( compgen -W "$( mcrypt --list \ 2>/dev/null | sed -e 's/.*: //' -e 's/ $//' | \
2>/dev/null | sed -e 's/.*: //' -e 's/ $//' | \ sort | uniq )" -- "$cur" ) )
sort | uniq )" -- "$cur" ) ) return 0
return 0 ;;
;; -@(a|-algorithm))
-@(a|-algorithm)) COMPREPLY=( $( compgen -W "$( mcrypt --list 2>/dev/null | \
COMPREPLY=( $( compgen -W "$( mcrypt --list \ awk '{print $1}' )" -- "$cur" ) )
2>/dev/null | awk '{print $1}' )" -- "$cur" ) ) return 0
return 0 ;;
;; -@(h|-hash))
-@(h|-hash)) COMPREPLY=( $( compgen -W '$( mcrypt --list-hash 2>/dev/null | \
COMPREPLY=( $( compgen -W '$( mcrypt --list-hash \ sed -e 1d )' -- "$cur" ) )
2>/dev/null | sed -e 1d )' -- "$cur" ) ) return 0
return 0 ;;
;; -@(k|s|-@(key?(size))))
-@(k|s|-@(key?(size)))) return 0
return 0 ;;
;; -@(f|c|-@(keyfile|config)))
-@(f|c|-@(keyfile|config))) _filedir
_filedir return 0
return 0 ;;
;; --@(algorithm|mode)s-directory)
--@(algorithm|mode)s-directory) _filedir -d
_filedir -d return 0
return 0 ;;
;; esac
esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-g --openpgp --openpgp-z -d \ COMPREPLY=( $( compgen -W '-g --openpgp --openpgp-z -d \
--decrypt -s --keysize -o --keymode -f --keyfile \ --decrypt -s --keysize -o --keymode -f --keyfile \
-c --config -a --algorithm --algorithms-directory \ -c --config -a --algorithm --algorithms-directory \
-m --mode --modes-directory -h --hash -k --key \ -m --mode --modes-directory -h --hash -k --key \
--noiv -b --bare -z --gzip -p --bzip2 --flush -l \ --noiv -b --bare -z --gzip -p --bzip2 --flush -l \
--doublecheck -u --unlink --nodelete -t --time -F \ --doublecheck -u --unlink --nodelete -t --time -F \
--force --echo -r --random --list --list-keymodes \ --force --echo -r --random --list --list-keymodes \
--list-hash -V --verbose -q --quiet --help -v \ --list-hash -V --verbose -q --quiet --help -v \
--version -L --license' -- "$cur" ) ) --version -L --license' -- "$cur" ) )
elif [[ ${COMP_WORDS[0]} == mdecrypt ]]; then elif [[ ${COMP_WORDS[0]} == mdecrypt ]]; then
_filedir '@(nc)' _filedir '@(nc)'
else else
decrypt=0 decrypt=0
for (( i=1; i < ${#COMP_WORDS[@]}-1; i++ )); do for (( i=1; i < ${#COMP_WORDS[@]}-1; i++ )); do
if [[ ${COMP_WORDS[i]} == -@(d|-decrypt) ]]; then if [[ ${COMP_WORDS[i]} == -@(d|-decrypt) ]]; then
_filedir '@(nc)' _filedir '@(nc)'
decrypt=1 decrypt=1
break break
fi fi
done done
if [[ $decrypt -eq 0 ]]; then if [[ $decrypt -eq 0 ]]; then
_filedir _filedir
fi fi
fi fi
} && } &&
complete $filenames -F _mcrypt mcrypt mdecrypt complete $filenames -F _mcrypt mcrypt mdecrypt
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,162 +3,185 @@
have mdadm && { have mdadm && {
_mdadm_raid_level() _mdadm_raid_level()
{ {
local mode local mode
for (( i=1; i < COMP_CWORD; i++ )); do for (( i=1; i < COMP_CWORD; i++ )); do
case ${COMP_WORDS[i]} in case ${COMP_WORDS[i]} in
-@(C|-create)) -@(C|-create))
mode=create mode=create
break break
;; ;;
-@(B|-build)) -@(B|-build))
mode=build mode=build
break break
;; ;;
esac esac
done done
case $mode in case $mode in
create) create)
COMPREPLY=( $( compgen -W 'linear raid0 0 stripe raid1 1 mirror raid4 4 raid5 5 raid6 6 raid10 10 multipath mp faulty' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'linear raid0 0 stripe raid1 1 mirror \
;; raid4 4 raid5 5 raid6 6 raid10 10 multipath mp faulty' \
build) -- "$cur" ) )
COMPREPLY=( $( compgen -W 'linear stripe raid0 0 raid1 multipath mp faulty' -- "$cur" ) ) ;;
;; build)
esac COMPREPLY=( $( compgen -W 'linear stripe raid0 0 raid1 multipath \
mp faulty' -- "$cur" ) )
;;
esac
} }
_mdadm_raid_layout() _mdadm_raid_layout()
{ {
local level local level
for (( i=1; i < COMP_CWORD; i++ )); do for (( i=1; i < COMP_CWORD; i++ )); do
if [[ "${COMP_WORDS[i]}" == -@(l|-level) ]]; then if [[ "${COMP_WORDS[i]}" == -@(l|-level) ]]; then
level=${COMP_WORDS[i+1]} level=${COMP_WORDS[i+1]}
break break
fi fi
done done
case $level in case $level in
raid5) raid5)
COMPREPLY=( $( compgen -W 'left-asymmetric left-symmetric right-asymmetric right-symmetric la ra ls rs' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'left-asymmetric left-symmetric \
;; right-asymmetric right-symmetric la ra ls rs' -- "$cur" ) )
raid10) ;;
COMPREPLY=( $( compgen -W 'n o p' -- "$cur" ) ) raid10)
;; COMPREPLY=( $( compgen -W 'n o p' -- "$cur" ) )
faulty) ;;
COMPREPLY=( $( compgen -W 'write-transient wt read-transient rt write-persistent wp read-persistent rp write-all read-fixable rf clear flush none' -- $cur ) ) faulty)
;; COMPREPLY=( $( compgen -W 'write-transient wt read-transient rt \
esac write-persistent wp read-persistent rp write-all read-fixable \
rf clear flush none' -- $cur ) )
;;
esac
} }
_mdadm_auto_flag() _mdadm_auto_flag()
{ {
COMPREPLY=( $( compgen -W 'no yes md mdp part p' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'no yes md mdp part p' -- "$cur" ) )
} }
_mdadm_update_flag() _mdadm_update_flag()
{ {
COMPREPLY=( $( compgen -W 'sparc2.2 summaries uuid name homehost resync byteorder super-minor' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'sparc2.2 summaries uuid name homehost resync \
byteorder super-minor' -- "$cur" ) )
} }
_mdadm() _mdadm()
{ {
local cur prev mode options local cur prev mode options
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
# --name value style option # --name value style option
case $prev in case $prev in
-@(c|b)) -@(c|b))
_filedir _filedir
return 0 return 0
;; ;;
-l) -l)
_mdadm_raid_level _mdadm_raid_level
return 0 return 0
;; ;;
-p) -p)
_mdadm_raid_layout _mdadm_raid_layout
return 0 return 0
;; ;;
-a) -a)
_mdadm_auto_flag _mdadm_auto_flag
return 0 return 0
;; ;;
-U) -U)
_mdadm_update_flag _mdadm_update_flag
return 0 return 0
;; ;;
esac esac
# --name=value style option # --name=value style option
if [[ "$cur" == *=* ]]; then if [[ "$cur" == *=* ]]; then
prev=${cur/=*/} prev=${cur/=*/}
cur=${cur/*=/} cur=${cur/*=/}
case "$prev" in case "$prev" in
--@(config|bitmap|backup-file)) --@(config|bitmap|backup-file))
_filedir _filedir
return 0 return 0
;; ;;
--level) --level)
_mdadm_raid_level _mdadm_raid_level
return 0 return 0
;; ;;
--@(layout|parity)) --@(layout|parity))
_mdadm_raid_layout _mdadm_raid_layout
return 0 return 0
;; ;;
--auto) --auto)
_mdadm_auto_flag _mdadm_auto_flag
return 0 return 0
;; ;;
--update) --update)
_mdadm_update_flag _mdadm_update_flag
return 0 return 0
;; ;;
esac esac
fi fi
options='-h --help --help-options -V --version -v --verbose -q --quiet -b --brief -f --force -c --config= -s --scan -e --metadata= --homehost=' options='-h --help --help-options -V --version -v --verbose -q --quiet -b \
--brief -f --force -c --config= -s --scan -e --metadata= --homehost='
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
if [[ $COMP_CWORD -eq 1 ]] ; then if [[ $COMP_CWORD -eq 1 ]] ; then
COMPREPLY=( $( compgen -W "$options -A --assemble -B --build -C --create -F --follow --monitor -G --grow" -- "$cur" ) ) COMPREPLY=( $( compgen -W "$options -A --assemble -B --build -C \
else --create -F --follow --monitor -G --grow" -- "$cur" ) )
case ${COMP_WORDS[COMP_CWORD-1]} in else
-@(A|-assemble)) case ${COMP_WORDS[COMP_CWORD-1]} in
COMPREPLY=( $( compgen -W "$options -u --uuid= -m --super-minor= -N --name= -f --force -R --run --no-degraded -a --auto -b --bitmap= --backup-file= -U --update= --auto-update-homehost" -- "$cur" ) ) -@(A|-assemble))
;; COMPREPLY=( $( compgen -W "$options -u --uuid= -m \
-@(B|C|G|-build|-create|-grow)) --super-minor= -N --name= -f --force -R --run \
COMPREPLY=( $( compgen -W "$options -n --raid-devices= -x --spare-devices= -z --size= -c --chunk= --rounding= -l --level= -p --layout= --parity= -b --bitmap= --bitmap-chunk= -W --write-mostly --write-behind= --assume-clean --backup-file= -N --name= -R --run -f --force -a --auto" -- "$cur" ) ) --no-degraded -a --auto -b --bitmap= --backup-file= \
;; -U --update= --auto-update-homehost" -- "$cur" ) )
-@(F|-follow|-monitor)) ;;
COMPREPLY=( $( compgen -W "$options -m --mail -p --program --alert -y --syslog -d --delay -f --daemonise -i --pid-file -1 --oneshot -t --test" -- "$cur" ) ) -@(B|C|G|-build|-create|-grow))
COMPREPLY=( $( compgen -W "$options -n --raid-devices= -x \
--spare-devices= -z --size= -c --chunk= --rounding= -l \
--level= -p --layout= --parity= -b --bitmap= \
--bitmap-chunk= -W --write-mostly --write-behind= \
--assume-clean --backup-file= -N --name= -R --run -f \
--force -a --auto" -- "$cur" ) )
;;
-@(F|-follow|-monitor))
COMPREPLY=( $( compgen -W "$options -m --mail -p --program \
--alert -y --syslog -d --delay -f --daemonise -i \
--pid-file -1 --oneshot -t --test" -- "$cur" ) )
;; ;;
@(/dev/*|--add|--fail|--remove)) @(/dev/*|--add|--fail|--remove))
COMPREPLY=( $( compgen -W "$options -a --add --re-add -r --remove -f --fail --set-faulty" -- "$cur" ) ) COMPREPLY=( $( compgen -W "$options -a --add --re-add -r \
;; --remove -f --fail --set-faulty" -- "$cur" ) )
*) ;;
COMPREPLY=( $( compgen -W "$options -Q --query -D --detail -E --examine --sparc2.2 -X --examine-bitmap -R --run -S --stop -o --readonly -w --readwrite --zero-superblock -t --test" -- "$cur" ) ) *)
;; COMPREPLY=( $( compgen -W "$options -Q --query -D --detail \
esac -E --examine --sparc2.2 -X --examine-bitmap -R --run \
fi -S --stop -o --readonly -w --readwrite \
else --zero-superblock -t --test" -- "$cur" ) )
cur=${cur:=/dev/} ;;
_filedir esac
fi fi
else
cur=${cur:=/dev/}
_filedir
fi
} }
complete -F _mdadm mdadm complete -F _mdadm mdadm
} }
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,49 +3,52 @@
have minicom && have minicom &&
_minicom() _minicom()
{ {
local cur prev confdir local cur prev confdir
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in case $prev in
-@(a|c)) -@(a|c))
COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
return 0 return 0
;; ;;
-@(S|C)) -@(S|C))
_filedir _filedir
return 0 return 0
;; ;;
-P) -P)
COMPREPLY=( $( command ls /dev/tty* ) ) COMPREPLY=( $( command ls /dev/tty* ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]} ${COMPREPLY[@]#/dev/}' -- "$cur" ) ) COMPREPLY=( $( compgen -W '${COMPREPLY[@]} ${COMPREPLY[@]#/dev/}' \
return 0 -- "$cur" ) )
;; return 0
esac ;;
esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-s -o -m -M -z -l -L -w -a -t \ COMPREPLY=( $( compgen -W '-s -o -m -M -z -l -L -w -a -t \
-c -S -d -p -C -T -7 -8' -- "$cur" ) ) -c -S -d -p -C -T -7 -8' -- "$cur" ) )
return 0 return 0
else else
[ -n "$( command ls /etc/minirc.* 2>/dev/null)" ] && confdir=/etc [ -n "$( command ls /etc/minirc.* 2>/dev/null)" ] \
[ -n "$( command ls /etc/minicom/minirc.* 2>/dev/null)" ] && confdir=/etc/minicom && confdir=/etc
if [ -n "$confdir" ]; then [ -n "$( command ls /etc/minicom/minirc.* 2>/dev/null)" ] \
COMPREPLY=( $( compgen -W '$( command ls $confdir/minirc.* | \ && confdir=/etc/minicom
sed -e "s|$confdir/minirc.||")' -- "$cur" ) ) if [ -n "$confdir" ]; then
return 0 COMPREPLY=( $( compgen -W '$( command ls $confdir/minirc.* | \
fi sed -e "s|$confdir/minirc.||")' -- "$cur" ) )
fi return 0
fi
fi
} && } &&
complete -F _minicom $default minicom complete -F _minicom $default minicom
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,58 +3,58 @@
have mkinitrd && have mkinitrd &&
_mkinitrd() _mkinitrd()
{ {
local cur prev args split=false local cur prev args split=false
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
_split_longopt && split=true _split_longopt && split=true
case "$prev" in case "$prev" in
--@(preload|with|builtin)) --@(preload|with|builtin))
_modules _modules
return 0 return 0
;; ;;
--@(fstab|dsdt)) --@(fstab|dsdt))
_filedir _filedir
return 0 return 0
;; ;;
--net-dev) --net-dev)
_available_interfaces _available_interfaces
return 0 return 0
;; ;;
esac esac
$split && return 0 $split && return 0
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--version --help -v -f --preload \ COMPREPLY=( $( compgen -W '--version --help -v -f --preload \
--force-scsi-probe --omit-scsi-modules \ --force-scsi-probe --omit-scsi-modules \
--omit-ide-modules --image-version --force-raid-probe \ --omit-ide-modules --image-version --force-raid-probe \
--omit-raid-modules --with --force-lvm-probe \ --omit-raid-modules --with --force-lvm-probe \
--omit-lvm-modules --builtin --omit-dmraid --net-dev \ --omit-lvm-modules --builtin --omit-dmraid --net-dev \
--fstab --nocompress --dsdt --bootchart' -- "$cur" ) ) --fstab --nocompress --dsdt --bootchart' -- "$cur" ) )
else else
_count_args _count_args
case $args in case $args in
1) 1)
_filedir _filedir
;; ;;
2) 2)
_kernel_versions _kernel_versions
;; ;;
esac esac
fi fi
} && } &&
complete -F _mkinitrd mkinitrd complete -F _mkinitrd mkinitrd
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,82 +3,83 @@
have mock && have mock &&
_mock() _mock()
{ {
local cur prev plugins cfgdir split=false local cur prev plugins cfgdir split=false
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
plugins='tmpfs root_cache yum_cache bind_mount ccache' plugins='tmpfs root_cache yum_cache bind_mount ccache'
cfgdir=/etc/mock cfgdir=/etc/mock
count=0 count=0
for i in "${COMP_WORDS[@]}" ; do for i in "${COMP_WORDS[@]}" ; do
[ $count -eq $COMP_CWORD ] && break [ $count -eq $COMP_CWORD ] && break
if [[ "$i" == --configdir ]] ; then if [[ "$i" == --configdir ]] ; then
cfgdir="${COMP_WORDS[((count+1))]}" cfgdir="${COMP_WORDS[((count+1))]}"
elif [[ "$i" == --configdir=* ]] ; then elif [[ "$i" == --configdir=* ]] ; then
cfgdir=${i/*=/} cfgdir=${i/*=/}
fi fi
count=$((++count)) count=$((++count))
done done
_split_longopt && split=true _split_longopt && split=true
case $prev in case $prev in
-@(h|-help|-copy@(in|out)|-arch|D|-define|-with?(out)|-uniqueext|-rpmbuild_timeout|-sources|-cwd)) -@(h|-help|-copy@(in|out)|-arch|D|-define|-with?(out)|-uniqueext|-rpmbuild_timeout|-sources|-cwd))
return 0 return 0
;; ;;
-r|--root) -r|--root)
COMPREPLY=( $( compgen -W "$( command ls $cfgdir )" \ COMPREPLY=( $( compgen -W "$( command ls $cfgdir )" -- $cur ) )
-- $cur ) ) COMPREPLY=( ${COMPREPLY[@]/%.cfg/} )
COMPREPLY=( ${COMPREPLY[@]/%.cfg/} ) return 0
return 0 ;;
;; --@(config|result)dir)
--@(config|result)dir) _filedir -d
_filedir -d return 0
return 0 ;;
;; --spec)
--spec) _filedir spec
_filedir spec return 0
return 0 ;;
;; --target)
--target) # Yep, compatible archs, not compatible build archs
# Yep, compatible archs, not compatible build archs # (e.g. ix86 chroot builds in x86_64 mock host)
# (e.g. ix86 chroot builds in x86_64 mock host) # This would actually depend on what the target root
# This would actually depend on what the target root # can be used to build for...
# can be used to build for... COMPREPLY=( $( compgen -W "$( command rpm --showrc | \
COMPREPLY=( $( compgen -W "$( command rpm --showrc | sed -ne 's/^\s*compatible\s\+archs\s*:\s*\(.*\)/\1/i p' )" -- "$cur" ) ) sed -ne 's/^\s*compatible\s\+archs\s*:\s*\(.*\)/\1/i p' )" \
return 0 -- "$cur" ) )
;; return 0
--@(en|dis)able-plugin) ;;
COMPREPLY=( $( compgen -W "$plugins" -- "$cur" ) ) --@(en|dis)able-plugin)
return 0 COMPREPLY=( $( compgen -W "$plugins" -- "$cur" ) )
;; return 0
esac ;;
esac
$split && return 0 $split && return 0
if [[ "$cur" == -* ]] ; then if [[ "$cur" == -* ]] ; then
COMPREPLY=( $( compgen -W '--version -h --help --rebuild \ COMPREPLY=( $( compgen -W '--version -h --help --rebuild \
--buildsrpm --shell --chroot --clean --init \ --buildsrpm --shell --chroot --clean --init \
--installdeps --install --update --orphanskill \ --installdeps --install --update --orphanskill \
--copyin --copyout -r --root --offline --no-clean \ --copyin --copyout -r --root --offline --no-clean \
--cleanup-after --no-cleanup-after --arch --target \ --cleanup-after --no-cleanup-after --arch --target \
-D --define --with --without --resultdir --uniqueext \ -D --define --with --without --resultdir --uniqueext \
--configdir --rpmbuild_timeout --unpriv --cwd --spec \ --configdir --rpmbuild_timeout --unpriv --cwd --spec \
--sources -v --verbose -q --quiet --trace \ --sources -v --verbose -q --quiet --trace \
--enable-plugin --disable-plugin --print-root-path' \ --enable-plugin --disable-plugin --print-root-path' \
-- "$cur" ) ) -- "$cur" ) )
else else
_filedir '?(no)src.rpm' _filedir '?(no)src.rpm'
fi fi
} && } &&
complete -F _mock $filenames mock complete -F _mock $filenames mock
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -56,26 +56,24 @@ _module () {
COMPREPLY=( $(compgen -W "$options" -- "$cur") ) COMPREPLY=( $(compgen -W "$options" -- "$cur") )
elif [ $COMP_CWORD -eq 2 ] ; then elif [ $COMP_CWORD -eq 2 ] ; then
case "$prev" in
case "$prev" in @(add|display|help|load|show|whatis))
@(add|display|help|load|show|whatis)) COMPREPLY=( $(_module_avail "$cur") )
COMPREPLY=( $(_module_avail "$cur") ) ;;
;; @(rm|switch|swap|unload|update))
COMPREPLY=( $(_module_list "$cur") )
@(rm|switch|swap|unload|update)) ;;
COMPREPLY=( $(_module_list "$cur") ) unuse)
;; COMPREPLY=( $(_module_path "$cur") )
unuse) ;;
COMPREPLY=( $(_module_path "$cur") ) esac
;; elif [ $COMP_CWORD -eq 3 ] ; then
esac case ${COMP_WORDS[1]} in
elif [ $COMP_CWORD -eq 3 ] ; then @(sw?(ap|itch)))
case ${COMP_WORDS[1]} in COMPREPLY=( $(_module_avail "$cur") )
@(sw?(ap|itch))) ;;
COMPREPLY=( $(_module_avail "$cur") ) esac
;;
esac
fi fi
return 0 return 0
} }
@ -84,8 +82,8 @@ complete -F _module $default module
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,100 +3,84 @@
have monodevelop && have monodevelop &&
_monodevelop() _monodevelop()
{ {
local cur local cur
cur=`_get_cword` cur=`_get_cword`
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-? -help \ COMPREPLY=( $( compgen -W '-? -help -help2 -ipc-tcp -newwindow -nologo \
-help2 \ -usage -V -version' -- "$cur" ) )
-ipc-tcp \ else
-newwindow \ _filedir
-nologo \ fi
-usage \ return 0
-V -version' -- "$cur" ) )
else
_filedir
fi
return 0
} && } &&
complete -F _monodevelop monodevelop complete -F _monodevelop monodevelop
have mdtool && have mdtool &&
_mdtool() _mdtool()
{ {
local cur prev command i local cur prev command i
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
if [[ ${COMP_WORDS[i]} == @(build|generate-makefiles|setup) ]]; then if [[ ${COMP_WORDS[i]} == @(build|generate-makefiles|setup) ]]; then
command=${COMP_WORDS[i]} command=${COMP_WORDS[i]}
fi fi
done done
if [[ -n "$command" ]]; then if [[ -n "$command" ]]; then
case $command in case $command in
"build") "build")
COMPREPLY=( $( compgen -W '--f --buildfile --p --project' -S":" -- "$cur" ) ) COMPREPLY=( $( compgen -W '--f --buildfile --p --project' \
# TODO: This does not work :( -S":" -- "$cur" ) )
#if [[ "$prev" == *: ]]; then # TODO: This does not work :(
# case "$prev" in #if [[ "$prev" == *: ]]; then
# @(--p:|--project:)) # case "$prev" in
# COMPREPLY=( $( compgen -f -G "*.mdp" -- "$cur" ) ) # @(--p:|--project:))
# ;; # COMPREPLY=( $( compgen -f -G "*.mdp" -- "$cur" ) )
# @(--f:|--buildfile:)) # ;;
# COMPREPLY=( $( compgen -f -G "*.mdp" -G "*.mds" -- "$cur" ) ) # @(--f:|--buildfile:))
# ;; # COMPREPLY=( $( compgen -f -G "*.mdp" -G "*.mds" -- "$cur" ) )
# esac # ;;
#fi # esac
return 0 #fi
;; return 0
"generate-makefiles") ;;
COMPREPLY=( $( compgen $filenames -G"*.mds" -- "$cur" ) ) "generate-makefiles")
if [[ "$prev" == *mds ]]; then COMPREPLY=( $( compgen $filenames -G"*.mds" -- "$cur" ) )
COMPREPLY=( $( compgen -W '--simple-makefiles --s --d:' -- "$cur" ) ) if [[ "$prev" == *mds ]]; then
fi COMPREPLY=( $( compgen -W '--simple-makefiles --s --d:' \
return 0 -- "$cur" ) )
;; fi
"setup") return 0
# TODO: at least return filenames after these options. ;;
COMPREPLY=( $( compgen -W 'install i \ "setup")
uninstall u \ # TODO: at least return filenames after these options.
check-install ci \ COMPREPLY=( $( compgen -W 'install i uninstall u check-install \
update up \ ci update up list l list-av la list-update lu rep-add ra \
list l \ rep-remove rr rep-update ru rep-list rl reg-update \
list-av la \ reg-build rgu info rep-build rb pack p help h dump-file' \
list-update lu \ -- "$cur" ) )
rep-add ra \ return 0
rep-remove rr \ ;;
rep-update ru \ esac
rep-list rl \ fi
reg-update reg-build rgu \
info \
rep-build rb \
pack p \
help h \
dump-file' -- "$cur" ) )
return 0
;;
esac
fi
COMPREPLY=( $( compgen -W 'gsetup build dbgen project-export \ COMPREPLY=( $( compgen -W 'gsetup build dbgen project-export \
generate-makefiles gettext-update \ generate-makefiles gettext-update setup -q' -- "$cur" ) )
setup -q' -- "$cur" ) )
return 0 return 0
} && } &&
complete -F _mdtool $filenames mdtool complete -F _mdtool $filenames mdtool
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,269 +3,240 @@
have mplayer && { have mplayer && {
_mplayer_options_list() _mplayer_options_list()
{ {
cur=${cur%\\} cur=${cur%\\}
COMPREPLY=( $( compgen -W "$( $1 $2 help 2>/dev/null | \ COMPREPLY=( $( compgen -W "$( $1 $2 help 2>/dev/null | \
sed -e '1,/^Available/d' | awk '{print $1}' | \ sed -e '1,/^Available/d' | awk '{print $1}' | \
sed -e 's/:$//' -e 's/^'${2#-}'$//' -e 's/<.*//' )" -- "$cur" ) ) sed -e 's/:$//' -e 's/^'${2#-}'$//' -e 's/<.*//' )" -- "$cur" ) )
} }
_mplayer() _mplayer()
{ {
local cmd cur prev skinsdir IFS=$' \t\n' i j k=0 local cmd cur prev skinsdir IFS=$' \t\n' i j k=0
COMPREPLY=() COMPREPLY=()
cmd=${COMP_WORDS[0]} cmd=${COMP_WORDS[0]}
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-@([av][cfo]|[av]fm|vop|fstype|demuxer|o[av]c|of|profile)) -@([av][cfo]|[av]fm|vop|fstype|demuxer|o[av]c|of|profile))
_mplayer_options_list $cmd $prev _mplayer_options_list $cmd $prev
return 0 return 0
;; ;;
-audiofile) -audiofile)
_filedir '@(mp3|MP3|mpg|MPG|ogg|OGG|w?(a)v|W?(A)V|mid|MID|flac|FLAC|mka|MKA|ape|APE)' _filedir '@(mp3|MP3|mpg|MPG|ogg|OGG|w?(a)v|W?(A)V|mid|MID|flac|FLAC|mka|MKA|ape|APE)'
return 0 return 0
;; ;;
-font) -font)
_filedir '@(desc|ttf)' _filedir '@(desc|ttf)'
return 0 return 0
;; ;;
-sub) -sub)
_filedir '@(srt|SRT|sub|SUB|txt|TXT|utf|UTF|rar|RAR|mpsub|smi|js|ssa|SSA|ass|ASS)' _filedir '@(srt|SRT|sub|SUB|txt|TXT|utf|UTF|rar|RAR|mpsub|smi|js|ssa|SSA|ass|ASS)'
return 0 return 0
;; ;;
-vobsub) -vobsub)
_filedir '@(idx|IDX|ifo|IFO|sub|SUB)' _filedir '@(idx|IDX|ifo|IFO|sub|SUB)'
IFS=$'\t\n' IFS=$'\t\n'
COMPREPLY=( $( for i in "${COMPREPLY[@]}"; do COMPREPLY=( $( for i in "${COMPREPLY[@]}"; do
if [ -f $i -a -r $i ]; then if [ -f $i -a -r $i ]; then
echo ${i%.*} echo ${i%.*}
else else
echo $i echo $i
fi fi
done ) ) done ) )
IFS=$' \t\n' IFS=$' \t\n'
return 0 return 0
;; ;;
-ifo) -ifo)
_filedir '@(ifo|IFO)' _filedir '@(ifo|IFO)'
return 0 return 0
;; ;;
-cuefile) -cuefile)
_filedir '@(bin|BIN|cue|CUE)' _filedir '@(bin|BIN|cue|CUE)'
return 0 return 0
;; ;;
-skin) -skin)
# if you don't have installed mplayer in /usr you # if you don't have installed mplayer in /usr you
# may want to set the MPLAYER_SKINS_DIR global variable # may want to set the MPLAYER_SKINS_DIR global variable
if [ -n "$MPLAYER_SKINS_DIR" ]; then if [ -n "$MPLAYER_SKINS_DIR" ]; then
skinsdir=$MPLAYER_SKINS_DIR skinsdir=$MPLAYER_SKINS_DIR
else else
skinsdir=/usr/share/mplayer/Skin skinsdir=/usr/share/mplayer/Skin
fi fi
IFS=$'\t\n' IFS=$'\t\n'
for i in ~/.mplayer/Skin $skinsdir; do for i in ~/.mplayer/Skin $skinsdir; do
if [ -d $i -a -r $i ]; then if [ -d $i -a -r $i ]; then
for j in $( compgen -d $i/$cur ); do for j in $( compgen -d $i/$cur ); do
COMPREPLY[$k]=${j#$i/} COMPREPLY[$k]=${j#$i/}
k=$((++k)) k=$((++k))
done done
fi fi
done done
IFS=$' \t\n' IFS=$' \t\n'
return 0 return 0
;; ;;
-@(mixer|@(cdrom|dvd)-device|dvdauth|fb|zrdev)) -@(mixer|@(cdrom|dvd)-device|dvdauth|fb|zrdev))
cur=${cur:=/dev/} cur=${cur:=/dev/}
_filedir _filedir
return 0 return 0
;; ;;
-@(edl?(out)|lircconf|menu-cfg|playlist|csslib|dumpfile)| \ -@(edl?(out)|lircconf|menu-cfg|playlist|csslib|dumpfile)| \
-@(subfile|vobsub|aofile|fbmodeconfig|include|o|dvdkey)| \ -@(subfile|vobsub|aofile|fbmodeconfig|include|o|dvdkey)| \
-passlogfile) -passlogfile)
_filedir _filedir
return 0 return 0
;; ;;
-@(auto@(q|sync)|loop|menu-root|speed|sstep|aid|alang)| \ -@(auto@(q|sync)|loop|menu-root|speed|sstep|aid|alang)| \
-@(?(@(audio|sub)-)demuxer|bandwidth|cache|chapter)| \ -@(?(@(audio|sub)-)demuxer|bandwidth|cache|chapter)| \
-@(dvd?(angle)|fps|frames|mc|passwd|user|sb|srate|ss|vcd)| \ -@(dvd?(angle)|fps|frames|mc|passwd|user|sb|srate|ss|vcd)| \
-@(vi?(d|vo)|ffactor|sid|slang|spu@(align|aa|gauss))| \ -@(vi?(d|vo)|ffactor|sid|slang|spu@(align|aa|gauss))| \
-@(vobsubid|delay|bpp|brightness|contrast|dfbopts|display)| \ -@(vobsubid|delay|bpp|brightness|contrast|dfbopts|display)| \
-@(fbmode|geometry|guiwid|hue|icelayer|screen[wh]|wid)| \ -@(fbmode|geometry|guiwid|hue|icelayer|screen[wh]|wid)| \
-@(monitor@(aspect|-@(dotclock|[hv]freq))|panscan|saturation)| \ -@(monitor@(aspect|-@(dotclock|[hv]freq))|panscan|saturation)| \
-@(xineramascreen|zr@(crop|norm|quality|[xy]doff|[vh]dec))| \ -@(xineramascreen|zr@(crop|norm|quality|[xy]doff|[vh]dec))| \
-@(aspect|pp|x|y|xy|z|stereo|audio-@(density|delay|preload))| \ -@(aspect|pp|x|y|xy|z|stereo|audio-@(density|delay|preload))| \
-@(endpos|osdlevel|ffourcc|sws|channels|skiplimit|format)| \ -@(endpos|osdlevel|ffourcc|sws|channels|skiplimit|format)| \
-@(ofps|aa@(driver|@(osd|sub)color)|vobsubout?(i@(ndex|d)))| \ -@(ofps|aa@(driver|@(osd|sub)color)|vobsubout?(i@(ndex|d)))| \
-sub@(-bg-@(alpha|color)|cp|delay|fps|pos|align|width)| \ -sub@(-bg-@(alpha|color)|cp|delay|fps|pos|align|width)| \
-sub@(font-@(blur|outline|autoscale|encoding|@(osd|text)-scale))) -sub@(font-@(blur|outline|autoscale|encoding|@(osd|text)-scale)))
return 0 return 0
;; ;;
-lavdopts) -lavdopts)
COMPREPLY=( $( compgen -W 'ec er= bug= idct= gray' \ COMPREPLY=( $( compgen -W 'ec er= bug= idct= gray' -- "$cur" ) )
-- "$cur" ) ) return 0
return 0 ;;
;; -lavcopts)
-lavcopts) COMPREPLY=( $( compgen -W 'vcodec= vqmin= vqscale= vqmax= mbqmin= \
COMPREPLY=( $( compgen -W 'vcodec= vqmin= vqscale= \ mbqmax= vqdiff= vmax_b_frames= vme= vhq v4mv keyint= \
vqmax= mbqmin= mbqmax= vqdiff= \ vb_strategy= vpass= aspect= vbitrate= vratetol= vrc_maxrate= \
vmax_b_frames= vme= vhq v4mv \ vrc_minrate= vrc_buf_size= vb_qfactor= vi_qfactor= vb_qoffset= \
keyint= vb_strategy= vpass= \ vi_qoffset= vqblur= vqcomp= vrc_eq= vrc_override= \
aspect= vbitrate= vratetol= \ vrc_init_cplx= vqsquish= vlelim= vcelim= vstrict= vdpart \
vrc_maxrate= vrc_minrate= \ vpsize= gray vfdct= idct= lumi_mask= dark_mask= tcplx_mask= \
vrc_buf_size= vb_qfactor= vi_qfactor= \ scplx_mask= naq ildct format= pred qpel precmp= cmp= subcmp= \
vb_qoffset= vi_qoffset= vqblur= \ predia= dia= trell last_pred= preme= subq= psnr mpeg_quant aic \
vqcomp= vrc_eq= vrc_override= \ umv' -- "$cur" ) )
vrc_init_cplx= vqsquish= vlelim= \ return 0
vcelim= vstrict= vdpart vpsize= gray \ ;;
vfdct= idct= lumi_mask= dark_mask= \ -ssf)
tcplx_mask= scplx_mask= naq ildct \ COMPREPLY=( $( compgen -W 'lgb= cgb= ls= cs= chs= cvs=' -- "$cur" ) )
format= pred qpel precmp= cmp= \ return 0
subcmp= predia= dia= trell last_pred= \ ;;
preme= subq= psnr mpeg_quant aic umv' \ -jpeg)
-- "$cur" ) ) COMPREPLY=( $( compgen -W 'noprogressive progressive nobaseline \
return 0 baseline optimize= smooth= quality= outdir=' -- "$cur" ) )
;; return 0
-ssf) ;;
COMPREPLY=( $( compgen -W 'lgb= cgb= ls= cs= chs= \ -xvidopts)
cvs=' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'dr2 nodr2' -- "$cur" ) )
return 0 return 0
;; ;;
-jpeg) -xvidencopts)
COMPREPLY=( $( compgen -W 'noprogressive progressive \ COMPREPLY=( $( compgen -W 'pass= bitrate= fixed_quant= me_quality= \
nobaseline baseline optimize= \ 4mv rc_reaction_delay_factor= rc_averaging_period= rc_buffer= \
smooth= quality= outdir=' -- "$cur" ) ) quant_range= min_key_interval= max_key_interval= mpeg_quant \
return 0 mod_quant lumi_mask hintedme hintfile debug keyframe_boost= \
;; kfthreshold= kfreduction=' -- "$cur" ) )
-xvidopts) return 0
COMPREPLY=( $( compgen -W 'dr2 nodr2' -- "$cur" ) ) ;;
return 0 -divx4opts)
;; COMPREPLY=( $( compgen -W 'br= key= deinterlace q= min_quant= \
-xvidencopts) max_quant= rc_period= rc_reaction_period= crispness= \
COMPREPLY=( $( compgen -W 'pass= bitrate= \ rc_reaction_ratio= pass= vbrpass= help' -- "$cur" ) )
fixed_quant= me_quality= 4mv \ return 0
rc_reaction_delay_factor= \ ;;
rc_averaging_period= rc_buffer= \ -info)
quant_range= min_key_interval= \ COMPREPLY=( $( compgen -W 'name= artist= genre= subject= \
max_key_interval= mpeg_quant \ copyright= srcform= comment= help' -- "$cur" ) )
mod_quant lumi_mask hintedme \ return 0
hintfile debug keyframe_boost= \ ;;
kfthreshold= kfreduction=' -- "$cur" ) ) -lameopts)
return 0 COMPREPLY=( $( compgen -W 'vbr= abr cbr br= q= aq= ratio= vol= \
;; mode= padding= fast preset= help' -- "$cur" ) )
-divx4opts) return 0
COMPREPLY=( $( compgen -W 'br= key= deinterlace q= \ ;;
min_quant= max_quant= rc_period= \ -rawaudio)
rc_reaction_period= crispness= \ COMPREPLY=( $( compgen -W 'on channels= rate= samplesize= format=' \
rc_reaction_ratio= pass= vbrpass= \ -- "$cur" ) )
help' -- "$cur" ) ) return 0
return 0 ;;
;; -rawvideo)
-info) COMPREPLY=( $( compgen -W 'on fps= sqcif qcif cif 4cif pal ntsc w= \
COMPREPLY=( $( compgen -W 'name= artist= genre= \ h= y420 yv12 yuy2 y8 format= size=' -- "$cur" ) )
subject= copyright= srcform= \ return 0
comment= help' -- "$cur" ) ) ;;
return 0 -aop)
;; COMPREPLY=( $( compgen -W 'list= delay= format= fout= volume= mul= \
-lameopts) softclip' -- "$cur" ) )
COMPREPLY=( $( compgen -W 'vbr= abr cbr br= q= aq= \ return 0
ratio= vol= mode= padding= fast \ ;;
preset= help' -- "$cur" ) ) -dxr2)
return 0 COMPREPLY=( $( compgen -W 'ar-mode= iec958-encoded iec958-decoded \
;; mute ucode= 75ire bw color interlaced macrovision= norm= \
-rawaudio) square-pixel ccir601-pixel cr-left= cr-right= cr-top= cr-bot= \
COMPREPLY=( $( compgen -W 'on channels= rate= \ ck-rmin= ck-gmin= ck-bmin= ck-rmax= ck-gmax= ck-bmax= ck-r= \
samplesize= format=' -- "$cur" ) ) ck-g= ck-b= ignore-cache= ol-osd= olh-cor= olw-cor= olx-cor= \
return 0 oly-cor= overlay overlay-ratio= update-cache' -- "$cur" ))
;; return 0
-rawvideo) ;;
COMPREPLY=( $( compgen -W 'on fps= sqcif qcif cif \ -tv)
4cif pal ntsc w= h= y420 yv12 yuy2 \ COMPREPLY=( $( compgen -W 'on noaudio driver= device= input= freq= \
y8 format= size=' -- "$cur" ) ) outfmt= width= height= buffersize= norm= channel= chanlist= \
return 0 audiorate= forceaudio alsa amode= forcechan= adevice= audioid= \
;; volume= bass= treble= balance= fps= channels= immediatemode=' \
-aop) -- "$cur" ) )
COMPREPLY=( $( compgen -W 'list= delay= format= fout= \ return 0
volume= mul= softclip' -- "$cur" ) ) ;;
return 0 -mf)
;; COMPREPLY=( $( compgen -W 'on w= h= fps= type=' -- "$cur" ) )
-dxr2) return 0
COMPREPLY=( $( compgen -W 'ar-mode= iec958-encoded \ ;;
iec958-decoded mute ucode= 75ire bw \ -cdda)
color interlaced macrovision= norm= \ COMPREPLY=( $( compgen -W 'speed= paranoia= generic-dev= \
square-pixel ccir601-pixel cr-left= \ sector-size= overlap= toc-bias toc-offset= skip noskip' \
cr-right= cr-top= cr-bot= ck-rmin= \ -- "$cur" ) )
ck-gmin= ck-bmin= ck-rmax= ck-gmax= \ return 0
ck-bmax= ck-r= ck-g= ck-b= \ ;;
ignore-cache= ol-osd= olh-cor= \ -input)
olw-cor= olx-cor= oly-cor= overlay \ COMPREPLY=( $( compgen -W 'conf= ar-delay ar-rate keylist cmdlist \
overlay-ratio= update-cache' -- "$cur" )) js-dev file' -- "$cur" ) )
return 0 return 0
;; ;;
-tv) -af)
COMPREPLY=( $( compgen -W 'on noaudio driver= device= \ COMPREPLY=( $( compgen -W 'resample resample= channels channels= \
input= freq= outfmt= width= height= \ format format= volume volume= delay delay= pan pan= sub sub= \
buffersize= norm= channel= chanlist= \ surround surround=' -- "$cur" ) )
audiorate= forceaudio alsa amode= \ return 0
forcechan= adevice= audioid= volume= \ ;;
bass= treble= balance= fps= \ -af-adv)
channels= immediatemode=' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'force= list=' -- "$cur" ) )
return 0 return 0
;; ;;
-mf) esac
COMPREPLY=( $( compgen -W 'on w= h= fps= type=' \
-- "$cur" ) )
return 0
;;
-cdda)
COMPREPLY=( $( compgen -W 'speed= paranoia= \
generic-dev= sector-size= overlap= \
toc-bias toc-offset= skip noskip' \
-- "$cur" ) )
return 0
;;
-input)
COMPREPLY=( $( compgen -W 'conf= ar-delay ar-rate \
keylist cmdlist js-dev file' -- "$cur" ) )
return 0
;;
-af)
COMPREPLY=( $( compgen -W 'resample resample= \
channels channels= format format= \
volume volume= delay delay= pan \
pan= sub sub= surround surround=' \
-- "$cur" ) )
return 0
;;
-af-adv)
COMPREPLY=( $( compgen -W 'force= list=' -- "$cur" ) )
return 0
;;
esac
case "$cur" in case "$cur" in
-*) -*)
COMPREPLY=( $( compgen -W '$( $cmd -list-options 2>/dev/null | \ COMPREPLY=( $( compgen -W '$( $cmd -list-options 2>/dev/null | \
sed -ne '1,/^[[:space:]]*Name/d' \ sed -ne '1,/^[[:space:]]*Name/d' \
-e "s/^[[:space:]]*/-/" -e "s/[[:space:]:].*//" \ -e "s/^[[:space:]]*/-/" -e "s/[[:space:]:].*//" \
-e "/^-\(Total\|.*\*\)\?$/!p" )' -- "$cur" ) ) -e "/^-\(Total\|.*\*\)\?$/!p" )' -- "$cur" ) )
;; ;;
*) *)
_filedir '@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|ASF|vob|VOB|bin|BIN|dat|DAT|vcd|VCD|ps|PS|pes|PES|fl[iv]|FL[IV]|viv|VIV|rm?(j)|RM?(J)|ra?(m)|RA?(M)|yuv|YUV|mov|MOV|qt|QT|mp[234]|MP[234]|m4[av]|M4[AV]|og[gmavx]|OG[GMAVX]|w?(a)v|W?(A)V|dump|DUMP|mk[av]|MK[AV]|m4a|M4A|aac|AAC|m[24]v|M[24]V|dv|DV|rmvb|RMVB|mid|MID|ts|TS|3g[p2]|mpc|MPC|flac|FLAC|vro|VRO|divx|DIVX|aif?(f)|AIF?(F)|m2ts|M2TS|vdr|VDR|xvid|XVID|ape|APE)' _filedir '@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|ASF|vob|VOB|bin|BIN|dat|DAT|vcd|VCD|ps|PS|pes|PES|fl[iv]|FL[IV]|viv|VIV|rm?(j)|RM?(J)|ra?(m)|RA?(M)|yuv|YUV|mov|MOV|qt|QT|mp[234]|MP[234]|m4[av]|M4[AV]|og[gmavx]|OG[GMAVX]|w?(a)v|W?(A)V|dump|DUMP|mk[av]|MK[AV]|m4a|M4A|aac|AAC|m[24]v|M[24]V|dv|DV|rmvb|RMVB|mid|MID|ts|TS|3g[p2]|mpc|MPC|flac|FLAC|vro|VRO|divx|DIVX|aif?(f)|AIF?(F)|m2ts|M2TS|vdr|VDR|xvid|XVID|ape|APE)'
;; ;;
esac esac
return 0 return 0
} }
complete $filenames -F _mplayer mplayer mencoder gmplayer kplayer complete $filenames -F _mplayer mplayer mencoder gmplayer kplayer
} }
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,53 +3,53 @@
have msynctool && have msynctool &&
_msynctool() _msynctool()
{ {
local cur prev anteprev local cur prev anteprev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
if [ $COMP_CWORD -ge 2 ]; then if [ $COMP_CWORD -ge 2 ]; then
anteprev=${COMP_WORDS[COMP_CWORD-2]} anteprev=${COMP_WORDS[COMP_CWORD-2]}
fi fi
case $anteprev in case $anteprev in
--configure) --configure)
COMPREPLY=( $( compgen -W "$(msynctool --showgroup \ COMPREPLY=( $( compgen -W "$(msynctool --showgroup \
$prev | awk '/^Member/ {print $2}' | sed \ $prev | awk '/^Member/ {print $2}' | sed \
-e 's/:$//' )" -- "$cur" ) ) -e 's/:$//' )" -- "$cur" ) )
return 0 return 0
;; ;;
--addmember) --addmember)
COMPREPLY=( $( compgen -W '$(msynctool --listplugins \ COMPREPLY=( $( compgen -W '$(msynctool --listplugins \
| sed -e '1d' )' -- "$cur" ) ) | sed -e '1d' )' -- "$cur" ) )
return 0 return 0
;; ;;
esac esac
case $prev in case $prev in
--@(configure|@(add|del|show)group|sync|addmember)) --@(configure|@(add|del|show)group|sync|addmember))
COMPREPLY=( $( compgen -W '$(msynctool --listgroups \ COMPREPLY=( $( compgen -W '$(msynctool --listgroups \
| sed -e '1d' )' -- "$cur" ) ) | sed -e '1d' )' -- "$cur" ) )
return 0 return 0
;; ;;
--@(showformats|filter-objtype|slow-sync)) --@(showformats|filter-objtype|slow-sync))
COMPREPLY=( $( compgen -W '$(msynctool --listobjects \ COMPREPLY=( $( compgen -W '$(msynctool --listobjects \
| sed -e '1d' )' -- "$cur" ) ) | sed -e '1d' )' -- "$cur" ) )
return 0 return 0
;; ;;
esac esac
COMPREPLY=( $( compgen -W '--listgroups --listplugins --listobjects \ COMPREPLY=( $( compgen -W '--listgroups --listplugins --listobjects \
--showformats --showgroup --sync --filter-objtype --slow-sync \ --showformats --showgroup --sync --filter-objtype --slow-sync \
--wait --multi --addgroup --delgroup --addmember --configure \ --wait --multi --addgroup --delgroup --addmember --configure \
--manual --configdir --conflict' -- "$cur" ) ) --manual --configdir --conflict' -- "$cur" ) )
} && } &&
complete -F _msynctool msynctool complete -F _msynctool msynctool
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -10,32 +10,32 @@ _mtx()
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
options="-f nobarcode invert noattach --version inquiry noattach \ options="-f nobarcode invert noattach --version inquiry noattach \
inventory status load unload eepos first last next" inventory status load unload eepos first last next"
tapes=$(mtx status | \ tapes=$(mtx status | \
awk '/Storage Element [0-9]+:Full/ { printf "%s ", $3 }') awk '/Storage Element [0-9]+:Full/ { printf "%s ", $3 }')
tapes=${tapes//:Full} tapes=${tapes//:Full}
drives=$(mtx status | \ drives=$(mtx status | \
awk '/Data Transfer Element [0-9]+:(Full|Empty)/ { printf "%s ", $4 }') awk '/Data Transfer Element [0-9]+:(Full|Empty)/ { printf "%s ", $4 }')
drives=${drives//:Full} drives=${drives//:Full}
drives=${drives//:Empty} drives=${drives//:Empty}
if [ $COMP_CWORD -gt 1 ]; then if [ $COMP_CWORD -gt 1 ]; then
case $prev in case $prev in
load) load)
COMPREPLY=( $( compgen -W "$tapes" -- "$cur" ) ) COMPREPLY=( $( compgen -W "$tapes" -- "$cur" ) )
;; ;;
unload|first|last|next) unload|first|last|next)
COMPREPLY=( $( compgen -W "$drives" -- "$cur" ) ) COMPREPLY=( $( compgen -W "$drives" -- "$cur" ) )
;; ;;
-f) -f)
true true
;; ;;
*) *)
true true
;; ;;
esac esac
else else
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
fi fi
@ -45,8 +45,8 @@ complete -F _mtx mtx
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,103 +3,101 @@
have munin-run && have munin-run &&
_munin-run() _munin-run()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in case $prev in
--@(config|sconffile)) --@(config|sconffile))
_filedir _filedir
return 0 return 0
;; ;;
--@(service|sconf)dir) --@(service|sconf)dir)
_filedir -d _filedir -d
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--config --servicedir --sconfdir \ COMPREPLY=( $( compgen -W '--config --servicedir --sconfdir \
--sconffile --help --debug --version' -- "$cur" ) ) --sconffile --help --debug --version' -- "$cur" ) )
else else
COMPREPLY=( $( compgen -W '$( command ls /etc/munin/plugins )' \ COMPREPLY=( $( compgen -W '$( command ls /etc/munin/plugins )' \
-- "$cur" ) ) -- "$cur" ) )
fi fi
} && } &&
complete -F _munin-run munin-run complete -F _munin-run munin-run
have munin-update && have munin-update &&
_munin-update() _munin-update()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in case $prev in
--config) --config)
_filedir _filedir
return 0 return 0
;; ;;
--host) --host)
_known_hosts_real "$cur" _known_hosts_real "$cur"
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--force-root --[no]force-root \ COMPREPLY=( $( compgen -W '--force-root --[no]force-root \
--service --host --config --help --debug --nodebug \ --service --host --config --help --debug --nodebug \
--fork --nofork --stdout --nostdout --timeout' \ --fork --nofork --stdout --nostdout --timeout' -- "$cur" ) )
-- "$cur" ) ) fi
fi
} && } &&
complete -F _munin-update munin-update complete -F _munin-update munin-update
have munin-node-configure && have munin-node-configure &&
_munin-node-configure() _munin-node-configure()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in case $prev in
--config) --config)
_filedir _filedir
return 0 return 0
;; ;;
--@(service|lib)dir) --@(service|lib)dir)
_filedir -d _filedir -d
return 0 return 0
;; ;;
--snmp) --snmp)
_known_hosts_real "$cur" _known_hosts_real "$cur"
return 0 return 0
;; ;;
--snmpversion) --snmpversion)
COMPREPLY=( $( compgen -W '1 2c 3' -- "$cur" ) ) COMPREPLY=( $( compgen -W '1 2c 3' -- "$cur" ) )
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--help --version --debug --config \ COMPREPLY=( $( compgen -W '--help --version --debug --config \
--servicedir --libdir --families --suggest --shell \ --servicedir --libdir --families --suggest --shell \
--remove-also --snmp --snmpversion --snmpcommunity' \ --remove-also --snmp --snmpversion --snmpcommunity' -- "$cur" ) )
-- "$cur" ) ) fi
fi
} && } &&
complete -F _munin-node-configure munin-node-configure complete -F _munin-node-configure munin-node-configure
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -6,133 +6,132 @@
have mutt || have muttng && { have mutt || have muttng && {
_muttaddr() _muttaddr()
{ {
_muttaliases _muttaliases
_muttquery _muttquery
cur=`_get_cword` cur=`_get_cword`
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -u -- "$cur" ) ) COMPREPLY=( "${COMPREPLY[@]}" $( compgen -u -- "$cur" ) )
return 0 return 0
} }
_muttconffiles() _muttconffiles()
{ {
local file sofar local file sofar
local -a newconffiles local -a newconffiles
sofar=" $1 " sofar=" $1 "
shift shift
while [[ "$1" ]]; do while [[ "$1" ]]; do
newconffiles=( $(sed -rn 's|^source[[:space:]]+([^[:space:]]+).*$|\1|p' $(eval echo $1) ) ) newconffiles=( $(sed -rn 's|^source[[:space:]]+([^[:space:]]+).*$|\1|p' $(eval echo $1) ) )
for file in "${newconffiles[@]}"; do for file in "${newconffiles[@]}"; do
[[ ! "$file" ]] || [[ "${sofar/ ${file} / }" != "$sofar" ]] && [[ ! "$file" ]] || [[ "${sofar/ ${file} / }" != "$sofar" ]] &&
continue continue
sofar="$sofar $file" sofar="$sofar $file"
sofar=" $(eval _muttconffiles \"$sofar\" $file) " sofar=" $(eval _muttconffiles \"$sofar\" $file) "
done done
shift shift
done done
echo $sofar echo $sofar
} }
_muttaliases() _muttaliases()
{ {
local cur muttrc muttcmd=${COMP_WORDS[0]} local cur muttrc muttcmd=${COMP_WORDS[0]}
local -a conffiles aliases local -a conffiles aliases
cur=`_get_cword =` cur=`_get_cword =`
[ -f ~/.${muttcmd}/${muttcmd}rc ] && muttrc="~/.${muttcmd}/${muttcmd}rc" [ -f ~/.${muttcmd}/${muttcmd}rc ] && muttrc="~/.${muttcmd}/${muttcmd}rc"
[ -f ~/.${muttcmd}rc ] && muttrc="~/.${muttcmd}rc" [ -f ~/.${muttcmd}rc ] && muttrc="~/.${muttcmd}rc"
[ -z "$muttrc" ] && return 0 [ -z "$muttrc" ] && return 0
conffiles=( $(eval _muttconffiles $muttrc $muttrc) ) conffiles=( $(eval _muttconffiles $muttrc $muttrc) )
aliases=( $( sed -rn 's|^alias[[:space:]]+([^[:space:]]+).*$|\1|p' \ aliases=( $( sed -rn 's|^alias[[:space:]]+([^[:space:]]+).*$|\1|p' \
$(eval echo "${conffiles[@]}") ) ) $(eval echo "${conffiles[@]}") ) )
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "${aliases[*]}" -- "$cur" ) ) COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "${aliases[*]}" -- "$cur" ) )
return 0 return 0
} }
_muttquery() _muttquery()
{ {
local cur querycmd muttcmd=${COMP_WORDS[0]} local cur querycmd muttcmd=${COMP_WORDS[0]}
local -a queryresults local -a queryresults
cur=`_get_cword` cur=`_get_cword`
querycmd="$( $muttcmd -Q query_command | sed -r 's|^query_command=\"(.*)\"$|\1|; s|%s|'$cur'|' )" querycmd="$( $muttcmd -Q query_command | sed -r 's|^query_command=\"(.*)\"$|\1|; s|%s|'$cur'|' )"
if [ -z "$cur" -o -z "$querycmd" ]; then if [ -z "$cur" -o -z "$querycmd" ]; then
queryresults=() queryresults=()
else else
queryresults=( $( $querycmd | \ queryresults=( $( $querycmd | sed -nr '2,$s|^([^[:space:]]+).*|\1|p' ) )
sed -nr '2,$s|^([^[:space:]]+).*|\1|p' ) ) fi
fi
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "${queryresults[*]}" \ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "${queryresults[*]}" \
-- "$cur" ) ) -- "$cur" ) )
return 0 return 0
} }
_muttfiledir() _muttfiledir()
{ {
local cur folder spoolfile muttcmd=${COMP_WORDS[0]} local cur folder spoolfile muttcmd=${COMP_WORDS[0]}
cur=`_get_cword` cur=`_get_cword`
# This is currently not working so well. Perhaps this function should # This is currently not working so well. Perhaps this function should
# just call _filedir() for the moment. # just call _filedir() for the moment.
if [[ $cur == [=+]* ]]; then if [[ $cur == [=+]* ]]; then
folder="$( $muttcmd -Q folder | sed -r 's|^folder=\"(.*)\"$|\1|' )" folder="$( $muttcmd -Q folder | sed -r 's|^folder=\"(.*)\"$|\1|' )"
: folder:=~/Mail : folder:=~/Mail
# Match any file in $folder beginning with $cur # Match any file in $folder beginning with $cur
# (minus the leading '=' sign). # (minus the leading '=' sign).
COMPREPLY=( $( compgen -f -- "$folder/${cur:1}" ) ) COMPREPLY=( $( compgen -f -- "$folder/${cur:1}" ) )
COMPREPLY=( ${COMPREPLY[@]#$folder/} ) COMPREPLY=( ${COMPREPLY[@]#$folder/} )
return 0 return 0
elif [ "$cur" == !* ]; then elif [ "$cur" == !* ]; then
spoolfile="$( $muttcmd -Q spoolfile | sed -r 's|^spoolfile=\"(.*)\"$|\1|' )" spoolfile="$( $muttcmd -Q spoolfile | \
[ ! -z "$spoolfile" ] && eval cur="${cur/^!/$spoolfile}"; sed -r 's|^spoolfile=\"(.*)\"$|\1|' )"
fi [ ! -z "$spoolfile" ] && eval cur="${cur/^!/$spoolfile}";
_filedir fi
_filedir
return 0 return 0
} }
_mutt() _mutt()
{ {
local cur prev local cur prev
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
COMPREPLY=() COMPREPLY=()
case "$cur" in case "$cur" in
-*) -*)
COMPREPLY=( $( compgen -W '-A -a -b -c -e -f -F -H -i -m -n \ COMPREPLY=( $( compgen -W '-A -a -b -c -e -f -F -H -i -m -n \
-p -Q -R -s -v -x -y -z -Z -h' \ -p -Q -R -s -v -x -y -z -Z -h' -- "$cur" ) )
-- "$cur" ) ) return 0
return 0 ;;
;; *)
*) case "$prev" in
case "$prev" in -@(a|f|F|H|i))
-@(a|f|F|H|i)) _muttfiledir
_muttfiledir return 0
return 0 ;;
;; -A)
-A) _muttaliases
_muttaliases return 0
return 0 ;;
;; -@(e|m|Q|s|h|p|R|v|y|z|Z))
-@(e|m|Q|s|h|p|R|v|y|z|Z)) return 0
return 0 ;;
;; *)
*) _muttaddr
_muttaddr return 0
return 0 ;;
;; esac
esac ;;
;; esac
esac
} }
complete -F _mutt $default $filenames mutt muttng complete -F _mutt $default $filenames mutt muttng
@ -140,8 +139,8 @@ complete -F _mutt $default $filenames mutt muttng
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,38 +3,36 @@
have mysqladmin && have mysqladmin &&
_mysqladmin() _mysqladmin()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-u) -u)
COMPREPLY=( $( compgen -u -- "$cur" ) ) COMPREPLY=( $( compgen -u -- "$cur" ) )
return 0 return 0
;; ;;
*) *)
;; ;;
esac esac
COMPREPLY=( $( compgen -W '-# -f -? -C -h -p -P -i -r -E -s -S -t -u \ COMPREPLY=( $( compgen -W '-# -f -? -C -h -p -P -i -r -E -s -S -t -u \
-v -V -w' -- "$cur" ) ) -v -V -w' -- "$cur" ) )
COMPREPLY=( "${COMPREPLY[@]}" \ COMPREPLY=( "${COMPREPLY[@]}" \
$( compgen -W 'create drop extended-status flush-hosts \ $( compgen -W 'create drop extended-status flush-hosts flush-logs \
flush-logs flush-status flush-tables \ flush-status flush-tables flush-threads flush-privileges kill \
flush-threads flush-privileges kill \ password ping processlist reload refresh shutdown status variables \
password ping processlist reload refresh \ version' -- "$cur" ) )
shutdown status variables version' \
-- "$cur" ) )
} && } &&
complete -F _mysqladmin mysqladmin complete -F _mysqladmin mysqladmin
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,24 +3,24 @@
have ncftp && have ncftp &&
_ncftp() _ncftp()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
if [ $COMP_CWORD -eq 1 ] && [ -f ~/.ncftp/bookmarks ]; then if [ $COMP_CWORD -eq 1 ] && [ -f ~/.ncftp/bookmarks ]; then
COMPREPLY=( $( compgen -W '$( sed -ne "s/^\([^,]\{1,\}\),.*$/\1/p" \ COMPREPLY=( $( compgen -W '$( sed -ne "s/^\([^,]\{1,\}\),.*$/\1/p" \
~/.ncftp/bookmarks )' -- "$cur" ) ) ~/.ncftp/bookmarks )' -- "$cur" ) )
fi fi
return 0 return 0
} && } &&
complete -F _ncftp $default ncftp complete -F _ncftp $default ncftp
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,70 +3,70 @@
have mii-tool && have mii-tool &&
_mii_tool() _mii_tool()
{ {
local cur prev split=false local cur prev split=false
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
_split_longopt && split=true _split_longopt && split=true
case $prev in case $prev in
-F|--force) -F|--force)
COMPREPLY=( $( compgen -W '100baseTx-FD 100baseTx-HD \ COMPREPLY=( $( compgen -W '100baseTx-FD 100baseTx-HD \
10baseT-FD 10baseT-HD' -- "$cur" ) ) 10baseT-FD 10baseT-HD' -- "$cur" ) )
return 0 return 0
;; ;;
-A|--advertise) -A|--advertise)
COMPREPLY=( $( compgen -W '100baseT4 100baseTx-FD 100baseTx-HD \ COMPREPLY=( $( compgen -W '100baseT4 100baseTx-FD 100baseTx-HD \
10baseT-FD 10baseT-HD' -- "$cur" ) ) 10baseT-FD 10baseT-HD' -- "$cur" ) )
return 0 return 0
;; ;;
esac esac
$split && return 0 $split && return 0
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-v --verbose -V --version -R \ COMPREPLY=( $( compgen -W '-v --verbose -V --version -R \
--reset -r --restart -w --watch -l --log -A \ --reset -r --restart -w --watch -l --log -A \
--advertise -F --force' -- "$cur" ) ) --advertise -F --force' -- "$cur" ) )
else else
_available_interfaces -a _available_interfaces -a
fi fi
} && } &&
complete -F _mii_tool $default mii-tool complete -F _mii_tool $default mii-tool
have mii-diag && have mii-diag &&
_mii_diag() _mii_diag()
{ {
local cur prev split=false local cur prev split=false
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
_split_longopt && split=true _split_longopt && split=true
case $prev in case $prev in
-@(F|A|-advertise|-fixed-speed)) -@(F|A|-advertise|-fixed-speed))
COMPREPLY=( $( compgen -W '100baseT4 100baseTx \ COMPREPLY=( $( compgen -W '100baseT4 100baseTx \
100baseTx-FD 100baseTx-HD 10baseT 10baseT-FD \ 100baseTx-FD 100baseTx-HD 10baseT 10baseT-FD \
10baseT-HD' -- "$cur" ) ) 10baseT-HD' -- "$cur" ) )
return 0 return 0
;; ;;
esac esac
$split && return 0 $split && return 0
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-A --advertise -F --fixed-speed -a \ COMPREPLY=( $( compgen -W '-A --advertise -F --fixed-speed -a \
--all-interfaces -s --status -D --debug -g \ --all-interfaces -s --status -D --debug -g \
--read-parameters -G --set-parameters -M --msg-level \ --read-parameters -G --set-parameters -M --msg-level \
-p --phy -r --restart -R --reset -v -V -w --watch \ -p --phy -r --restart -R --reset -v -V -w --watch \
-? --help' -- "$cur" ) ) -? --help' -- "$cur" ) )
else else
_available_interfaces -a _available_interfaces -a
fi fi
} && } &&
complete -F _mii_diag $default mii-diag complete -F _mii_diag $default mii-diag
@ -75,41 +75,41 @@ complete -F _mii_diag $default mii-diag
[ $UNAME = Linux ] && [ $UNAME = Linux ] &&
_route() _route()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
if [ "$prev" = dev ]; then if [ "$prev" = dev ]; then
COMPREPLY=( $( ifconfig -a | sed -ne 's|^\('$cur'[^ ]*\).*$|\1|p' )) COMPREPLY=( $( ifconfig -a | sed -ne 's|^\('$cur'[^ ]*\).*$|\1|p' ))
return 0 return 0
fi fi
COMPREPLY=( $( compgen -W 'add del -host -net netmask metric mss \ COMPREPLY=( $( compgen -W 'add del -host -net netmask metric mss \
window irtt reject mod dyn reinstate dev \ window irtt reject mod dyn reinstate dev \
default gw' -- "$cur" ) ) default gw' -- "$cur" ) )
COMPREPLY=( $( echo " ${COMP_WORDS[@]}" | \ COMPREPLY=( $( echo " ${COMP_WORDS[@]}" | \
(while read -d ' ' i; do (while read -d ' ' i; do
[ "$i" == "" ] && continue [ "$i" == "" ] && continue
# flatten array with spaces on either side, # flatten array with spaces on either side,
# otherwise we cannot grep on word # otherwise we cannot grep on word
# boundaries of first and last word # boundaries of first and last word
COMPREPLY=" ${COMPREPLY[@]} " COMPREPLY=" ${COMPREPLY[@]} "
# remove word from list of completions # remove word from list of completions
COMPREPLY=( ${COMPREPLY/ $i / } ) COMPREPLY=( ${COMPREPLY/ $i / } )
done done
echo "${COMPREPLY[@]}") echo "${COMPREPLY[@]}")
) ) ) )
return 0 return 0
} }
[ $UNAME = Linux ] && complete -F _route route [ $UNAME = Linux ] && complete -F _route route
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,36 +3,36 @@
have ntpdate && have ntpdate &&
_ntpdate() _ntpdate()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in case $prev in
-k) -k)
_filedir _filedir
return 0 return 0
;; ;;
-U) -U)
COMPREPLY=( $( compgen -u "$cur" ) ) COMPREPLY=( $( compgen -u "$cur" ) )
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-4 -6 -b -B -d -Q -q -s -u -v -a\ COMPREPLY=( $( compgen -W '-4 -6 -b -B -d -Q -q -s -u -v -a\
-e -k -p -o -r -t' -- "$cur" ) ) -e -k -p -o -r -t' -- "$cur" ) )
else else
_known_hosts_real "$cur" _known_hosts_real "$cur"
fi fi
} && } &&
complete -F _ntpdate ntpdate complete -F _ntpdate ntpdate
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,275 +3,271 @@
have ldapsearch && { have ldapsearch && {
_ldap_uris() _ldap_uris()
{ {
COMPREPLY=( $( compgen -W 'ldap:// ldaps://' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'ldap:// ldaps://' -- "$cur" ) )
} }
_ldap_protocols() _ldap_protocols()
{ {
COMPREPLY=( $( compgen -W '2 3' -- "$cur" ) ) COMPREPLY=( $( compgen -W '2 3' -- "$cur" ) )
} }
_ldapsearch() _ldapsearch()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-h) -h)
_known_hosts_real "$cur" _known_hosts_real "$cur"
return 0 return 0
;; ;;
-H) -H)
_ldap_uris _ldap_uris
return 0 return 0
;; ;;
-T) -T)
_filedir -d _filedir -d
return 0 return 0
;; ;;
-@(f|y)) -@(f|y))
_filedir _filedir
return 0 return 0
;; ;;
-s) -s)
COMPREPLY=( $( compgen -W 'base one sub children' \ COMPREPLY=( $( compgen -W 'base one sub children' -- "$cur" ) )
-- "$cur" ) ) return 0
return 0 ;;
;; -a)
-a) COMPREPLY=( $( compgen -W 'never always search find' \
COMPREPLY=( $( compgen -W 'never always search find' \ -- "$cur" ) )
-- "$cur" ) ) return 0
return 0 ;;
;; -P)
-P) _ldap_protocols
_ldap_protocols return 0
return 0 ;;
;; esac
esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-n -u -v -t -tt -T -F -A -C -L -LL \ COMPREPLY=( $( compgen -W '-n -u -v -t -tt -T -F -A -C -L -LL \
-LLL -M -MM -S -d -f -x -D -W -w -y -H -h -p -b -s -a \ -LLL -M -MM -S -d -f -x -D -W -w -y -H -h -p -b -s -a \
-P -e -E -l -z -O -I -Q -U -R -X -Y -Z -ZZ' -- "$cur" ) ) -P -e -E -l -z -O -I -Q -U -R -X -Y -Z -ZZ' -- "$cur" ) )
fi fi
} }
complete -F _ldapsearch ldapsearch complete -F _ldapsearch ldapsearch
_ldapaddmodify() _ldapaddmodify()
{ {
local cur prev options local cur prev options
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-h) -h)
_known_hosts_real "$cur" _known_hosts_real "$cur"
return 0 return 0
;; ;;
-H) -H)
_ldap_uris _ldap_uris
return 0 return 0
;; ;;
-@(S|f|y)) -@(S|f|y))
_filedir _filedir
return 0 return 0
;; ;;
-P) -P)
_ldap_protocols _ldap_protocols
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
options='-c -S -n -v -M -MM -d -D -W -w -y -h -H -p -P -O -I \ options='-c -S -n -v -M -MM -d -D -W -w -y -h -H -p -P -O -I \
-Q -U -R -x -X -Y -Z -ZZ -f' -Q -U -R -x -X -Y -Z -ZZ -f'
if [[ ${COMP_WORDS[0]} == ldapmodify ]]; then if [[ ${COMP_WORDS[0]} == ldapmodify ]]; then
options="$options -a" options="$options -a"
fi fi
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
fi fi
} }
complete -F _ldapaddmodify ldapadd ldapmodify complete -F _ldapaddmodify ldapadd ldapmodify
_ldapdelete() _ldapdelete()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-h) -h)
_known_hosts_real "$cur" _known_hosts_real "$cur"
return 0 return 0
;; ;;
-H) -H)
_ldap_uris _ldap_uris
return 0 return 0
;; ;;
-@(f|y)) -@(f|y))
_filedir _filedir
return 0 return 0
;; ;;
-P) -P)
_ldap_protocols _ldap_protocols
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-n -v -c -M -MM -d -f -D -W -w -y \ COMPREPLY=( $( compgen -W '-n -v -c -M -MM -d -f -D -W -w -y \
-H -h -P -p -O -U -R -r -x -I -Q -X -Y -Z -ZZ' \ -H -h -P -p -O -U -R -r -x -I -Q -X -Y -Z -ZZ' -- "$cur" ) )
-- "$cur" ) ) fi
fi
} }
complete -F _ldapdelete ldapdelete complete -F _ldapdelete ldapdelete
_ldapcompare() _ldapcompare()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-h) -h)
_known_hosts_real "$cur" _known_hosts_real "$cur"
return 0 return 0
;; ;;
-H) -H)
_ldap_uris _ldap_uris
return 0 return 0
;; ;;
-y) -y)
_filedir _filedir
return 0 return 0
;; ;;
-P) -P)
_ldap_protocols _ldap_protocols
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-n -v -z -M -MM -d -D -W -w -y \ COMPREPLY=( $( compgen -W '-n -v -z -M -MM -d -D -W -w -y \
-H -h -P -p -O -I -Q -U -R -x -X -Y -Z -ZZ' \ -H -h -P -p -O -I -Q -U -R -x -X -Y -Z -ZZ' -- "$cur" ) )
-- "$cur" ) ) fi
fi
} }
complete -F _ldapcompare ldapcompare complete -F _ldapcompare ldapcompare
_ldapmodrdn() _ldapmodrdn()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-h) -h)
_known_hosts_real "$cur" _known_hosts_real "$cur"
return 0 return 0
;; ;;
-H) -H)
_ldap_uris _ldap_uris
return 0 return 0
;; ;;
-@(f|y)) -@(f|y))
_filedir _filedir
return 0 return 0
;; ;;
-P) -P)
_ldap_protocols _ldap_protocols
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-r -s -n -v -c -M -MM -d -D -W -w \ COMPREPLY=( $( compgen -W '-r -s -n -v -c -M -MM -d -D -W -w \
-y -H -h -P -p -O -I -Q -U -R -x -X -Y -Z -ZZ -f' \ -y -H -h -P -p -O -I -Q -U -R -x -X -Y -Z -ZZ -f' -- "$cur" ) )
-- "$cur" ) ) fi
fi
} }
complete -F _ldapmodrdn ldapmodrdn complete -F _ldapmodrdn ldapmodrdn
_ldapwhoami() _ldapwhoami()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-h) -h)
_known_hosts_real "$cur" _known_hosts_real "$cur"
return 0 return 0
;; ;;
-H) -H)
_ldap_uris _ldap_uris
return 0 return 0
;; ;;
-@(f|y)) -@(f|y))
_filedir _filedir
return 0 return 0
;; ;;
-P) -P)
_ldap_protocols _ldap_protocols
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-n -v -z -d -D -W -w -y -H -h -p -P \ COMPREPLY=( $( compgen -W '-n -v -z -d -D -W -w -y -H -h -p -P \
-O -I -Q -U -R -x -X -Y -Z -ZZ' -- "$cur" ) ) -O -I -Q -U -R -x -X -Y -Z -ZZ' -- "$cur" ) )
fi fi
} }
complete -F _ldapwhoami ldapwhoami complete -F _ldapwhoami ldapwhoami
_ldappasswd() _ldappasswd()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in case "$prev" in
-h) -h)
_known_hosts_real "$cur" _known_hosts_real "$cur"
return 0 return 0
;; ;;
-H) -H)
_ldap_uris _ldap_uris
return 0 return 0
;; ;;
-@(t|T|y)) -@(t|T|y))
_filedir _filedir
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-A -a -t -d -D -H -h -n -p -S -s -T \ COMPREPLY=( $( compgen -W '-A -a -t -d -D -H -h -n -p -S -s -T \
-v -W -w -y -O -I -Q -U -R -x -X -Y -Z -ZZ' -- "$cur" ) ) -v -W -w -y -O -I -Q -U -R -x -X -Y -Z -ZZ' -- "$cur" ) )
fi fi
} }
complete -F _ldappasswd ldappasswd complete -F _ldappasswd ldappasswd
} }
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,300 +3,249 @@
have openssl && { have openssl && {
_openssl_sections() _openssl_sections()
{ {
local config f local config f
# check if a specific configuration file is used # check if a specific configuration file is used
for (( i=2; i < COMP_CWORD; i++ )); do for (( i=2; i < COMP_CWORD; i++ )); do
if [[ "${COMP_WORDS[i]}" == -config ]]; then if [[ "${COMP_WORDS[i]}" == -config ]]; then
config=${COMP_WORDS[i+1]} config=${COMP_WORDS[i+1]}
break break
fi fi
done done
# if no config given, check some usual default locations # if no config given, check some usual default locations
if [ -z "$config" ]; then if [ -z "$config" ]; then
for f in /etc/ssl/openssl.cnf /etc/pki/tls/openssl.cnf \ for f in /etc/ssl/openssl.cnf /etc/pki/tls/openssl.cnf \
/usr/share/ssl/openssl.cnf; do /usr/share/ssl/openssl.cnf; do
[ -f $f ] && config=$f && break [ -f $f ] && config=$f && break
done done
fi fi
[ ! -f "$config" ] && return 0 [ ! -f "$config" ] && return 0
COMPREPLY=( $( compgen -W "$( awk '/\[.*\]/ {print $2}' $config )" \ COMPREPLY=( $( compgen -W "$( awk '/\[.*\]/ {print $2}' $config )" \
-- "$cur" ) ) -- "$cur" ) )
} }
_openssl() _openssl()
{ {
local cur prev commands command options formats local cur prev commands command options formats
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
commands='asn1parse ca ciphers crl crl2pkcs7 dgst dh dhparam dsa \ commands='asn1parse ca ciphers crl crl2pkcs7 dgst dh dhparam dsa \
dsaparam ec ecparam enc engine errstr gendh gendsa genrsa \ dsaparam ec ecparam enc engine errstr gendh gendsa genrsa \
nseq ocsp passwd pkcs12 pkcs7 pkcs8 prime rand req rsa \ nseq ocsp passwd pkcs12 pkcs7 pkcs8 prime rand req rsa \
rsautl s_client s_server s_time sess_id smime speed spkac \ rsautl s_client s_server s_time sess_id smime speed spkac \
verify version x509 md2 md4 md5 rmd160 sha sha1 aes-128-cbc \ verify version x509 md2 md4 md5 rmd160 sha sha1 aes-128-cbc \
aes-128-ecb aes-192-cbc aes-192-ecb aes-256-cbc aes-256-ecb \ aes-128-ecb aes-192-cbc aes-192-ecb aes-256-cbc aes-256-ecb \
base64 bf bf-cbc bf-cfb bf-ecb bf-ofb camellia-128-cbc \ base64 bf bf-cbc bf-cfb bf-ecb bf-ofb camellia-128-cbc \
camellia-128-ecb camellia-192-cbc camellia-192-ecb \ camellia-128-ecb camellia-192-cbc camellia-192-ecb \
camellia-256-cbc camellia-256-ecb cast cast-cbc cast5-cbc \ camellia-256-cbc camellia-256-ecb cast cast-cbc cast5-cbc \
cast5-cfb cast5-ecb cast5-ofb des des-cbc des-cfb des-ecb \ 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-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 \ 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 \ rc2-40-cbc rc2-64-cbc rc2-cbc rc2-cfb rc2-ecb rc2-ofb rc4 \
rc4-40' rc4-40'
if [ $COMP_CWORD -eq 1 ]; then if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) ) COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) )
else else
command=${COMP_WORDS[1]} command=${COMP_WORDS[1]}
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in case $prev in
-@(CA|CAfile|CAkey|CAserial|cert|certfile|config|content|dcert|dkey|dhparam|extfile|in|inkey|kfile|key|keyout|out|oid|prvrify|rand|recip|revoke|sess_in|sess_out|spkac|sign|signkey|signer|signature|ss_cert|untrusted|verify)) -@(CA|CAfile|CAkey|CAserial|cert|certfile|config|content|dcert|dkey|dhparam|extfile|in|inkey|kfile|key|keyout|out|oid|prvrify|rand|recip|revoke|sess_in|sess_out|spkac|sign|signkey|signer|signature|ss_cert|untrusted|verify))
_filedir _filedir
return 0 return 0
;; ;;
-@(outdir|CApath)) -@(outdir|CApath))
_filedir -d _filedir -d
return 0 return 0
;; ;;
-@(name|crlexts|extensions)) -@(name|crlexts|extensions))
_openssl_sections _openssl_sections
return 0 return 0
;; ;;
-@(in|out|key|cert|CA|CAkey|dkey|dcert)form) -@(in|out|key|cert|CA|CAkey|dkey|dcert)form)
formats='DER PEM' formats='DER PEM'
case $command in case $command in
x509) x509)
formats="$formats NET" formats="$formats NET"
;; ;;
smime) smime)
formats="$formats SMIME" formats="$formats SMIME"
;; ;;
esac esac
COMPREPLY=( $( compgen -W "$formats" -- "$cur" ) ) COMPREPLY=( $( compgen -W "$formats" -- "$cur" ) )
return 0 return 0
;; ;;
-connect) -connect)
_known_hosts_real "$cur" _known_hosts_real "$cur"
return 0 return 0
;; ;;
-starttls) -starttls)
COMPREPLY=( $( compgen -W 'smtp pop3 imap ftp' \ COMPREPLY=( $( compgen -W 'smtp pop3 imap ftp' \
-- "$cur" ) ) -- "$cur" ) )
return 0 return 0
;; ;;
-cipher) -cipher)
COMPREPLY=( $( compgen -W "$(openssl ciphers | \ COMPREPLY=( $( compgen -W "$(openssl ciphers | \
tr ':' '\n')" -- "$cur" ) ) tr ':' '\n')" -- "$cur" ) )
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
# possible options for the command # possible options for the command
case $command in case $command in
asn1parse) asn1parse)
options='-inform -in -out -noout \ options='-inform -in -out -noout -offset -length -i -oid \
-offset -length -i -oid \ -strparse'
-strparse' ;;
;; ca)
ca) options='-verbose -config -name -gencrl -revoke \
options='-verbose -config -name \ -crl_reason -crl_hold -crl_compromise \
-gencrl -revoke -crl_reason \ -crl_CA_compromise -crldays -crlhours -crlexts \
-crl_hold -crl_compromise \ -startdate -enddate -days -md -policy -keyfile -key \
-crl_CA_compromise -crldays \ -passin -cert -selfsig -in -out -notext -outdir \
-crlhours -crlexts -startdate \ -infiles -spkac -ss_cert -preserveDN -noemailDN \
-enddate -days -md -policy \ -batch -msie_hack -extensions -extfile -engine \
-keyfile -key -passin -cert \ -subj -utf8 -multivalue-rdn'
-selfsig -in -out -notext \ ;;
-outdir -infiles -spkac \ ciphers)
-ss_cert -preserveDN \ options='-v -ssl2 -ssl3 -tls1'
-noemailDN -batch -msie_hack \ ;;
-extensions -extfile -engine \ crl)
-subj -utf8 -multivalue-rdn' options='-inform -outform -text -in -out -noout -hash \
;; -issuer -lastupdate -nextupdate -CAfile -CApath'
ciphers) ;;
options='-v -ssl2 -ssl3 -tls1' crl2pkcs7)
;; options='-inform -outform -in -out -print_certs'
crl) ;;
options='-inform -outform -text -in \ dgst)
-out -noout -hash -issuer \ options='-md5 -md4 -md2 -sha1 -sha -mdc2 -ripemd160 -dss1 \
-lastupdate -nextupdate \ -c -d -hex -binary -out -sign -verify -prverify \
-CAfile -CApath' -signature'
;; ;;
crl2pkcs7) dsa)
options='-inform -outform -in -out \ options='-inform -outform -in -passin -out -passout -des \
-print_certs' -des3 -idea -text -noout -modulus -pubin -pubout'
;; ;;
dgst) dsaparam)
options='-md5 -md4 -md2 -sha1 -sha \ options='-inform -outform -in -out -noout -text -C -rand \
-mdc2 -ripemd160 -dss1 -c -d \ -genkey'
-hex -binary -out -sign \ ;;
-verify -prverify -signature' enc)
;; options='-ciphername -in -out -pass -e -d -a -A -k -kfile \
dsa) -S -K -iv -p -P -bufsize -debug'
options='-inform -outform -in -passin \ ;;
-out -passout -des -des3 -idea \ dhparam)
-text -noout -modulus -pubin \ options='-inform -outform -in -out -dsaparam -noout -text \
-pubout' -C -2 -5 -rand'
;; ;;
dsaparam) gendsa)
options='-inform -outform -in -out \ options='-out -des -des3 -idea -rand'
-noout -text -C -rand -genkey' ;;
;; genrsa)
enc) options='-out -passout -des -des3 -idea -f4 -3 -rand'
options='-ciphername -in -out -pass \ ;;
-e -d -a -A -k -kfile -S -K \ pkcs7)
-iv -p -P -bufsize -debug' options='-inform -outform -in -out -print_certs -text \
;; -noout'
dhparam) ;;
options='-inform -outform -in -out \ rand)
-dsaparam -noout -text -C -2 \ options='-out -rand -base64'
-5 -rand' ;;
;; req)
gendsa) options='-inform -outform -in -passin -out -passout -text \
options='-out -des -des3 -idea -rand' -noout -verify -modulus -new -rand -newkey -newkey \
;; -nodes -key -keyform -keyout -md5 -sha1 -md2 -mdc2 \
genrsa) -config -x509 -days -asn1-kludge -newhdr -extensions \
options='-out -passout -des -des3 \ -reqexts section'
-idea -f4 -3 -rand' ;;
;; rsa)
pkcs7) options='-inform -outform -in -passin -out -passout \
options='-inform -outform -in -out \ -sgckey -des -des3 -idea -text -noout -modulus -check \
-print_certs -text -noout' -pubin -pubout -engine'
;; ;;
rand) rsautl)
options='-out -rand -base64' options='-in -out -inkey -pubin -certin -sign -verify \
;; -encrypt -decrypt -pkcs -ssl -raw -hexdump -asn1parse'
req) ;;
options='-inform -outform -in -passin \ s_client)
-out -passout -text -noout \ options='-connect -verify -cert -certform -key -keyform \
-verify -modulus -new -rand \ -pass -CApath -CAfile -reconnect -pause -showcerts \
-newkey -newkey -nodes -key \ -debug -msg -nbio_test -state -nbio -crlf -ign_eof \
-keyform -keyout -md5 -sha1 \ -quiet -ssl2 -ssl3 -tls1 -no_ssl2 -no_ssl3 -no_tls1 \
-md2 -mdc2 -config -x509 \ -bugs -cipher -starttls -engine -tlsextdebug \
-days -asn1-kludge -newhdr \ -no_ticket -sess_out -sess_in -rand'
-extensions -reqexts section' ;;
;; s_server)
rsa) options='-accept -context -verify -Verify -crl_check \
options='-inform -outform -in -passin \ -crl_check_all -cert -certform -key -keyform -pass \
-out -passout -sgckey -des \ -dcert -dcertform -dkey -dkeyform -dpass -dhparam \
-des3 -idea -text -noout \ -nbio -nbio_test -crlf -debug -msg -state -CApath \
-modulus -check -pubin -pubout \ -CAfile -nocert -cipher -quiet -no_tmp_rsa -ssl2 \
-engine' -ssl3 -tls1 -no_ssl2 -no_ssl3 -no_tls1 -no_dhe \
;; -bugs -hack -www -WWW -HTTP -engine -tlsextdebug \
rsautl) -no_ticket -id_prefix -rand'
options='-in -out -inkey -pubin \ ;;
-certin -sign -verify -encrypt \ s_time)
-decrypt -pkcs -ssl -raw \ options='-connect -www -cert -key -CApath -CAfile -reuse \
-hexdump -asn1parse' -new -verify -nbio -time -ssl2 -ssl3 -bugs -cipher'
;; ;;
s_client) sess_id)
options='-connect -verify -cert \ options='-inform -outform -in -out -text -noout -context \
-certform -key -keyform -pass \ ID'
-CApath -CAfile -reconnect \ ;;
-pause -showcerts -debug -msg \ smime)
-nbio_test -state -nbio -crlf \ options='-encrypt -decrypt -sign -verify -pk7out -des \
-ign_eof -quiet -ssl2 -ssl3 \ -des3 -rc2-40 -rc2-64 -rc2-128 -aes128 -aes192 -aes256 \
-tls1 -no_ssl2 -no_ssl3 \ -in -certfile -signer -recip -inform -passin -inkey \
-no_tls1 -bugs -cipher \ -out -outform -content -to -from -subject -text -rand'
-starttls -engine -tlsextdebug \ ;;
-no_ticket -sess_out -sess_in \ speed)
-rand' options='-engine'
;; ;;
s_server) verify)
options='-accept -context -verify \ options='-CApath -CAfile -purpose -untrusted -help \
-Verify -crl_check \ -issuer_checks -verbose -certificates'
-crl_check_all -cert -certform \ ;;
-key -keyform -pass -dcert \ x509)
-dcertform -dkey -dkeyform \ options='-inform -outform -keyform -CAform -CAkeyform -in \
-dpass -dhparam -nbio \ -out -serial -hash -subject-hash -issuer_hash -subject \
-nbio_test -crlf -debug -msg \ -issuer -nameopt -email -startdate -enddate -purpose \
-state -CApath -CAfile -nocert \ -dates -modulus -fingerprint -alias -noout -trustout \
-cipher -quiet -no_tmp_rsa \ -clrtrust -clrreject -addtrust -addreject -setalias \
-ssl2 -ssl3 -tls1 -no_ssl2 \ -days -set_serial -signkey -x509toreq -req -CA -CAkey \
-no_ssl3 -no_tls1 -no_dhe \ -CAcreateserial -CAserial -text -C -md2 -md5 -sha1 \
-bugs -hack -www -WWW -HTTP \ -mdc2 -clrext -extfile -extensions -engine'
-engine -tlsextdebug \ ;;
-no_ticket -id_prefix -rand' @(md5|md4|md2|sha1|sha|mdc2|ripemd160))
;; options='-c -d'
s_time) ;;
options='-connect -www -cert -key \ esac
-CApath -CAfile -reuse -new \ COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
-verify -nbio -time -ssl2 \ else
-ssl3 -bugs -cipher' if [[ "$command" == speed ]]; then
;; COMPREPLY=( $( compgen -W 'md2 mdc2 md5 hmac sha1 rmd160 \
sess_id) idea-cbc rc2-cbc rc5-cbc bf-cbc des-cbc des-ede3 rc4 \
options='-inform -outform -in -out \ rsa512 rsa1024 rsa2048 rsa4096 dsa512 dsa1024 dsa2048 idea \
-text -noout -context ID' rc2 des rsa blowfish' -- "$cur" ) )
;; else
smime) _filedir
options='-encrypt -decrypt -sign \ fi
-verify -pk7out -des -des3 \ fi
-rc2-40 -rc2-64 -rc2-128 \ fi
-aes128 -aes192 -aes256 -in \
-certfile -signer -recip \
-inform -passin -inkey -out \
-outform -content -to -from \
-subject -text -rand'
;;
speed)
options='-engine'
;;
verify)
options='-CApath -CAfile -purpose \
-untrusted -help \
-issuer_checks -verbose \
-certificates'
;;
x509)
options='-inform -outform -keyform \
-CAform -CAkeyform -in -out \
-serial -hash -subject-hash \
-issuer_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'
;;
@(md5|md4|md2|sha1|sha|mdc2|ripemd160))
options='-c -d'
;;
esac
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
else
if [[ "$command" == speed ]]; then
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" ) )
else
_filedir
fi
fi
fi
} }
complete -F _openssl $default openssl complete -F _openssl $default openssl
} }
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,59 +3,58 @@
have p4 && have p4 &&
_p4() _p4()
{ {
local cur prev prev2 p4commands p4filetypes local cur prev prev2 p4commands p4filetypes
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
# rename isn't really a command # rename isn't really a command
p4commands="$( p4 help commands | awk 'NF>3 {print $1}' )" p4commands="$( p4 help commands | awk 'NF>3 {print $1}' )"
p4filetypes="ctext cxtext ktext kxtext ltext tempobj ubinary \ p4filetypes="ctext cxtext ktext kxtext ltext tempobj ubinary \
uresource uxbinary xbinary xltext xtempobj xtext \ uresource uxbinary xbinary xltext xtempobj xtext \
text binary resource" text binary resource"
if [ $COMP_CWORD -eq 1 ]; then if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $( compgen -W "$p4commands" -- "$cur" ) ) COMPREPLY=( $( compgen -W "$p4commands" -- "$cur" ) )
elif [ $COMP_CWORD -eq 2 ]; then elif [ $COMP_CWORD -eq 2 ]; then
case "$prev" in case "$prev" in
help) help)
COMPREPLY=( $( compgen -W "simple commands \ COMPREPLY=( $( compgen -W "simple commands \
environment filetypes jobview revisions \ environment filetypes jobview revisions \
usage views $p4commands" -- "$cur" ) ) usage views $p4commands" -- "$cur" ) )
;; ;;
admin) admin)
COMPREPLY=( $( compgen -W "checkpoint stop" -- "$cur" ) ) COMPREPLY=( $( compgen -W "checkpoint stop" -- "$cur" ) )
;; ;;
*) *)
;; ;;
esac esac
elif [ $COMP_CWORD -gt 2 ]; then elif [ $COMP_CWORD -gt 2 ]; then
prev2=${COMP_WORDS[COMP_CWORD-2]} prev2=${COMP_WORDS[COMP_CWORD-2]}
case "$prev" in case "$prev" in
-t) -t)
case "$prev2" in case "$prev2" in
add|edit|reopen) add|edit|reopen)
COMPREPLY=( $( compgen -W "$p4filetypes" \ COMPREPLY=( $( compgen -W "$p4filetypes" -- "$cur") )
-- "$cur") ) ;;
;; *)
*) ;;
;; esac
esac ;;
;; *)
*) ;;
;; esac
esac fi
fi
return 0 return 0
} && } &&
complete -F _p4 $default p4 g4 complete -F _p4 $default p4 g4
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -19,32 +19,32 @@ _perl()
# If option not followed by whitespace, reassign prev and cur # If option not followed by whitespace, reassign prev and cur
if [[ "$cur" == -?* ]]; then if [[ "$cur" == -?* ]]; then
temp=$cur temp=$cur
prev=${temp:0:2} prev=${temp:0:2}
cur=${temp:2} cur=${temp:2}
optPrefix=-P$prev optPrefix=-P$prev
optSuffix=-S/ optSuffix=-S/
prefix=$prev prefix=$prev
fi fi
# only handle module completion for now # only handle module completion for now
case "$prev" in case "$prev" in
-I|-x) -I|-x)
local IFS=$'\t\n' local IFS=$'\t\n'
COMPREPLY=( $( compgen -d $optPrefix $optSuffix -- "$cur" ) ) COMPREPLY=( $( compgen -d $optPrefix $optSuffix -- "$cur" ) )
return 0 return 0
;; ;;
-m|-M) -m|-M)
_perlmodules _perlmodules
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-C -s -T -u -U -W -X -h -v -V -c -w -d \ 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" ) ) -D -p -n -a -F -l -0 -I -m -M -P -S -x -i -e ' -- "$cur" ) )
else else
_filedir _filedir
fi fi
} }
complete -F _perl $nospace $filenames perl complete -F _perl $nospace $filenames perl
@ -60,56 +60,59 @@ _perldoc()
# completing an option (may or may not be separated by a space) # completing an option (may or may not be separated by a space)
if [[ "$cur" == -?* ]]; then if [[ "$cur" == -?* ]]; then
temp=$cur temp=$cur
prev=${temp:0:2} prev=${temp:0:2}
cur=${temp:2} cur=${temp:2}
prefix=$prev prefix=$prev
fi fi
# complete builtin perl functions # complete builtin perl functions
case $prev in case $prev in
-f) -f)
COMPREPLY=( $( compgen -W 'chomp chop chr crypt hex index lc \ COMPREPLY=( $( compgen -W 'chomp chop chr crypt hex index lc \
lcfirst length oct ord pack q qq reverse rindex sprintf \ lcfirst length oct ord pack q qq reverse rindex sprintf \
substr tr uc ucfirst y m pos quotemeta s split study qr abs \ 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 \ atan2 cos exp hex int log oct rand sin sqrt srand pop push \
shift splice unshift grep join map qw reverse sort unpack \ shift splice unshift grep join map qw reverse sort unpack \
delete each exists keys values binmode close closedir \ delete each exists keys values binmode close closedir \
dbmclose dbmopen die eof fileno flock format getc print \ dbmclose dbmopen die eof fileno flock format getc print \
printf read readdir rewinddir seek seekdir select syscall \ printf read readdir rewinddir seek seekdir select syscall \
sysread sysseek syswrite tell telldir truncate warn write \ sysread sysseek syswrite tell telldir truncate warn write \
pack read syscall sysread syswrite unpack vec -X chdir chmod \ pack read syscall sysread syswrite unpack vec -X chdir chmod \
chown chroot fcntl glob ioctl link lstat mkdir open opendir \ chown chroot fcntl glob ioctl link lstat mkdir open opendir \
readlink rename rmdir stat symlink umask unlink utime caller \ readlink rename rmdir stat symlink umask unlink utime caller \
continue do dump eval exit goto last next redo return \ continue do dump eval exit goto last next redo return \
sub wantarray caller import local my our package use defined \ sub wantarray caller import local my our package use defined \
formline reset scalar undef \ formline reset scalar undef \
alarm exec fork getpgrp getppid getpriority kill pipe qx \ alarm exec fork getpgrp getppid getpriority kill pipe qx \
setpgrp setpriority sleep system times wait waitpid \ setpgrp setpriority sleep system times wait waitpid \
import no package require use bless dbmclose dbmopen package \ import no package require use bless dbmclose dbmopen package \
ref tie tied untie use accept bind connect getpeername \ ref tie tied untie use accept bind connect getpeername \
getsockname getsockopt listen recv send setsockopt shutdown \ getsockname getsockopt listen recv send setsockopt shutdown \
socket socketpair msgctl msgget msgrcv msgsnd semctl semget \ socket socketpair msgctl msgget msgrcv msgsnd semctl semget \
semop shmctl shmget shmread shmwrite endgrent endhostent \ semop shmctl shmget shmread shmwrite endgrent endhostent \
endnetent endpwent getgrent getgrgid getgrnam getlogin \ endnetent endpwent getgrent getgrgid getgrnam getlogin \
getpwent getpwnam getpwuid setgrent setpwent endprotoent \ getpwent getpwnam getpwuid setgrent setpwent endprotoent \
endservent gethostbyaddr gethostbyname gethostent \ endservent gethostbyaddr gethostbyname gethostent \
getnetbyaddr getnetbyname getnetent getprotobyname \ getnetbyaddr getnetbyname getnetent getprotobyname \
getprotobynumber getprotoent getservbyname getservbyport \ getprotobynumber getprotoent getservbyname getservbyport \
getservent sethostent setnetent setprotoent setservent \ getservent sethostent setnetent setprotoent setservent \
gmtime localtime time times' -- "$cur" ) ) gmtime localtime time times' -- "$cur" ) )
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-h -v -t -u -m -l -F -X -f -q' -- "$cur" )) COMPREPLY=( $( compgen -W '-h -v -t -u -m -l -F -X -f -q' -- "$cur" ))
else else
# return available modules (unless it is clearly a file) # return available modules (unless it is clearly a file)
if [[ "$cur" != */* ]]; then if [[ "$cur" != */* ]]; then
_perlmodules _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" ) ) COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
fi '$( PAGER=/bin/cat man perl | \
sed -ne "/perl.*Perl overview/,/perlwin32/p" | \
awk "\$NF=2 { print \$1}" | grep perl )' -- "$cur" ) )
fi
fi fi
} }
complete -F _perldoc $default perldoc complete -F _perldoc $default perldoc
@ -117,8 +120,8 @@ complete -F _perldoc $default perldoc
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,20 +3,20 @@
have pine && have pine &&
_pineaddr() _pineaddr()
{ {
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
COMPREPLY=( $( compgen -W '$( awk "{print \$1}" ~/.addressbook 2>/dev/null)' \ COMPREPLY=( $( compgen -W '$( awk "{print \$1}" ~/.addressbook \
-- "$cur" ) ) 2>/dev/null)' -- "$cur" ) )
} && } &&
complete -F _pineaddr $default pine complete -F _pineaddr $default pine
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,50 +3,50 @@
have pkg-config && have pkg-config &&
_pkg_config() _pkg_config()
{ {
local cur prev split=false local cur prev split=false
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
_split_longopt && split=true _split_longopt && split=true
case $prev in case $prev in
--@(?(define-)variable|@(atleast?(-pkgconfig)|exact|max)-version)) --@(?(define-)variable|@(atleast?(-pkgconfig)|exact|max)-version))
# argument required but no completions available # argument required but no completions available
return 0 return 0
;; ;;
-\?|--help|--version|--usage) -\?|--help|--version|--usage)
# all other arguments are noop with these # all other arguments are noop with these
return 0 return 0
;; ;;
esac esac
$split && return 0 $split && return 0
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
# return list of available options # return list of available options
COMPREPLY=( $( compgen -W '--version --modversion \ COMPREPLY=( $( compgen -W '--version --modversion \
--atleast-pkgconfig-version --libs --static \ --atleast-pkgconfig-version --libs --static \
--short-errors --libs-only-l --libs-only-other \ --short-errors --libs-only-l --libs-only-other \
--libs-only-L --cflags --cflags-only-I \ --libs-only-L --cflags --cflags-only-I \
--cflags-only-other --variable --define-variable \ --cflags-only-other --variable --define-variable \
--exists --uninstalled --atleast-version \ --exists --uninstalled --atleast-version \
--exact-version --max-version --list-all --debug \ --exact-version --max-version --list-all --debug \
--print-errors --silence-errors --errors-to-stdout \ --print-errors --silence-errors --errors-to-stdout \
--print-provides --print-requires -? --help --usage' \ --print-provides --print-requires -? --help --usage' \
-- "$cur") ) -- "$cur") )
else else
COMPREPLY=( $( compgen -W "$( pkg-config --list-all \ COMPREPLY=( $( compgen -W "$( pkg-config --list-all \
2>/dev/null | awk '{print $1}' )" -- "$cur" ) ) 2>/dev/null | awk '{print $1}' )" -- "$cur" ) )
fi fi
} && } &&
complete -F _pkg_config pkg-config complete -F _pkg_config pkg-config
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -5,18 +5,18 @@
_pkg_delete() _pkg_delete()
{ {
local cur pkgdir prev local cur pkgdir prev
pkgdir=${PKG_DBDIR:-/var/db/pkg}/ pkgdir=${PKG_DBDIR:-/var/db/pkg}/
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
[ "$prev" = "-o" -o "$prev" = "-p" -o "$prev" = "-W" ] && return 0 [ "$prev" = "-o" -o "$prev" = "-p" -o "$prev" = "-W" ] && return 0
COMPREPLY=( $( compgen -d "$pkgdir$cur" ) ) COMPREPLY=( $( compgen -d "$pkgdir$cur" ) )
COMPREPLY=( ${COMPREPLY[@]#$pkgdir} ) COMPREPLY=( ${COMPREPLY[@]#$pkgdir} )
return 0 return 0
} }
complete -F _pkg_delete $dirnames pkg_delete pkg_info complete -F _pkg_delete $dirnames pkg_delete pkg_info
@ -24,8 +24,8 @@ complete -F _pkg_delete $dirnames pkg_delete pkg_info
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,20 +3,20 @@
have removepkg && [ -f /etc/slackware-version ] && have removepkg && [ -f /etc/slackware-version ] &&
_removepkg() _removepkg()
{ {
local packages cur local packages cur
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
COMPREPLY=( $( (cd /var/log/packages; compgen -f -- "$cur") ) ) COMPREPLY=( $( (cd /var/log/packages; compgen -f -- "$cur") ) )
} && } &&
complete -F _removepkg $filenames removepkg && complete -F _removepkg $filenames removepkg &&
complete $dirnames -f -X '!*.tgz' installpkg upgradepkg explodepkg complete $dirnames -f -X '!*.tgz' installpkg upgradepkg explodepkg
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -3,46 +3,46 @@
have portupgrade && have portupgrade &&
_portupgrade() _portupgrade()
{ {
local cur pkgdir prev local cur pkgdir prev
pkgdir=${PKG_DBDIR:-/var/db/pkg}/ pkgdir=${PKG_DBDIR:-/var/db/pkg}/
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
[ "$prev" = "-l" -o "$prev" = "-L" -o "$prev" = "-o" ] && return 0 [ "$prev" = "-l" -o "$prev" = "-L" -o "$prev" = "-o" ] && return 0
COMPREPLY=( $( compgen -d "$pkgdir$cur" ) ) COMPREPLY=( $( compgen -d "$pkgdir$cur" ) )
COMPREPLY=( ${COMPREPLY[@]#$pkgdir} ) COMPREPLY=( ${COMPREPLY[@]#$pkgdir} )
COMPREPLY=( ${COMPREPLY[@]%-*} ) COMPREPLY=( ${COMPREPLY[@]%-*} )
return 0 return 0
} && } &&
complete -F _portupgrade $dirnames portupgrade complete -F _portupgrade $dirnames portupgrade
have portinstall && have portinstall &&
_portinstall() _portinstall()
{ {
local cur portsdir prev indexfile local cur portsdir prev indexfile
local -a COMPREPLY2 local -a COMPREPLY2
portsdir=${PORTSDIR:-/usr/ports}/ portsdir=${PORTSDIR:-/usr/ports}/
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
# First try INDEX-5 # First try INDEX-5
indexfile=$portsdir/INDEX-5 indexfile=$portsdir/INDEX-5
# Then INDEX if INDEX-5 does not exist or system is not FreeBSD 5.x # Then INDEX if INDEX-5 does not exist or system is not FreeBSD 5.x
[ "${OSTYPE%.*}" = "freebsd5" -a -f $indexfile ] || [ "${OSTYPE%.*}" = "freebsd5" -a -f $indexfile ] ||
indexfile=$portsdir/INDEX indexfile=$portsdir/INDEX
[ "$prev" = "-l" -o "$prev" = "-L" -o "$prev" = "-o" ] && return 0 [ "$prev" = "-l" -o "$prev" = "-L" -o "$prev" = "-o" ] && return 0
COMPREPLY=( $( egrep "^$cur" < $indexfile | cut -d'|' -f1 ) ) COMPREPLY=( $( egrep "^$cur" < $indexfile | cut -d'|' -f1 ) )
COMPREPLY2=( $( egrep "^[^\|]+\|$portsdir$cur" < $indexfile | \ COMPREPLY2=( $( egrep "^[^\|]+\|$portsdir$cur" < $indexfile | \
cut -d'|' -f2 ) ) cut -d'|' -f2 ) )
COMPREPLY2=( ${COMPREPLY2[@]#$portsdir} ) COMPREPLY2=( ${COMPREPLY2[@]#$portsdir} )
COMPREPLY=( "${COMPREPLY[@]}" "${COMPREPLY2[@]}" ) COMPREPLY=( "${COMPREPLY[@]}" "${COMPREPLY2[@]}" )
return 0 return 0
} && } &&
complete -F _portinstall $dirnames portinstall complete -F _portinstall $dirnames portinstall
@ -52,8 +52,8 @@ complete -F _pkg_delete $dirnames pkg_deinstall
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

View File

@ -5,30 +5,30 @@ have postfix && {
# #
_postfix() _postfix()
{ {
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in case $prev in
-c) -c)
_filedir -d _filedir -d
return 0 return 0
;; ;;
-D) -D)
COMPREPLY=( $( compgen -W 'start' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'start' -- "$cur" ) )
return 0 return 0
;; ;;
esac esac
if [[ $cur == -* ]]; then if [[ $cur == -* ]]; then
COMPREPLY=( $( compgen -W '-c -D -v' -- "$cur" ) ) COMPREPLY=( $( compgen -W '-c -D -v' -- "$cur" ) )
return 0 return 0
fi fi
COMPREPLY=( $( compgen -W 'check start stop abort flush reload status \ COMPREPLY=( $( compgen -W 'check start stop abort flush reload status \
set-permissions upgrade-configuration' -- "$cur" ) ) set-permissions upgrade-configuration' -- "$cur" ) )
} }
complete -F _postfix $filenames postfix complete -F _postfix $filenames postfix
@ -36,44 +36,44 @@ complete -F _postfix $filenames postfix
# #
_postmap() _postmap()
{ {
local cur prev len idx local cur prev len idx
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in case $prev in
-c) -c)
_filedir -d _filedir -d
return 0 return 0
;; ;;
-[dq]) -[dq])
return 0 return 0
;; ;;
esac esac
if [[ $cur == -* ]]; then if [[ $cur == -* ]]; then
COMPREPLY=( $( compgen -W '-N -f -i -n -o -p -r -v -w -c -d -q'\ COMPREPLY=( $( compgen -W '-N -f -i -n -o -p -r -v -w -c -d -q'\
-- "$cur" ) ) -- "$cur" ) )
return 0 return 0
fi fi
if [[ "$cur" == *:* ]]; then if [[ "$cur" == *:* ]]; then
COMPREPLY=( $( compgen -f -- "${cur#*:}" ) ) COMPREPLY=( $( compgen -f -- "${cur#*:}" ) )
else else
len=${#cur} len=${#cur}
idx=0 idx=0
for pval in $( /usr/sbin/postconf -m ); do for pval in $( /usr/sbin/postconf -m ); do
if [[ "$cur" == "${pval:0:$len}" ]]; then if [[ "$cur" == "${pval:0:$len}" ]]; then
COMPREPLY[$idx]="$pval:" COMPREPLY[$idx]="$pval:"
idx=$(($idx+1)) idx=$(($idx+1))
fi fi
done done
if [[ $idx -eq 0 ]]; then if [[ $idx -eq 0 ]]; then
COMPREPLY=( $( compgen -f -- "$cur" ) ) COMPREPLY=( $( compgen -f -- "$cur" ) )
fi fi
fi fi
return 0 return 0
} }
complete -F _postmap $filenames postmap postalias complete -F _postmap $filenames postmap postalias
@ -81,43 +81,43 @@ complete -F _postmap $filenames postmap postalias
# #
_postcat() _postcat()
{ {
local cur prev pval len idx qfile local cur prev pval len idx qfile
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in case $prev in
-c) -c)
_filedir -d _filedir -d
return 0 return 0
;; ;;
esac esac
if [[ $cur == -* ]]; then if [[ $cur == -* ]]; then
COMPREPLY=( $( compgen -W '-c -q -v' -- "$cur" ) ) COMPREPLY=( $( compgen -W '-c -q -v' -- "$cur" ) )
return 0 return 0
fi fi
qfile=0 qfile=0
for idx in "${COMP_WORDS[@]}"; do for idx in "${COMP_WORDS[@]}"; do
[[ "$idx" = -q ]] && qfile=1 && break [[ "$idx" = -q ]] && qfile=1 && break
done done
if [[ $qfile == 1 ]]; then if [[ $qfile == 1 ]]; then
len=${#cur} len=${#cur}
idx=0 idx=0
for pval in $( mailq 2>/dev/null | \ for pval in $( mailq 2>/dev/null | \
sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* !].*$//' ); do sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* !].*$//' ); do
if [[ "$cur" == "${pval:0:$len}" ]]; then if [[ "$cur" == "${pval:0:$len}" ]]; then
COMPREPLY[$idx]=$pval COMPREPLY[$idx]=$pval
idx=$(($idx+1)) idx=$(($idx+1))
fi fi
done done
return 0 return 0
else else
_filedir _filedir
return 0 return 0
fi fi
} }
complete -F _postcat $filenames postcat complete -F _postcat $filenames postcat
@ -125,42 +125,42 @@ complete -F _postcat $filenames postcat
# #
_postconf() _postconf()
{ {
local cur prev pval len idx eqext local cur prev pval len idx eqext
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in case $prev in
-b|-t) -b|-t)
_filedir _filedir
return 0 return 0
;; ;;
-c) -c)
_filedir -d _filedir -d
return 0 return 0
;; ;;
-e) -e)
cur=${cur#[\"\']} cur=${cur#[\"\']}
eqext='=' eqext='='
;; ;;
esac esac
if [[ $cur == -* ]]; then if [[ $cur == -* ]]; then
COMPREPLY=( $( compgen -W '-A -a -b -c -d -e -h -m -l -n -t -v'\ COMPREPLY=( $( compgen -W '-A -a -b -c -d -e -h -m -l -n -t -v'\
-- "$cur" ) ) -- "$cur" ) )
return 0 return 0
fi fi
len=${#cur} len=${#cur}
idx=0 idx=0
for pval in $( /usr/sbin/postconf 2>/dev/null | cut -d ' ' -f 1 ); do for pval in $( /usr/sbin/postconf 2>/dev/null | cut -d ' ' -f 1 ); do
if [[ "$cur" == "${pval:0:$len}" ]]; then if [[ "$cur" == "${pval:0:$len}" ]]; then
COMPREPLY[$idx]="$pval$eqext" COMPREPLY[$idx]="$pval$eqext"
idx=$(($idx+1)) idx=$(($idx+1))
fi fi
done done
return 0 return 0
} }
complete -F _postconf $filenames postconf complete -F _postconf $filenames postconf
@ -168,69 +168,69 @@ complete -F _postconf $filenames postconf
# #
_postsuper() _postsuper()
{ {
local cur prev pval len idx local cur prev pval len idx
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in case $prev in
-c) -c)
_filedir -d _filedir -d
return 0 return 0
;; ;;
-[dr]) -[dr])
len=${#cur} len=${#cur}
idx=0 idx=0
for pval in $( echo ALL; mailq 2>/dev/null | \ for pval in $( echo ALL; mailq 2>/dev/null | \
sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* !].*$//' ); do sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* !].*$//' ); do
if [[ "$cur" == "${pval:0:$len}" ]]; then if [[ "$cur" == "${pval:0:$len}" ]]; then
COMPREPLY[$idx]=$pval COMPREPLY[$idx]=$pval
idx=$(($idx+1)) idx=$(($idx+1))
fi fi
done done
return 0 return 0
;; ;;
-h) -h)
len=${#cur} len=${#cur}
idx=0 idx=0
for pval in $( echo ALL; mailq 2>/dev/null | \ for pval in $( echo ALL; mailq 2>/dev/null | \
sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* ].*$//; /!$/d' ); do sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* ].*$//; /!$/d' ); do
if [[ "$cur" == "${pval:0:$len}" ]]; then if [[ "$cur" == "${pval:0:$len}" ]]; then
COMPREPLY[$idx]=$pval COMPREPLY[$idx]=$pval
idx=$(($idx+1)) idx=$(($idx+1))
fi fi
done done
return 0 return 0
;; ;;
-H) -H)
len=${#cur} len=${#cur}
idx=0 idx=0
for pval in $( echo ALL; mailq 2>/dev/null | \ for pval in $( echo ALL; mailq 2>/dev/null | \
sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; /^[0-9A-Z]*[* ]/d; s/!.*$//' ); do sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; /^[0-9A-Z]*[* ]/d; s/!.*$//' ); do
if [[ "$cur" == "${pval:0:$len}" ]]; then if [[ "$cur" == "${pval:0:$len}" ]]; then
COMPREPLY[$idx]=$pval COMPREPLY[$idx]=$pval
idx=$(($idx+1)) idx=$(($idx+1))
fi fi
done done
return 0 return 0
;; ;;
esac esac
if [[ $cur == -* ]]; then if [[ $cur == -* ]]; then
COMPREPLY=( $( compgen -W '-c -d -h -H -p -r -s -v' -- "$cur" ) ) COMPREPLY=( $( compgen -W '-c -d -h -H -p -r -s -v' -- "$cur" ) )
return 0 return 0
fi fi
COMPREPLY=( $( compgen -W 'hold incoming active deferred' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'hold incoming active deferred' -- "$cur" ) )
} }
complete -F _postsuper $filenames postsuper complete -F _postsuper $filenames postsuper
} }
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script
# sh-basic-offset: 8 # sh-basic-offset: 4
# sh-indent-comment: t # sh-indent-comment: t
# indent-tabs-mode: t # indent-tabs-mode: nil
# End: # End:
# ex: ts=8 sw=8 noet filetype=sh # ex: ts=4 sw=4 et filetype=sh

Some files were not shown because too many files have changed in this diff Show More