summaryrefslogtreecommitdiffstats
path: root/bridge/etc
diff options
context:
space:
mode:
authortv <tv@iiso>2011-09-27 00:12:32 +0200
committertv <tv@iiso>2011-09-27 00:12:32 +0200
commitf541b6139ca8ecbc64c736179604280e3006bede (patch)
tree58ac7c926a00b0573a0173dd1de91506bcab098a /bridge/etc
parentf56a4735ade90afcc719d9b87e941a665768db70 (diff)
//bridge: initial commit
Diffstat (limited to 'bridge/etc')
-rw-r--r--bridge/etc/bash_completion.d/bridge18
1 files changed, 18 insertions, 0 deletions
diff --git a/bridge/etc/bash_completion.d/bridge b/bridge/etc/bash_completion.d/bridge
new file mode 100644
index 00000000..86d8a4e2
--- /dev/null
+++ b/bridge/etc/bash_completion.d/bridge
@@ -0,0 +1,18 @@
+#! /bin/bash
+function comp_bridge() {
+ local cword="${COMP_WORDS[$COMP_CWORD]}"
+ local bindir="$(dirname $(readlink -f "$BASH_SOURCE"))/../../lib/bridge/bin"
+ case $COMP_CWORD in
+ (1)
+ COMPREPLY=( $(cd "$bindir" && ls | grep "^$cword.*") )
+ ;;
+ (2)
+ case "${COMP_WORDS[1]}" in
+ (attach|destroy|paste)
+ COMPREPLY=( $(bridge list 2>/dev/null | grep "^$cword.*") )
+ ;;
+ esac
+ ;;
+ esac
+}
+complete -F comp_bridge bridge