fix conflict

This commit is contained in:
Guillaume Rousse 2009-05-29 09:56:57 +02:00
commit b3f8e617ac
12 changed files with 557 additions and 551 deletions

10
CHANGES
View File

@ -38,8 +38,9 @@ bash-completion (1.x)
* Add _split_longopt() helper for improved handling of long options that * Add _split_longopt() helper for improved handling of long options that
take arguments in both "--foo bar" and "--foo=bar" formats. take arguments in both "--foo bar" and "--foo=bar" formats.
* Use _split_longopt to improve and clean up aspell, chgrp, chown, chkconfig, * Use _split_longopt to improve and clean up aspell, chgrp, chown, chkconfig,
iptables, make, mii-diag, mii-tool, mkinitrd, smartctl, and generic long cpio, iptables, make, mc, mii-diag, mii-tool, mkinitrd, postgresql,
option completion (Alioth: #311398). quota, samba, smartctl, and generic long option completion
(Alioth: #311398).
* Add chown --from and --reference value completions. * Add chown --from and --reference value completions.
* Add chgrp --reference value completion. * Add chgrp --reference value completion.
* Do not assume all --foo= options take filenames in generic long option * Do not assume all --foo= options take filenames in generic long option
@ -49,6 +50,11 @@ bash-completion (1.x)
* Fix leaking $prev from cpio, dsniff, freeciv, gkrellm, mkinitrd, and * Fix leaking $prev from cpio, dsniff, freeciv, gkrellm, mkinitrd, and
tcpdump completions. tcpdump completions.
* Split ant completion to contrib/ant, improve the built in one. * Split ant completion to contrib/ant, improve the built in one.
* Improve postfix completion.
* Improve samba completion.
* Split lilo completion to contrib/lilo.
* Split reportbug and querybts completions to contrib/reportbug.
* Remove debug output noise from quotaon completion.
[ Todd Zullinger ] [ Todd Zullinger ]
* Make yum complete on filenames after install, deplist, update and upgrade * Make yum complete on filenames after install, deplist, update and upgrade

View File

@ -42,6 +42,7 @@ bashcomp_DATA = contrib/ant \
contrib/larch \ contrib/larch \
contrib/ldapvi \ contrib/ldapvi \
contrib/lftp \ contrib/lftp \
contrib/lilo \
contrib/lilypond \ contrib/lilypond \
contrib/links \ contrib/links \
contrib/lisp \ contrib/lisp \
@ -78,6 +79,7 @@ bashcomp_DATA = contrib/ant \
contrib/quota-tools \ contrib/quota-tools \
contrib/rdesktop \ contrib/rdesktop \
contrib/repomanage \ contrib/repomanage \
contrib/reportbug \
contrib/ri \ contrib/ri \
contrib/rcs \ contrib/rcs \
contrib/rpcdebug \ contrib/rpcdebug \

View File

@ -1008,7 +1008,7 @@ complete -F _insmod $filenames insmod modprobe modinfo
-o $UNAME = OpenBSD ] && -o $UNAME = OpenBSD ] &&
_man() _man()
{ {
local cur prev sect manpath manext mansect UNAME local cur prev sect manpath manext mansect uname
manext="@([0-9lnp]|[0-9][px]|man)?(.@(gz|bz2|lzma))" manext="@([0-9lnp]|[0-9][px]|man)?(.@(gz|bz2|lzma))"
mansect="@([0-9lnp]|[0-9][px])" mansect="@([0-9lnp]|[0-9][px])"
@ -1030,11 +1030,8 @@ _man()
return 0 return 0
fi fi
UNAME=$( uname -s ) uname=$( uname -s )
# strip OS type and version under Cygwin if [[ $uname == @(Linux|GNU|GNU/*|FreeBSD|Cygwin|CYGWIN_*) ]]; then
UNAME=${UNAME/CYGWIN_*/Cygwin}
if [ $USERLAND = GNU -o $UNAME = FreeBSD \
-o $UNAME = Cygwin ]; then
manpath=$( manpath 2>/dev/null || command man --path ) manpath=$( manpath 2>/dev/null || command man --path )
else else
manpath=$MANPATH manpath=$MANPATH
@ -3376,181 +3373,6 @@ _configure_func()
} }
complete -F _configure_func $default configure complete -F _configure_func $default configure
# Debian reportbug(1) completion
#
have reportbug &&
_reportbug()
{
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in
-f|--filename|-i|--include|--mta|-o|--output)
_filedir
return 0
;;
-B|--bts)
COMPREPLY=( $( compgen -W "debian guug kde mandrake help" -- \
$cur ))
return 0
;;
-e|--editor|--mua)
COMP_WORDS=(COMP_WORDS[0] $cur)
COMP_CWORD=1
_command
return 0
;;
--mode)
COMPREPLY=( $( compgen -W "novice standard expert" -- $cur ) )
return 0
;;
-S|--severity)
COMPREPLY=( $( compgen -W "grave serious important normal \
minor wishlist" -- $cur ) )
return 0
;;
-u|--ui|--interface)
COMPREPLY=( $( compgen -W "newt text gnome" -- $cur ) )
return 0
;;
-t|--type)
COMPREPLY=( $( compgen -W "gnats debbugs" -- $cur ) )
return 0
;;
-T|--tags)
COMPREPLY=( $( compgen -W "none \
woody potato sarge sarge-ignore etch etch-ignore \
lenny lenny-ignore sid experimental confirmed \
d-i fixed fixed-in-experimental fixed-upstream \
help l10n moreinfo patch pending security \
unreproducible upstream wontfix ipv6 lfs" -- $cur ))
return 0
;;
*)
;;
esac
COMPREPLY=($( compgen -W '-h --help -v --version -a --af -b \
--no-query-bts --query-bts -B --bts -c --configure \
--no-config-files --check-available -d --debug \
--no-check-available -e --editor --email -f \
--filename -g --gnupg -H --header -i --include -j \
--justification -l --ldap --no-ldap -L --list-cc -m \
--maintonly --mode --mua --mta --mutt -n --mh --nmh \
-o --output -p --print -P --pgp --proxy --http_proxy\
-q --quiet -Q --query-only --realname --report-quiet \
--reply-to --replyto -s --subject -S --severity \
--smtphost -t --type -T --tags --template -V -x \
--no-cc --package-version -z --no-compress \
--ui --interface -u \
wnpp boot-floppies kernel bugs.debian.org \
cdimage.debian.org general installation-reports \
listarchives lists.debian.org mirrors nm.debian.org \
press project qa.debian.org release-notes \
security.debian.org tech-ctte upgrade-reports \
www.debian.org' -- $cur ) \
$( apt-cache pkgnames -- $cur 2> /dev/null) )
_filedir
return 0
} &&
complete -F _reportbug $filenames reportbug
# Debian querybts(1) completion
#
have querybts &&
_querybts()
{
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in
-B|--bts)
COMPREPLY=( $( compgen -W "debian guug kde mandrake help" -- \
$cur ))
return 0
;;
-u|--ui|--interface)
COMPREPLY=($( compgen -W "newt text gnome" -- $cur ))
return 0
;;
*)
;;
esac
COMPREPLY=($( compgen -W '-h --help -v --version -A --archive \
-B --bts -l --ldap --no-ldap --proxy= --http_proxy= \
-s --source -w --web -u --ui --interface \
wnpp boot-floppies kernel bugs.debian.org \
cdimage.debian.org general installation-reports \
listarchives lists.debian.org mirrors nm.debian.org \
press project qa.debian.org release-notes \
security.debian.org tech-ctte upgrade-reports \
www.debian.org' -- $cur ) \
$( apt-cache pkgnames -- $cur 2> /dev/null) )
} &&
complete -F _querybts $filenames querybts
# lilo(8) completion
#
have lilo && {
_lilo_labels()
{
COMPREPLY=( $( awk -F'=' '/label/ {print $2}' \
/etc/lilo.conf | sed -e 's/"//g' | grep "^$cur" ) )
}
_lilo()
{
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in
-@(C|i|m|s|S))
_filedir
return 0
;;
-r)
_filedir -d
return 0
;;
-@(I|D|R))
# label completion
_lilo_labels
return 0
;;
-@(A|b|M|u|U))
# device completion
cur=${cur:=/dev/}
_filedir
return 0
;;
-T)
# topic completion
COMPREPLY=( $( compgen -W 'help ChRul EBDA geom geom= \
table= video' -- $cur ) )
return 0
;;
esac
if [[ "$cur" == -* ]]; then
# relevant options completion
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' -- \
$cur ) )
fi
}
complete -F _lilo lilo
}
[ $UNAME = FreeBSD ] && { [ $UNAME = FreeBSD ] && {
# FreeBSD package management tool completion # FreeBSD package management tool completion
# #
@ -4032,7 +3854,7 @@ unset i
[ $BASH_COMPLETION != ~/.bash_completion -a -r ~/.bash_completion ] \ [ $BASH_COMPLETION != ~/.bash_completion -a -r ~/.bash_completion ] \
&& . ~/.bash_completion && . ~/.bash_completion
unset -f have unset -f have
unset UNAME default dirnames filenames have nospace bashdefault plusdirs unset UNAME USERLAND default dirnames filenames have nospace bashdefault plusdirs
set $BASH_COMPLETION_ORIGINAL_V_VALUE set $BASH_COMPLETION_ORIGINAL_V_VALUE
unset BASH_COMPLETION_ORIGINAL_V_VALUE unset BASH_COMPLETION_ORIGINAL_V_VALUE

View File

@ -11,51 +11,35 @@ _cpio_format()
_cpio() _cpio()
{ {
local cur prev 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
# --name value style option # --name value style option
case $prev in case $prev in
-H) -H|--format)
_cpio_format _cpio_format
return 0 return 0
;; ;;
-@(E|F|I)) -@(E|F|I|-?(pattern-)file))
_filedir _filedir
return 0 return 0
;; ;;
-R) -R|--owner)
_usergroup _usergroup
return 0 return 0
;; ;;
--rsh-command)
COMPREPLY=( $( compgen -c -- $cur ) )
return 0
;;
esac esac
# --name=value style option $split && return 0
if [[ "$cur" == *=* ]]; then
prev=${cur/=*/}
cur=${cur/*=/}
case $prev in
--format)
_cpio_format
return 0
;;
--@(file|pattern-file))
_filedir
return 0
;;
--owner)
_usergroup
return 0
;;
--rsh-command)
COMPREPLY=( $( compgen -c -- $cur ) )
return 0
;;
esac
fi
if [ $COMP_CWORD -eq 1 ]; then 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) )
@ -64,11 +48,11 @@ _cpio()
-@(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
;; ;;
@ -76,18 +60,18 @@ _cpio()
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
;; ;;
@ -98,7 +82,7 @@ _cpio()
--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

57
contrib/lilo Normal file
View File

@ -0,0 +1,57 @@
# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
# ex: ts=8 sw=8 noet filetype=sh
#
# bash completion for lilo(8)
have lilo && {
_lilo_labels()
{
COMPREPLY=( $( compgen -W "$( awk -F'=' '/label/ {print $2}' \
/etc/lilo.conf | sed -e 's/\"//g' )" -- $cur ) )
}
_lilo()
{
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in
-@(C|i|m|s|S))
_filedir
return 0
;;
-r)
_filedir -d
return 0
;;
-@(I|D|R))
# label completion
_lilo_labels
return 0
;;
-@(A|b|M|u|U))
# device completion
cur=${cur:=/dev/}
_filedir
return 0
;;
-T)
# topic completion
COMPREPLY=( $( compgen -W 'help ChRul EBDA geom geom= \
table= video' -- $cur ) )
return 0
;;
esac
if [[ "$cur" == -* ]]; then
# relevant options completion
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' -- \
$cur ) )
fi
}
complete -F _lilo lilo
}

View File

@ -6,38 +6,38 @@
have mc && have mc &&
_mc() _mc()
{ {
local cur prev 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]}
# -name value style option _split_longopt && split=true
case "$prev" in case "$prev" in
-@(e|v|l|P)) -e|--edit|-v|--view|-l|--ftplog|-P|--printwd)
_filedir _filedir
return 0 return 0
;; ;;
-C|--colors|-D|--debuglevel)
# argument required but no completions available
return 0
;;
-h|--help|-V|--version)
# all other arguments are noop with these
return 0
;;
esac esac
# --name=value style option $split && return 0
if [[ "$cur" == *=* ]]; then
prev=${cur/=*/}
cur=${cur/*=/}
case "$prev" in
--@(edit|view|ftplog|printwd))
_filedir
return 0
;;
esac
fi
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 -h --help' -- $cur ) ) -v --view -V --version -x --xterm -D --debuglevel -h \
--help' -- $cur ) )
else else
_filedir -d _filedir -d
fi fi

View File

@ -10,25 +10,30 @@ _postfix()
{ {
local cur prev local cur prev
COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
if [[ $cur == '-' ]]; then case $prev in
COMPREPLY=(-c -D -v) -c)
_filedir -d
return 0
;;
-D)
COMPREPLY=( $( compgen -W 'start' -- $cur ) )
return 0
;;
esac
if [[ $cur == -* ]]; then
COMPREPLY=( $( compgen -W '-c -D -v' -- $cur ) )
return 0 return 0
fi fi
if [[ $prev == '-c' ]]; then
_filedir -d COMPREPLY=( $( compgen -W 'check start stop abort flush reload status \
return 0 set-permissions upgrade-configuration' -- $cur ) )
fi
if [[ $prev == '-D' ]]; then
COMPREPLY=( $( compgen -W 'start' -- "`_get_cword`" ) )
return 0
fi
COMPREPLY=( $( compgen -W 'start stop reload abort flush check' -- \
"`_get_cword`" ) )
} }
complete -F _postfix postfix complete -F _postfix $filenames postfix
# postalias(1) and postmap(1) # postalias(1) and postmap(1)
# #
@ -36,18 +41,23 @@ _postmap()
{ {
local cur prev len idx local cur prev len idx
COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
if [[ $cur == '-' ]]; then case $prev in
COMPREPLY=(-N -f -i -n -o -p -r -v -w -c -d -q) -c)
return 0 _filedir -d
fi return 0
if [[ $prev == '-c' ]]; then ;;
_filedir -d -[dq])
return 0 return 0
fi ;;
if [[ $prev == -[dq] ]]; then esac
if [[ $cur == -* ]]; then
COMPREPLY=( $( compgen -W '-N -f -i -n -o -p -r -v -w -c -d -q'\
-- $cur ) )
return 0 return 0
fi fi
@ -68,7 +78,7 @@ _postmap()
fi fi
return 0 return 0
} }
complete -F _postmap postmap postalias complete -F _postmap $filenames postmap postalias
# postcat(1) # postcat(1)
# #
@ -76,15 +86,19 @@ _postcat()
{ {
local cur prev pval len idx qfile local cur prev pval len idx qfile
COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
if [[ $cur == '-' ]]; then case $prev in
COMPREPLY=(-c -q -v) -c)
return 0 _filedir -d
fi return 0
if [[ $prev == '-c' ]]; then ;;
_filedir -d esac
if [[ $cur == -* ]]; then
COMPREPLY=( $( compgen -W '-c -q -v' -- $cur ) )
return 0 return 0
fi fi
@ -95,7 +109,7 @@ _postcat()
if [[ $qfile == 1 ]]; then if [[ $qfile == 1 ]]; then
len=${#cur} len=${#cur}
idx=0 idx=0
for pval in $( mailq | \ 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
@ -108,7 +122,7 @@ _postcat()
return 0 return 0
fi fi
} }
complete -F _postcat postcat complete -F _postcat $filenames postcat
# postconf(1) # postconf(1)
# #
@ -116,23 +130,34 @@ _postconf()
{ {
local cur prev pval len idx eqext local cur prev pval len idx eqext
COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
if [[ $cur == '-' ]]; then
COMPREPLY=(-c -d -e -h -m -l -n -v) case $prev in
-b|-t)
_filedir
return 0
;;
-c)
_filedir -d
return 0
;;
-e)
cur=${cur#[\"\']}
eqext='='
;;
esac
if [[ $cur == -* ]]; then
COMPREPLY=( $( compgen -W '-A -a -b -c -d -e -h -m -l -n -t -v'\
-- $cur ) )
return 0 return 0
fi fi
if [[ $prev == '-c' ]]; then
_filedir -d
return 0
fi
if [[ $prev == '-e' ]]; then
cur=${cur#[\"\']}
eqext='='
fi
len=${#cur} len=${#cur}
idx=0 idx=0
for pval in $( /usr/sbin/postconf | 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))
@ -140,7 +165,7 @@ _postconf()
done done
return 0 return 0
} }
complete -F _postconf postconf complete -F _postconf $filenames postconf
# postsuper(1) # postsuper(1)
# #
@ -148,53 +173,59 @@ _postsuper()
{ {
local cur prev pval len idx local cur prev pval len idx
COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
if [[ $cur == '-' ]]; then case $prev in
COMPREPLY=(-c -d -h -H -p -r -s -v) -c)
_filedir -d
return 0
;;
-[dr])
len=${#cur}
idx=0
for pval in $( echo ALL; mailq 2>/dev/null | \
sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* !].*$//' ); do
if [[ "$cur" == "${pval:0:$len}" ]]; then
COMPREPLY[$idx]=$pval
idx=$(($idx+1))
fi
done
return 0
;;
-h)
len=${#cur}
idx=0
for pval in $( echo ALL; mailq 2>/dev/null | \
sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* ].*$//; /!$/d' ); do
if [[ "$cur" == "${pval:0:$len}" ]]; then
COMPREPLY[$idx]=$pval
idx=$(($idx+1))
fi
done
return 0
;;
-H)
len=${#cur}
idx=0
for pval in $( echo ALL; mailq 2>/dev/null | \
sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; /^[0-9A-Z]*[* ]/d; s/!.*$//' ); do
if [[ "$cur" == "${pval:0:$len}" ]]; then
COMPREPLY[$idx]=$pval
idx=$(($idx+1))
fi
done
return 0
;;
esac
if [[ $cur == -* ]]; then
COMPREPLY=( $( compgen -W '-c -d -h -H -p -r -s -v' -- $cur ) )
return 0 return 0
fi fi
case $prev in
-[dr])
len=${#cur}
idx=0
for pval in $( echo ALL; mailq | \
sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* !].*$//' ); do
if [[ "$cur" == "${pval:0:$len}" ]]; then
COMPREPLY[$idx]=$pval
idx=$(($idx+1))
fi
done
return 0
;;
-h)
len=${#cur}
idx=0
for pval in $( echo ALL; mailq | \
sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* ].*$//; /!$/d' ); do
if [[ "$cur" == "${pval:0:$len}" ]]; then
COMPREPLY[$idx]=$pval
idx=$(($idx+1))
fi
done
return 0
;;
-H)
len=${#cur}
idx=0
for pval in $( echo ALL; mailq | \
sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; /^[0-9A-Z]*[* ]/d; s/!.*$//' ); do
if [[ "$cur" == "${pval:0:$len}" ]]; then
COMPREPLY[$idx]=$pval
idx=$(($idx+1))
fi
done
return 0
;;
esac
COMPREPLY=( $( compgen -W 'hold incoming active deferred' -- $cur ) ) COMPREPLY=( $( compgen -W 'hold incoming active deferred' -- $cur ) )
return 0
} }
complete -F _postsuper postsuper complete -F _postsuper $filenames postsuper
} }

View File

@ -24,27 +24,40 @@ _pg_users()
# #
_createdb() _createdb()
{ {
local cur prev 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
case "$prev" in case "$prev" in
-@(h|-host=)) -h|--host)
_known_hosts _known_hosts
return 0 return 0
;; ;;
-@(U|-username=)) -U|--username|-O|--owner)
_pg_users _pg_users
return 0 return 0
;; ;;
-p|--port|-D|--tablespace|-E|--encoding|-T|--template)
# argument required but no completions available
return 0
;;
--help|--version)
# all other arguments are noop with these
return 0
;;
esac esac
$split && return 0
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-D -T -E -h -p -U -W -e -q \ COMPREPLY=( $( compgen -W '-D -T -E -h -p -U -W -e -q \
--location= --template= --encoding= --host= --port= \ --tablespace --template --encoding --host --port \
--username= --password --echo --quiet --help' -- $cur )) --username --password --echo --quiet --help --version' \
-- $cur ))
else else
_pg_databases _pg_databases
fi fi
@ -55,27 +68,35 @@ complete -F _createdb $default createdb
# #
_dropdb() _dropdb()
{ {
local cur prev 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
case "$prev" in case "$prev" in
-@(h|-host=)) -h|--host)
_known_hosts _known_hosts
return 0 return 0
;; ;;
-@(U|-username=)) -U|--username)
_pg_users _pg_users
return 0 return 0
;; ;;
--help|--version)
# all other arguments are noop with these
return 0
;;
esac esac
$split && return 0
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-h -p -U -W -e -q \ COMPREPLY=( $( compgen -W '-h -p -U -W -i -e -q \
--host= --port= --username= --password \ --host --port --username --password --interactive \
--interactive --echo --quiet --help' -- $cur ) ) --echo --quiet --help --version' -- $cur ) )
else else
_pg_databases _pg_databases
fi fi
@ -86,46 +107,60 @@ complete -F _dropdb $default dropdb
# #
_psql() _psql()
{ {
local cur prev 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
case "$prev" in case "$prev" in
-h|--host) -h|--host)
_known_hosts _known_hosts
return 0 return 0
;; ;;
-U|--username) -U|--username)
_pg_users _pg_users
return 0 return 0
;; ;;
-d|--dbname) -d|--dbname)
_pg_databases _pg_databases
return 0 return 0
;; ;;
-@(o|f)|--output|--file) -o|--output|-f|--file|-L|--log-file)
_filedir _filedir
return 0 return 0
;; ;;
-c|--command|-F|--field-separator|-p|--port|-P|--pset|\
-R|--record-separator|-T|--table-attr|-v|--set|--variable)
# argument required but no completions available
return 0
;;
-\?|--help|-V|--version)
# all other arguments are noop with these
return 0
;;
esac esac
$split && return 0
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
# return list of available options # return list of available options
COMPREPLY=( $( compgen -W '-a --echo-all -A --no-align \ COMPREPLY=( $( compgen -W '-a --echo-all -A --no-align \
-c --command -d --dbname -e --echo-queries \ -c --command -d --dbname -e --echo-queries \
-E --echo-hidden -f --file -F --filed-separator \ -E --echo-hidden -f --file -F --field-separator \
-h --host -H --html -l --list -n -o --output \ -h --host -H --html -l --list -L --log-file -n \
-p --port -P --pset -q -R --record-separator \ -o --output -p --port -P --pset -q --quiet \
-s --single-step -S --single-line -t --tuples-only \ -R --record-separator -s --single-step \
-T --table-attr -U --username -v --variable \ -S --single-line -t --tuples-only -T --table-attr \
-V --version -W --password -x --expanded -X --nopsqlrc \ -U --username -v --set --variable -V --version \
-? --help ' -- $cur ) ) -W --password -x --expanded -X --no-psqlrc \
-1 --single-transaction -? --help' -- $cur ) )
else else
# return list of available databases # return list of available databases
_pg_databases _pg_databases
fi fi
} }
complete -F _psql $default psql complete -F _psql $filenames psql
} }

View File

@ -35,32 +35,25 @@ _filesystems()
_quota() _quota()
{ {
local cur prev 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
case $prev in case $prev in
-F) -F|--format)
_quota_formats _quota_formats
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == *=* ]]; then $split && return 0
prev=${cur/=*/}
cur=${cur/*=/}
case $prev in
--format)
_quota_formats
return 0
;;
esac
fi
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-F --format= -g --group -u --user -v --verbose \ COMPREPLY=( $( compgen -W '-F --format -g --group -u --user -v --verbose \
-s --human-readable -p --raw-grace -i --no-autofs -l --local-only \ -s --human-readable -p --raw-grace -i --no-autofs -l --local-only \
-A --all-nfs -m --no-mixed-pathnames -q --quiet -Q --quiet-refuse \ -A --all-nfs -m --no-mixed-pathnames -q --quiet -Q --quiet-refuse \
-w --no-wrap' -- $cur ) ) -w --no-wrap' -- $cur ) )
@ -72,33 +65,26 @@ complete -F _quota $default quota
_setquota() _setquota()
{ {
local cur prev 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
case $prev in case $prev in
-F) -F|--format)
_quota_formats _quota_formats
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == *=* ]]; then $split && return 0
prev=${cur/=*/}
cur=${cur/*=/}
case $prev in
--format)
_quota_formats
return 0
;;
esac
fi
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-r --remote -m --no-mixed-pathnames \ COMPREPLY=( $( compgen -W '-r --remote -m --no-mixed-pathnames \
-F --format= -g --group -u --user -p --prototype= -b --batch \ -F --format -g --group -u --user -p --prototype -b --batch \
-c --continue-batch -t --edit-period -T --edit-times -a --all' -- $cur ) ) -c --continue-batch -t --edit-period -T --edit-times -a --all' -- $cur ) )
else else
_count_args _count_args
@ -118,14 +104,16 @@ complete -F _setquota $default setquota
_edquota() _edquota()
{ {
local cur prev 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
case $prev in case $prev in
-F) -F|--format)
_quota_formats _quota_formats
return 0 return 0
;; ;;
@ -135,20 +123,11 @@ _edquota()
;; ;;
esac esac
if [[ "$cur" == *=* ]]; then $split && return 0
prev=${cur/=*/}
cur=${cur/*=/}
case $prev in
--format)
_quota_formats
return 0
;;
esac
fi
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-r --remote -m --no-mixed-pathnames \ COMPREPLY=( $( compgen -W '-r --remote -m --no-mixed-pathnames \
-g --group -u --user -p --prototype= -F --format= -f --filesystem \ -g --group -u --user -p --prototype -F --format -f --filesystem \
-t --edit-period -T --edit-times' -- $cur ) ) -t --edit-period -T --edit-times' -- $cur ) )
else else
_user_or_group _user_or_group
@ -158,35 +137,28 @@ complete -F _edquota $default edquota
_quotacheck() _quotacheck()
{ {
local cur prev 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
case $prev in case $prev in
-F) -F|--format)
_quota_formats _quota_formats
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == *=* ]]; then $split && return 0
prev=${cur/=*/}
cur=${cur/*=/}
case $prev in
--format)
_quota_formats
return 0
;;
esac
fi
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-b --backup -v --verbose -d --debug \ COMPREPLY=( $( compgen -W '-b --backup -v --verbose -d --debug \
-g --group -u --user -c --create-files -f --force -i \ -g --group -u --user -c --create-files -f --force -i \
--interactive -n --use-first-dquot -M --try-remount -m \ --interactive -n --use-first-dquot -M --try-remount -m \
--no-remount -R --exclude-root -F --format= -a --all' \ --no-remount -R --exclude-root -F --format -a --all' \
-- $cur ) ) -- $cur ) )
else else
_filesystems _filesystems
@ -196,35 +168,28 @@ complete -F _quotacheck $default quotacheck
_repquota() _repquota()
{ {
local cur prev 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
case $prev in case $prev in
-F) -F|--format)
_quota_formats _quota_formats
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == *=* ]]; then $split && return 0
prev=${cur/=*/}
cur=${cur/*=/}
case $prev in
--format)
_quota_formats
return 0
;;
esac
fi
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-a --all -v --verbose -s --human-readable \ COMPREPLY=( $( compgen -W '-a --all -v --verbose -s --human-readable \
-c --batch-translation -C --no-batch-translation -t \ -c --batch-translation -C --no-batch-translation -t \
--truncate-names -n --no-names -p --raw-grace -i --no-autofs \ --truncate-names -n --no-names -p --raw-grace -i --no-autofs \
-u --user -g --group -F --format=' -- $cur ) ) -u --user -g --group -F --format' -- $cur ) )
else else
_filesystems _filesystems
fi fi
@ -233,34 +198,26 @@ complete -F _repquota $default repquota
_quotaon() _quotaon()
{ {
local cur prev 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]}
echo --$cmd-- _split_longopt && split=true
case $prev in case $prev in
-F) -F|--format)
_quota_formats _quota_formats
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == *=* ]]; then $split && return 0
prev=${cur/=*/}
cur=${cur/*=/}
case $prev in
--format)
_quota_formats
return 0
;;
esac
fi
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-a --all -v --verbose -u --user \ COMPREPLY=( $( compgen -W '-a --all -v --verbose -u --user \
-g --group -f --off -p --print-state -F --format=' -- $cur ) ) -g --group -f --off -p --print-state -F --format' -- $cur ) )
else else
_filesystems _filesystems
fi fi
@ -269,14 +226,16 @@ complete -F _quotaon $default quotaon
_quotaoff() _quotaoff()
{ {
local cur prev 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
case $prev in case $prev in
-F) -F|--format)
_quota_formats _quota_formats
return 0 return 0
;; ;;
@ -286,20 +245,11 @@ _quotaoff()
;; ;;
esac esac
if [[ "$cur" == *=* ]]; then $split && return 0
prev=${cur/=*/}
cur=${cur/*=/}
case $prev in
--format)
_quota_formats
return 0
;;
esac
fi
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-a --all -v --verbose -u --user \ COMPREPLY=( $( compgen -W '-a --all -v --verbose -u --user \
-g --group -p --print-state -x --xfs-command -F --format=' \ -g --group -p --print-state -x --xfs-command -F --format' \
-- $cur ) ) -- $cur ) )
else else
_filesystems _filesystems

120
contrib/reportbug Normal file
View File

@ -0,0 +1,120 @@
# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
# ex: ts=8 sw=8 noet filetype=sh
#
# bash completion for (Debian) reportbug package
have reportbug &&
_reportbug()
{
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in
-f|--filename|-i|--include|--mta|-o|--output)
_filedir
return 0
;;
-B|--bts)
COMPREPLY=( $( compgen -W "debian guug kde mandrake help" -- \
$cur ))
return 0
;;
-e|--editor|--mua)
COMP_WORDS=(COMP_WORDS[0] $cur)
COMP_CWORD=1
_command
return 0
;;
--mode)
COMPREPLY=( $( compgen -W "novice standard expert" -- $cur ) )
return 0
;;
-S|--severity)
COMPREPLY=( $( compgen -W "grave serious important normal \
minor wishlist" -- $cur ) )
return 0
;;
-u|--ui|--interface)
COMPREPLY=( $( compgen -W "newt text gnome" -- $cur ) )
return 0
;;
-t|--type)
COMPREPLY=( $( compgen -W "gnats debbugs" -- $cur ) )
return 0
;;
-T|--tags)
COMPREPLY=( $( compgen -W "none \
woody potato sarge sarge-ignore etch etch-ignore \
lenny lenny-ignore sid experimental confirmed \
d-i fixed fixed-in-experimental fixed-upstream \
help l10n moreinfo patch pending security \
unreproducible upstream wontfix ipv6 lfs" -- $cur ))
return 0
;;
*)
;;
esac
COMPREPLY=($( compgen -W '-h --help -v --version -a --af -b \
--no-query-bts --query-bts -B --bts -c --configure \
--no-config-files --check-available -d --debug \
--no-check-available -e --editor --email -f \
--filename -g --gnupg -H --header -i --include -j \
--justification -l --ldap --no-ldap -L --list-cc -m \
--maintonly --mode --mua --mta --mutt -n --mh --nmh \
-o --output -p --print -P --pgp --proxy --http_proxy\
-q --quiet -Q --query-only --realname --report-quiet \
--reply-to --replyto -s --subject -S --severity \
--smtphost -t --type -T --tags --template -V -x \
--no-cc --package-version -z --no-compress \
--ui --interface -u \
wnpp boot-floppies kernel bugs.debian.org \
cdimage.debian.org general installation-reports \
listarchives lists.debian.org mirrors nm.debian.org \
press project qa.debian.org release-notes \
security.debian.org tech-ctte upgrade-reports \
www.debian.org' -- $cur ) \
$( apt-cache pkgnames -- $cur 2> /dev/null) )
_filedir
return 0
} &&
complete -F _reportbug $filenames reportbug
have querybts &&
_querybts()
{
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in
-B|--bts)
COMPREPLY=( $( compgen -W "debian guug kde mandrake help" -- \
$cur ))
return 0
;;
-u|--ui|--interface)
COMPREPLY=($( compgen -W "newt text gnome" -- $cur ))
return 0
;;
*)
;;
esac
COMPREPLY=($( compgen -W '-h --help -v --version -A --archive \
-B --bts -l --ldap --no-ldap --proxy= --http_proxy= \
-s --source -w --web -u --ui --interface \
wnpp boot-floppies kernel bugs.debian.org \
cdimage.debian.org general installation-reports \
listarchives lists.debian.org mirrors nm.debian.org \
press project qa.debian.org release-notes \
security.debian.org tech-ctte upgrade-reports \
www.debian.org' -- $cur ) \
$( apt-cache pkgnames -- $cur 2> /dev/null) )
} &&
complete -F _querybts $filenames querybts

View File

@ -12,25 +12,34 @@ _samba_resolve_order()
_samba_domains() _samba_domains()
{ {
if [ -n "${COMP_SAMBA_SCAN:-}" ]; then if [ -n "${COMP_SAMBA_SCAN:-}" ]; then
COMPREPLY=( $( smbtree -D | grep "^$cur" ) ) COMPREPLY=( $( compgen -W '$( smbtree -N -D )' -- $cur ) )
fi fi
} }
_samba_hosts() _samba_hosts()
{ {
if [ -n "${COMP_SAMBA_SCAN:-}" ]; then if [ -n "${COMP_SAMBA_SCAN:-}" ]; then
COMPREPLY=( $( smbtree -S | grep "^$cur" ) ) COMPREPLY=( $( compgen -W "$( smbtree -N -S | \
sed -ne 's/^[[:space:]]*\\\\*\([^[:space:]]*\).*/\1/p' \
)" -- $cur ) )
fi fi
} }
_samba_debuglevel()
{
COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9 10' -- $cur ) )
}
_smbclient() _smbclient()
{ {
local cur prev 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
case $prev in case $prev in
-R) -R)
_samba_resolve_order _samba_resolve_order
@ -41,11 +50,11 @@ _smbclient()
HEX CAP' -- $cur ) ) HEX CAP' -- $cur ) )
return 0; return 0;
;; ;;
-@(s|A)) -s|-A|--authentication-file)
_filedir _filedir
return 0; return 0;
;; ;;
-l) -l|--log-basename|-D)
_filedir -d _filedir -d
return 0; return 0;
;; ;;
@ -61,59 +70,61 @@ _smbclient()
$cur ) ) $cur ) )
return 0; return 0;
;; ;;
-W) -W|--workgroup)
_samba_domains _samba_domains
return 0; return 0;
;; ;;
-d|--debuglevel)
_samba_debuglevel
return 0
;;
-p|--port|-M|-I|-b|-U|--user|-n|-i|-T|-c)
# argument required but no completions available
return 0
;;
-\?|--help|-V|--version)
# all other arguments are noop with these
return 0
;;
esac esac
# --name=value style option $split && return 0
if [[ "$cur" == *=* ]]; then
prev=${cur/=*/}
cur=${cur/*=/}
case $prev in
--logfile)
_filedir -d
return 0;
;;
--authentication-file)
_filedir
return 0;
;;
--workgroup)
_samba_domains
return 0;
;;
esac
fi
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-b -d -L -U -I -M -m -A -N -i -O \ COMPREPLY=( $( compgen -W '-b -d -L -U -I -M -m -A -N -i -O \
-p -R -s -k -P -c -D -W -l -E --debuglevel= --logfile= \ -p -R -s -k -P -c -D -W -l -E --debuglevel \
--workgroup=' -- $cur ) ) --log-basename --workgroup' -- $cur ) )
fi fi
} }
complete -F _smbclient smbclient complete -F _smbclient smbclient
_smbget() _smbget()
{ {
local cur prev 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
case $prev in case $prev in
-@(o|f|-outputfile|-rcfile)) -@(o|f|-outputfile|-rcfile))
_filedir _filedir
return 0; return 0;
;; ;;
-d|--debuglevel)
_samba_debuglevel
return 0
;;
esac esac
$split && return 0
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-a --guest -r --resume -R \ COMPREPLY=( $( compgen -W '-a --guest -r --resume -R \
--recursive -u --username= -p --password= -w \ --recursive -u --username -p --password -w \
--workgroup= -n --nonprompt -d --debuglevel= -D --dots \ --workgroup -n --nonprompt -d --debuglevel -D --dots \
-P --keep-permissions -o --outputfile -f --rcfile -q \ -P --keep-permissions -o --outputfile -f --rcfile -q \
--quiet -v --verbose -b --blocksize -? --help --usage' \ --quiet -v --verbose -b --blocksize -? --help --usage' \
-- $cur ) ) -- $cur ) )
@ -123,38 +134,34 @@ complete -F _smbget smbget
_smbcacls() _smbcacls()
{ {
local cur prev 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
case $prev in case $prev in
-s) -s)
_filedir _filedir
return 0; return 0;
;; ;;
-l) -l|--log-basename)
_filedir -d _filedir -d
return 0; return 0;
;; ;;
-d|--debuglevel)
_samba_debuglevel
return 0
;;
esac esac
# --name=value style option $split && return 0
if [[ "$cur" == *=* ]]; then
prev=${cur/=*/}
cur=${cur/*=/}
case $prev in
--logfile)
_filedir -d
return 0;
;;
esac
fi
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-a -M -D -S -U -C -G --numeric -t \ COMPREPLY=( $( compgen -W '-a -M -D -S -U -C -G --numeric -t \
-h --help -V -s -d --debuglevel= -l --logfile=' -- \ -h --help -V -s -d --debuglevel -l --log-basename' -- \
$cur ) ) $cur ) )
fi fi
} }
@ -162,43 +169,35 @@ complete -F _smbcacls smbcacls
_smbcquotas() _smbcquotas()
{ {
local cur prev 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
case $prev in case $prev in
-@(s|A)) -s|-A|--authentication-file)
_filedir _filedir
return 0; return 0;
;; ;;
-l) -l|--log-basename)
_filedir -d _filedir -d
return 0; return 0;
;; ;;
-d|--debuglevel)
_samba_debuglevel
return 0
;;
esac esac
# --name=value style option $split && return 0
if [[ "$cur" == *=* ]]; then
prev=${cur/=*/}
cur=${cur/*=/}
case $prev in
--logfile)
_filedir -d
return 0;
;;
--authentication-file)
_filedir
return 0;
;;
esac
fi
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-u -L -F -S -n -t -v -h --help -V \ COMPREPLY=( $( compgen -W '-u -L -F -S -n -t -v -h --help -V \
-s -d --debuglevel= -l --logfile= -N -k -A \ -s -d --debuglevel -l --log-basename -N -k -A \
--authentication-file= -U --user=' -- $cur ) ) --authentication-file -U --user' -- $cur ) )
fi fi
} }
complete -F _smbcquotas smbcquotas complete -F _smbcquotas smbcquotas
@ -224,6 +223,10 @@ _smbpasswd()
_filedir _filedir
return 0; return 0;
;; ;;
-D)
_samba_debuglevel
return 0
;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
@ -250,6 +253,10 @@ _smbtar()
_samba_hosts _samba_hosts
return 0; return 0;
;; ;;
-l)
_samba_debuglevel
return 0
;;
esac esac
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
@ -261,42 +268,34 @@ complete -F _smbtar smbtar
_smbtree() _smbtree()
{ {
local cur prev 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
case $prev in case $prev in
-@(s|A)) -s|-A|--authentication-file)
_filedir _filedir
return 0; return 0;
;; ;;
-l) -l|--log-basename)
_filedir -d _filedir -d
return 0; return 0;
;; ;;
-d|--debuglevel)
_samba_debuglevel
return 0
;;
esac esac
# --name=value style option $split && return 0
if [[ "$cur" == *=* ]]; then
prev=${cur/=*/}
cur=${cur/*=/}
case $prev in
--logfile)
_filedir -d
return 0;
;;
--authentication-file)
_filedir
return 0;
;;
esac
fi
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-b -D -S -V -s -d --debuglevel= -l \ COMPREPLY=( $( compgen -W '-b -D -S -V -s -d --debuglevel -l \
--logfile= -N -k -A --authentication-file= -U --user= \ --log-basename -N -k -A --authentication-file -U --user\
-h --help' -- $cur ) ) -h --help' -- $cur ) )
fi fi
} }

View File

@ -23,7 +23,7 @@ _yum_repolist()
{ {
# -d 0 causes repolist to output nothing as of yum 3.2.22: # -d 0 causes repolist to output nothing as of yum 3.2.22:
# http://yum.baseurl.org/ticket/83 # http://yum.baseurl.org/ticket/83
# Drop first ("repo id repo name") axnd last ("repolist: ...") rows # Drop first ("repo id repo name") and last ("repolist: ...") rows
yum --noplugins -C repolist $1 2>/dev/null | \ yum --noplugins -C repolist $1 2>/dev/null | \
sed -ne '/^repo\(\s\+id\|list:\)/d' -e 's/[[:space:]].*//p' sed -ne '/^repo\(\s\+id\|list:\)/d' -e 's/[[:space:]].*//p'
} }