[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 935295c28044e330f946adc368f437692b6e78f8

Guillaume Rousse guillomovitch at zarb.org
Tue Feb 10 22:50:56 UTC 2009


The following commit has been merged in the master branch:
commit 935295c28044e330f946adc368f437692b6e78f8
Author: Guillaume Rousse <guillomovitch at zarb.org>
Date:   Tue Feb 10 23:50:04 2009 +0100

    new helper functions:
    - _usb_ids completes on USB ids
    - _pci_ids completes on PCI ids

diff --git a/bash_completion b/bash_completion
index 0a5d75f..346091f 100644
--- a/bash_completion
+++ b/bash_completion
@@ -522,6 +522,22 @@ _count_args()
 	done
 }
 
+# This function complete on PCI IDs
+#
+_pci_ids()
+{
+	COMPREPLY=( ${COMPREPLY[@]:-} \
+		$( compgen -W "$( lspci -n | awk '{print $3}')" -- $cur ) )
+}
+
+# This function complete on USB IDs
+#
+_usb_ids()
+{
+	COMPREPLY=( ${COMPREPLY[@]:-} \
+		$( compgen -W "$( lsusb | awk '{print $6}')" -- $cur ) )
+}
+
 # start of section containing completion functions for bash built-ins
 
 # bash alias completion

-- 
bash-completion



More information about the Bash-completion-commits mailing list