Use _split_longopt in mii-diag and mii-tool.
This commit is contained in:
parent
f5991cc3c1
commit
9a63f2983d
3
CHANGES
3
CHANGES
@ -37,7 +37,8 @@ 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, 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 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
|
||||||
|
@ -6,51 +6,33 @@
|
|||||||
have mii-tool &&
|
have mii-tool &&
|
||||||
_mii_tool()
|
_mii_tool()
|
||||||
{
|
{
|
||||||
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
|
||||||
-F)
|
-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)
|
-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
|
||||||
# --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
|
|
||||||
|
|
||||||
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
|
||||||
@ -60,13 +42,14 @@ complete -F _mii_tool $default mii-tool
|
|||||||
have mii-diag &&
|
have mii-diag &&
|
||||||
_mii_diag()
|
_mii_diag()
|
||||||
{
|
{
|
||||||
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
|
||||||
-@(F|A|-advertise|-fixed-speed))
|
-@(F|A|-advertise|-fixed-speed))
|
||||||
COMPREPLY=( $( compgen -W '100baseT4 100baseTx \
|
COMPREPLY=( $( compgen -W '100baseT4 100baseTx \
|
||||||
@ -76,6 +59,8 @@ _mii_diag()
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
$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 \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user