mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-05-24 17:06:05 +02:00
Tomasz Pala: users/11599: _ip improvements
This commit is contained in:
parent
5d46210ce5
commit
6b936c3d29
|
@ -1,3 +1,9 @@
|
||||||
|
2007-07-01 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||||
|
|
||||||
|
* Tomasz Pala: users/11599: Completion/Unix/Command/_ip:
|
||||||
|
improvements for VLAN interfaces, deleting addresses,
|
||||||
|
abbreviations.
|
||||||
|
|
||||||
2007-07-01 Clint Adams <clint@zsh.org>
|
2007-07-01 Clint Adams <clint@zsh.org>
|
||||||
|
|
||||||
* 23628: Completion/Unix/Command/_git: merge in from Nikolai
|
* 23628: Completion/Unix/Command/_git: merge in from Nikolai
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
# Values encoding simple types
|
# Values encoding simple types
|
||||||
#
|
#
|
||||||
local -a subcmd_dev
|
local -a subcmd_dev
|
||||||
subcmd_dev=(/$'[[:alpha:]]##[[:digit:]]##\0'/ ':interfaces:network interface:_net_interfaces')
|
subcmd_dev=(/$'[[:alpha:]]##[[:digit:]]##(\.[[:digit:]]##)#\0'/ ':interfaces:network interface:_net_interfaces')
|
||||||
|
|
||||||
local -a subcmd_onoff
|
local -a subcmd_onoff
|
||||||
subcmd_onoff=(/$'(on|off)\0'/ ':onoff:state (on or off):(on off)')
|
subcmd_onoff=(/$'(on|off)\0'/ ':onoff:state (on or off):(on off)')
|
||||||
|
@ -31,6 +31,14 @@ subcmd_ipaddr=(
|
||||||
':ipaddress:IP address (v4 or v6) with optional /<network-prefix-length>:( )'
|
':ipaddress:IP address (v4 or v6) with optional /<network-prefix-length>:( )'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
local -a subcmd_ipaddrs
|
||||||
|
local PATH=$PATH
|
||||||
|
PATH=/sbin:$PATH
|
||||||
|
subcmd_ipaddrs=(
|
||||||
|
/$'(<->(.<->(.<->(.<->|)|)|)|[:[:xdigit]]#:[:[:xdigit:]]#)(|/<->)\0'/
|
||||||
|
":ipaddress:IP address (v4 or v6) currently set:( $(ip addr show | sed -n 's/^ *inet6* \([0-9a-f\.:/]*\) .*$/\1/p') )"
|
||||||
|
)
|
||||||
|
|
||||||
local -a subcmd_scope
|
local -a subcmd_scope
|
||||||
_regex_words scope "IP address scope" \
|
_regex_words scope "IP address scope" \
|
||||||
'global:address globally valid' \
|
'global:address globally valid' \
|
||||||
|
@ -190,7 +198,7 @@ link_cmds=("$reply[@]")
|
||||||
#
|
#
|
||||||
local -a addr_add_cmds
|
local -a addr_add_cmds
|
||||||
# TODO: broadcast can take + or =
|
# TODO: broadcast can take + or =
|
||||||
_regex_words addr-add-commands "addr add/change/replace commands" \
|
_regex_words addr-add-commands "addr add/remove/change/replace commands" \
|
||||||
'dev:specify device:$subcmd_dev' \
|
'dev:specify device:$subcmd_dev' \
|
||||||
'lo*cal:specify local IP address:$subcmd_ipaddr' \
|
'lo*cal:specify local IP address:$subcmd_ipaddr' \
|
||||||
'p*eer:specify peer IP address (point-to-point):$subcmd_ipaddr' \
|
'p*eer:specify peer IP address (point-to-point):$subcmd_ipaddr' \
|
||||||
|
@ -200,6 +208,9 @@ _regex_words addr-add-commands "addr add/change/replace commands" \
|
||||||
# can complete IP address with no keyword
|
# can complete IP address with no keyword
|
||||||
addr_add_cmds=("(" $subcmd_ipaddr "|" ")" "$reply[@]" "#" )
|
addr_add_cmds=("(" $subcmd_ipaddr "|" ")" "$reply[@]" "#" )
|
||||||
|
|
||||||
|
local -a addr_del_cmds
|
||||||
|
addr_del_cmds=("(" $subcmd_ipaddrs "|" "$reply[@]" ")" "#" )
|
||||||
|
|
||||||
local -a addr_show_cmds
|
local -a addr_show_cmds
|
||||||
# TODO: broadcast can take + or =
|
# TODO: broadcast can take + or =
|
||||||
_regex_words addr-show-commands "addr show commands" \
|
_regex_words addr-show-commands "addr show commands" \
|
||||||
|
@ -223,7 +234,7 @@ _regex_words \
|
||||||
'a*dd:add new protocol address:$addr_add_cmds' \
|
'a*dd:add new protocol address:$addr_add_cmds' \
|
||||||
'c*hange:change existing protocol address:$addr_add_cmds' \
|
'c*hange:change existing protocol address:$addr_add_cmds' \
|
||||||
'r*replace:add or update protocol address:$addr_add_cmds' \
|
'r*replace:add or update protocol address:$addr_add_cmds' \
|
||||||
'd*elete:delete protocol address:$addr_add_cmds' \
|
'd*elete:delete protocol address:$addr_del_cmds' \
|
||||||
's*how:show protocol address:$addr_show_cmds' \
|
's*how:show protocol address:$addr_show_cmds' \
|
||||||
'f*lush:flush protocol address:$addr_show_cmds'
|
'f*lush:flush protocol address:$addr_show_cmds'
|
||||||
addr_cmds=("$reply[@]")
|
addr_cmds=("$reply[@]")
|
||||||
|
@ -495,11 +506,11 @@ _regex_words \
|
||||||
commands "ip command" \
|
commands "ip command" \
|
||||||
'l*ink:configure network device:$link_cmds' \
|
'l*ink:configure network device:$link_cmds' \
|
||||||
'a*ddr:manage protocol address:$addr_cmds' \
|
'a*ddr:manage protocol address:$addr_cmds' \
|
||||||
'ro*ute:manage routing table:$route_cmds' \
|
'r*oute:manage routing table:$route_cmds' \
|
||||||
'ru*le:manage routing policy database:$rule_cmds' \
|
'ru*le:manage routing policy database:$rule_cmds' \
|
||||||
'n*eigh:manage neighbour/ARP tables:$neigh_cmds' \
|
'n*eigh:manage neighbour/ARP tables:$neigh_cmds' \
|
||||||
't*unnel:configure tunnel:$tunnel_cmds' \
|
't*unnel:configure tunnel:$tunnel_cmds' \
|
||||||
'ma*ddr:manage multicast addresses:$maddr_cmds' \
|
'm*addr:manage multicast addresses:$maddr_cmds' \
|
||||||
'mr*oute:manage multicast routing cache:$mroute_cmds' \
|
'mr*oute:manage multicast routing cache:$mroute_cmds' \
|
||||||
'mo*nitor:monitor state:$monitor_cmds'
|
'mo*nitor:monitor state:$monitor_cmds'
|
||||||
args+=("$reply[@]")
|
args+=("$reply[@]")
|
||||||
|
|
Loading…
Reference in New Issue