summary refs log tree commit diff
path: root/Completion/Unix/Command
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2012-09-15 18:25:17 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2012-09-15 18:25:17 +0000
commit0c5526bec0c36e7a82c0a04fce1d19847a332f4e (patch)
tree685dce38fc3eed375435d0bfa1d8d6e72a28e3e0 /Completion/Unix/Command
parentd2f5474fa5cea3f3fb50bedfdf5970edae0cfe27 (diff)
downloadzsh-0c5526bec0c36e7a82c0a04fce1d19847a332f4e.tar.gz
zsh-0c5526bec0c36e7a82c0a04fce1d19847a332f4e.tar.xz
zsh-0c5526bec0c36e7a82c0a04fce1d19847a332f4e.zip
Александр Балезин: 30667: add addrlabl subcommand.
Diffstat (limited to 'Completion/Unix/Command')
-rw-r--r--Completion/Unix/Command/_ip34
1 files changed, 34 insertions, 0 deletions
diff --git a/Completion/Unix/Command/_ip b/Completion/Unix/Command/_ip
index 411af461b..0fc979cd3 100644
--- a/Completion/Unix/Command/_ip
+++ b/Completion/Unix/Command/_ip
@@ -38,6 +38,11 @@ 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') )"
 )
+subcmd_prefix_label=(
+  /$'(<->(.<->(.<->(.<->|)|)|)|[:[:xdigit]]#:[:[:xdigit:]]#)(|/<->)\0'/
+  ":ipaddresslabel:IP addrlabel prefix currently set:( $(ip -6 addrlabel list | sed -n 's/^prefix \([0-9a-f\.:/]*\) .*$/\1/p') )"
+)
+
 
 local -a subcmd_scope
 _regex_words scope "IP address scope" \
@@ -240,6 +245,34 @@ _regex_words \
   'f*lush:flush protocol address:$addr_show_cmds'
 addr_cmds=("$reply[@]")
 
+#
+# addrlabel
+#
+
+local -a addrlabel_add_cmds
+_regex_words addrlabel-add-commands "addlabel add command" \
+  'p*refix: limit to given IP address/prefix' \
+  'd*ev: specify device:$subcmd_dev' \
+  'l*abel: number'
+addrlabel_add_cmds=( "(" $subcmd_ipaddr "|" ")" "$reply[@]" "#")
+
+local -a addrlabel_del_cmds
+_regex_words addrlabel-add-commands "addlabel del command" \
+  'p*refix: limit to given IP address/prefix:$subcmd_prefix_label' \
+  'd*ev: specify device:$subcmd_dev' \
+  'l*abel: number:$subcmd_number'
+addrlabel_del_cmds=( "(" $subcmd_ipaddr "|" ")" "$reply[@]" "#")
+
+
+local -a addrlabel_cmds
+_regex_words \
+  addrlabel-commands "addrlabel command" \
+  'h*elp: show help for command' \
+  'a*dd: add an address labels:$addrlabel_add_cmds' \
+  'd*el: delete an address labels:$addrlabel_del_cmds' \
+  'l*ist: list address labels' \
+  'f*lush: flush adderss labels'
+addrlabel_cmds=("$reply[@]")
 
 #
 # neigh
@@ -506,6 +539,7 @@ args+=("$reply[@]" "#")
 _regex_words \
   commands "ip command" \
   'l*ink:configure network device:$link_cmds' \
+  'addrlabel:manage addrlabel:$addrlabel_cmds' \
   'a*ddr:manage protocol address:$addr_cmds' \
   'r*oute:manage routing table:$route_cmds' \
   'ru*le:manage routing policy database:$rule_cmds' \