summaryrefslogtreecommitdiff
path: root/debian/extra
diff options
context:
space:
mode:
authorDavid Paleino <dapal@debian.org>2011-04-06 12:48:18 +0200
committerDavid Paleino <dapal@debian.org>2011-04-06 17:54:41 +0200
commitd0b5ec9da84ca7cf096d491419b968e3ec5ece72 (patch)
tree17282bba2c44932c5f592cb67734506e57e08db8 /debian/extra
parentbde01f8408fcbbd37fe5fd31eef7d2ec8a35c716 (diff)
downloadbash-completion-d0b5ec9da84ca7cf096d491419b968e3ec5ece72.tar.gz
Implement triggers: activate completions when something is installed in $PATH (drawback: paths are hardcoded in debian/triggers)
Diffstat (limited to 'debian/extra')
-rwxr-xr-xdebian/extra/get-completions16
1 files changed, 16 insertions, 0 deletions
diff --git a/debian/extra/get-completions b/debian/extra/get-completions
new file mode 100755
index 00000000..0fe21b4d
--- /dev/null
+++ b/debian/extra/get-completions
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+commands=$(compgen -c)
+
+for c in $commands; do
+ line=$(grep -w -F $c $1)
+ if [ -n "$line" ]; then
+ comp=$(echo $line | cut -d: -f1)
+ val=$(echo -n $line | cut -d: -f2 | tr ' ' '|')
+ fixedval=$(printf "%s|\n" $val)
+
+ if [ -n "$(echo $fixedval | grep "$c|")" ]; then
+ echo $comp
+ fi
+ fi
+done