about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2005-08-08 08:02:39 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2005-08-08 08:02:39 +0000
commit9d30797e4a2de1b33ae0be417e5c8b368d99ba08 (patch)
tree4a01f5c7a635c0964eba3cc695e52ef1c0f5d219 /Completion
parentb1aa9f874e35194612e53e47d0b0b6261069fb89 (diff)
downloadzsh-9d30797e4a2de1b33ae0be417e5c8b368d99ba08.tar.gz
zsh-9d30797e4a2de1b33ae0be417e5c8b368d99ba08.tar.xz
zsh-9d30797e4a2de1b33ae0be417e5c8b368d99ba08.zip
new brctl completion
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Linux/Command/.distfiles2
-rw-r--r--Completion/Linux/Command/_brctl63
2 files changed, 64 insertions, 1 deletions
diff --git a/Completion/Linux/Command/.distfiles b/Completion/Linux/Command/.distfiles
index bf0907d0a..46621a4e7 100644
--- a/Completion/Linux/Command/.distfiles
+++ b/Completion/Linux/Command/.distfiles
@@ -1,5 +1,5 @@
 DISTFILES_SRC='
 .distfiles
-_acpi _iptables _iwconfig _losetup _mii-tool _modutils _mondo _pkgtool
+_acpi _brctl _iptables _iwconfig _losetup _mii-tool _modutils _mondo _pkgtool
 _tune2fs _uml _valgrind _yast
 '
diff --git a/Completion/Linux/Command/_brctl b/Completion/Linux/Command/_brctl
new file mode 100644
index 000000000..877326821
--- /dev/null
+++ b/Completion/Linux/Command/_brctl
@@ -0,0 +1,63 @@
+#compdef brctl
+
+local curcontext="$curcontext" expl ret=1
+local subcmd
+
+if (( CURRENT == 2 )); then
+  _describe 'brctl command' '(
+    addbr:create\ instance\ of\ ethernet\ bridge
+    delbr:deletes\ specified\ bridge\ instance
+    show:show\ all\ current\ bridge\ instances
+    addif:add\ interface\ to\ bridge
+    delif:remove\ interface\ from\ bridge
+    showmacs:show\ a\ list\ of\ learned\ MAC\ addresses
+    setageing:set\ MAC\ address\ ageing\ time
+    setgcint:set\ grabage\ collection\ interval
+    stp:control\ use\ of\ spanning\ tree\ protocol
+    setbridgeprio:set\ bridge\ priority
+    setfd:set\ bridge\ forward\ delay
+    sethello:set\ bridge\ hello\ time
+    setmaxage:set\ maximum\ message\ age
+    setpathcost:set\ cost\ of\ port
+    setportprio:set\ priority\ of\ port
+  )' && ret=0
+else
+  shift words
+  (( CURRENT-- ))
+  subcmd="$words[1]"
+  curcontext="${curcontext%:*}-${subcmd}:"
+  
+  if (( CURRENT == 2 )); then
+    _wanted bridges expl 'bridge' compadd \
+    	${${(f)"$(brctl show 2>/dev/null)"}[2,-1]%%	*} && ret=0
+  elif (( CURRENT == 3 )); then
+    case $subcmd in
+      addif|delif)
+      	_net_interfaces && ret=0
+      ;;
+      setageing|setgcint|setfd|sethello|setmaxage)
+      	_message -e time 'time (seconds)'
+      ;;
+      setbridgeprio)
+      	_message -e priority 'priority'
+      ;;
+      setpathcost|setportprio)
+        _message -e ports 'port'
+      ;;
+      stp)
+        _wanted states expl 'state' compadd on off && ret=0
+      ;;
+      *)
+        _message 'unknown subcommand: $subcmd'
+      ;;
+    esac
+  elif (( CURRENT == 4 )); then
+    if [[ $subcmd == setpathcost ]]; then
+      _message -e cost 'cost'
+    elif [[ $subcmd == setportprio ]]; then
+      _message -e priority 'priority'
+    fi
+  fi
+fi
+
+return ret