about summary refs log tree commit diff
path: root/Completion/Linux
diff options
context:
space:
mode:
authorPaul Ackersviller <packersv@users.sourceforge.net>2007-11-25 16:55:47 +0000
committerPaul Ackersviller <packersv@users.sourceforge.net>2007-11-25 16:55:47 +0000
commit9e416ace74656be82557ab51c674781debfb6eff (patch)
tree0abf7e3ac088e3b98cf7d0b5d7f547758e88afa8 /Completion/Linux
parent1c74b6bc3b0002158d18e5ed51b54f0588d3fd34 (diff)
downloadzsh-9e416ace74656be82557ab51c674781debfb6eff.tar.gz
zsh-9e416ace74656be82557ab51c674781debfb6eff.tar.xz
zsh-9e416ace74656be82557ab51c674781debfb6eff.zip
Merge new completions 2386[378] onto 4.2 branch.
Diffstat (limited to 'Completion/Linux')
-rw-r--r--Completion/Linux/Command/_lsusb31
1 files changed, 31 insertions, 0 deletions
diff --git a/Completion/Linux/Command/_lsusb b/Completion/Linux/Command/_lsusb
new file mode 100644
index 000000000..37701acd5
--- /dev/null
+++ b/Completion/Linux/Command/_lsusb
@@ -0,0 +1,31 @@
+#compdef lsusb
+
+local context state line usbidsline vendorid pair
+typeset -A opt_args
+
+_arguments \
+  '(-v --verbose)'{-v,--verbose}'[be verbose]' \
+  '-s:bus and/or devnum to show:' \
+  '-d:vendor and product to show:->vendorproduct' \
+  '-D:device to show:_files' \
+  '-t[dump the physical USB device hierarchy as a tree]' \
+  '(-V --version)'{-V,--version}'[print version info and exit]' && return 0
+
+  if [[ ${+_lsusb_vendors} -eq 0 ]]; then
+    typeset -A _lsusb_vendors _lsusb_devices
+  while IFS="" read usbidsline
+  do
+    case "$usbidsline" in
+      ((#b)([0-9a-f]##) ##(*))
+        vendorid="$match[1]"
+        _lsusb_vendors[$vendorid]="$match[2]"
+      ;;
+      (	(#b)([0-9a-f]##) ##(*)))
+        pair="$vendorid:$match[1]"
+        _lsusb_devices[${pair}]="$match[2]"
+      ;;
+    esac
+  done < <(zcat /var/lib/usbutils/usb.ids)
+fi
+
+compadd -k _lsusb_devices