diff --git a/CHANGES b/CHANGES index 9aea3de2..846a5ebb 100644 --- a/CHANGES +++ b/CHANGES @@ -64,9 +64,9 @@ bash-completion (1.x) * Add _split_longopt() helper for improved handling of long options that take arguments in both "--foo bar" and "--foo=bar" formats. * Use _split_longopt to improve and clean up aspell, bluez-utils, chgrp, - chown, chkconfig, cpio, dpkg, heimdal, iptables, make, mc, mii-diag, - mii-tool, mkinitrd, pkg-config, postgresql, quota, reportbug, samba, - smartctl, yum, and generic long option completion (Alioth: #311398). + chown, chkconfig, cpio, dpkg, heimdal, iptables, mailman, make, mc, + mii-diag, mii-tool, mkinitrd, pkg-config, postgresql, quota, reportbug, + samba, smartctl, yum, and generic long option completion (Alioth: #311398). * Add chown --from and --reference value completions. * Add chgrp --reference value completion. * Do not assume all --foo= options take filenames in generic long option diff --git a/contrib/mailman b/contrib/mailman index c10f46b9..a7999d97 100644 --- a/contrib/mailman +++ b/contrib/mailman @@ -29,27 +29,31 @@ complete -F _list_lists list_lists have add_members && _add_members() { - local cur prev + local cur prev split=false COMPREPLY=() cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} + _split_longopt && split=true + case "$prev" in - -@(r|d|-regular-members-file=|-digest-members-file=)) + -@(r|d|-regular-members-file|-digest-members-file)) _filedir return 0 ;; - -@(w|a|-welcome-msg=|-admin-notify=)) + -@(w|a|-welcome-msg|-admin-notify)) COMPREPLY=( $( compgen -W 'y n' -- $cur) ) return 0 ;; esac + $split && return 0 + if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--regular-members-file= -r \ - --digest-members-file= -d --welcome-msg= -w \ - --admin-notify= -a --help -h' -- $cur ) ) + COMPREPLY=( $( compgen -W '--regular-members-file -r \ + --digest-members-file -d --welcome-msg -w \ + --admin-notify -a --help -h' -- $cur ) ) else _mailman_lists fi @@ -60,22 +64,25 @@ complete -F _add_members add_members have remove_members && _remove_members() { - - local cur prev + local cur prev split=false COMPREPLY=() cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} + _split_longopt && split=true + case "$prev" in - -@(f|-file=)) + -@(f|-file)) _filedir return 0 ;; esac + $split && return 0 + if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--file= -f --all -a \ + COMPREPLY=( $( compgen -W '--file -f --all -a \ --fromall --nouserack -n --noadminack -N \ --help -h' -- $cur ) ) else @@ -88,23 +95,26 @@ complete -F _remove_members remove_members have find_member && _find_member() { - - local cur prev + local cur prev split=false COMPREPLY=() cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} + _split_longopt && split=true + case "$prev" in - -@(l|x|-listname=|-exclude=)) + -@(l|x|-listname|-exclude)) _mailman_lists return 0 ;; esac + $split && return 0 + if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-l --listname= -x \ - --exclude= --owners -w --help -h' -- $cur ) ) + COMPREPLY=( $( compgen -W '-l --listname -x \ + --exclude --owners -w --help -h' -- $cur ) ) fi } && @@ -113,22 +123,25 @@ complete -F _find_member find_member have clone_member && _clone_member() { - - local cur prev + local cur prev split=false COMPREPLY=() cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} + _split_longopt && split=true + case "$prev" in - -@(l|-listname=)) + -@(l|-listname)) _mailman_lists return 0 ;; esac + $split && return 0 + if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-l --listname= --remove -r \ + COMPREPLY=( $( compgen -W '-l --listname --remove -r \ --admin -a --quiet -q --nomodify -n --help -h' -- $cur ) ) fi @@ -138,14 +151,16 @@ complete -F _clone_member clone_member have sync_members && _sync_members() { - local cur prev + local cur prev split=false COMPREPLY=() cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} + _split_longopt && split=true + 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) ) return 0 ;; @@ -155,9 +170,11 @@ _sync_members() ;; esac + $split && return 0 + if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--no-change -n --welcome-msg= -w \ - --goodbye-msg= -g --digest= -d --notifyadmin= -a \ + COMPREPLY=( $( compgen -W '--no-change -n --welcome-msg -w \ + --goodbye-msg -g --digest -d --notifyadmin -a \ -f --file -h --help' -- $cur ) ) else _mailman_lists @@ -192,7 +209,7 @@ _list_admins() cur=`_get_cword` if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--all-vhost= -v \ + COMPREPLY=( $( compgen -W '--all-vhost -v \ --all -a -h --help' -- $cur ) ) else _mailman_lists @@ -222,31 +239,34 @@ complete -F _list_owners list_owners have list_members && _list_members() { - local cur prev + local cur prev split=false COMPREPLY=() cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} + _split_longopt && split=true + case "$prev" in -@(o|-output)) _filedir return 0 ;; - -@(d|-digest=)) + -@(d|-digest)) COMPREPLY=( $( compgen -W 'mime plain' -- $cur) ) return 0 ;; - -@(n|-nomail=)) + -@(n|-nomail)) COMPREPLY=( $( compgen -W 'byadmin byuser bybounce unknown' -- $cur) ) return 0 ;; esac + $split && return 0 if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--output -o --regular -r \ - --digest= -d --nomail= -n --fullnames -f \ + --digest -d --nomail -n --fullnames -f \ --preserve -p -h --help' -- $cur ) ) else _mailman_lists @@ -258,22 +278,26 @@ complete -F _list_members list_members have change_pw && _change_pw() { - local cur prev + local cur prev split=false COMPREPLY=() cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} + _split_longopt && split=true + case "$prev" in - -@(l|-listname=)) + -@(l|-listname)) _mailman_lists return 0 ;; esac + $split && return 0 + if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-a --all --domain= -d --listname= -l \ - --password= -p --quiet -q -h --help' -- $cur ) ) + COMPREPLY=( $( compgen -W '-a --all --domain -d --listname -l \ + --password -p --quiet -q -h --help' -- $cur ) ) fi } && @@ -335,11 +359,13 @@ complete -F _rmlist rmlist have config_list && _config_list() { - local cur prev + local cur prev split=false COMPREPLY=() cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + prev=${COMP_WORDS[COMP_CWORD-1]} + + _split_longopt && split=true case "$prev" in -@(i|o|-inputfile|-outputfile)) @@ -348,6 +374,7 @@ _config_list() ;; esac + $split && return 0 if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--inputfile -i --outputfile -o \ @@ -362,14 +389,16 @@ complete -F _config_list $filenames config_list have arch && _arch() { - local cur prev + local cur prev split=false COMPREPLY=() cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} + _split_longopt && split=true + 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) ) return 0 ;; @@ -379,8 +408,10 @@ _arch() ;; esac + $split && return 0 + if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--wipe -s --start= -e --end= \ + COMPREPLY=( $( compgen -W '--wipe -s --start -e --end \ -q --quiet -h --help' -- $cur ) ) else args=$COMP_CWORD @@ -421,21 +452,25 @@ complete -F _cleanarch cleanarch have inject && _inject() { - local cur prev + local cur prev split=false COMPREPLY=() cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} + _split_longopt && split=true + case "$prev" in - -@(l|-listname=)) + -@(l|-listname)) _mailman_lists return 0 ;; esac + $split && return 0 + if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-l --listname= -q --queue= \ + COMPREPLY=( $( compgen -W '-l --listname -q --queue \ -h --help' -- $cur ) ) else _filedir @@ -527,13 +562,16 @@ complete -F _mmsitepass mmsitepass have qrunner && _qrunner() { - local cur + local cur prev COMPREPLY=() cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + _split_longopt && return 0 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 ) ) fi