The following commit has been merged in the master branch:
commit 9a63f2983d2269551cf573af72f111fcac267045
Author: Ville Skyttä <[email protected]>
Date:   Wed May 13 00:06:40 2009 +0300

    Use _split_longopt in mii-diag and mii-tool.

diff --git a/CHANGES b/CHANGES
index 2f5fb47..fa0e452 100644
--- a/CHANGES
+++ b/CHANGES
@@ -37,7 +37,8 @@ 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, chgrp, chown, chkconfig,
-    iptables, make, mkinitrd, smartctl, and generic long option completion.
+    iptables, make, mii-diag, mii-tool, mkinitrd, smartctl, and generic long
+    option completion.
   * 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/net-tools b/contrib/net-tools
index d926e08..1c3c20a 100644
--- a/contrib/net-tools
+++ b/contrib/net-tools
@@ -6,51 +6,33 @@
 have mii-tool &&
 _mii_tool()
 {
-       local cur prev
+       local cur prev split=false
 
        COMPREPLY=()
        cur=`_get_cword`
        prev=${COMP_WORDS[COMP_CWORD-1]}
 
-       # --name value style option
+       _split_longopt && split=true
+
        case $prev in
-               -F)
+               -F|--force)
                        COMPREPLY=( $( compgen -W '100baseTx-FD 100baseTx-HD \
                                10baseT-FD 10baseT-HD' -- $cur ) )
                        return 0
                        ;;
-               -A)
+               -A|--advertise)
                        COMPREPLY=( $( compgen -W '100baseT4 100baseTx-FD 
100baseTx-HD \
                                10baseT-FD 10baseT-HD' -- $cur ) )
                        return 0
                        ;;
        esac
 
-
-       # --name=value style option
-       if [[ "$cur" == *=* ]]; then
-               prev=${cur/=*/}
-               cur=${cur/*=/}
-               case "$prev" in
-                       --force)
-                               COMPREPLY=( $( compgen -W '100baseTx-FD \
-                                       100baseTx-HD 10baseT-FD \
-                                       10baseT-HD' -- $cur ) )
-                               return 0
-                               ;;
-                       --advertise)
-                               COMPREPLY=( $( compgen -W '100baseT4 \
-                                       100baseTx-FD 100baseTx-HD 10baseT-FD \
-                                       10baseT-HD' -- $cur ) )
-                               return 0
-                               ;;
-               esac
-       fi
+       $split && return 0
 
        if [[ "$cur" == -* ]]; then
                COMPREPLY=( $( compgen -W '-v --verbose -V --version -R \
                        --reset -r --restart -w  --watch -l --log -A \
-                       --advertise= -F --force=' -- $cur ) )
+                       --advertise -F --force' -- $cur ) )
        else
                _available_interfaces -a
        fi
@@ -60,13 +42,14 @@ complete -F _mii_tool $default mii-tool
 have mii-diag &&
 _mii_diag()
 {
-       local cur prev
+       local cur prev split=false
 
        COMPREPLY=()
        cur=`_get_cword`
        prev=${COMP_WORDS[COMP_CWORD-1]}
 
-       # --name value style option
+       _split_longopt && split=true
+
        case $prev in
                -@(F|A|-advertise|-fixed-speed))
                        COMPREPLY=( $( compgen -W '100baseT4 100baseTx \
@@ -76,6 +59,8 @@ _mii_diag()
                        ;;
        esac
 
+       $split && return 0
+
        if [[ "$cur" == -* ]]; then
                COMPREPLY=( $( compgen -W '-A --advertise -F --fixed-speed -a \
                        --all-interfaces -s --status -D --debug -g \

-- 
bash-completion

_______________________________________________
Bash-completion-commits mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/bash-completion-commits

Reply via email to