bb_bash_completions: New utility for bitbake recipe autocompletions
authorSUBHASHINI V <subhashini.venugopalan@gmail.com>
Sun, 4 Oct 2009 08:11:00 +0000 (01:11 -0700)
committerKhem Raj <raj.khem@gmail.com>
Sun, 4 Oct 2009 08:12:41 +0000 (01:12 -0700)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
contrib/bb_bash_completions [new file with mode: 0644]

diff --git a/contrib/bb_bash_completions b/contrib/bb_bash_completions
new file mode 100644 (file)
index 0000000..bee2d96
--- /dev/null
@@ -0,0 +1,22 @@
+# simple bash autocompletions file for the OE recipes. It can be
+# inserted into the default profile.sh, or sourced in the same file.
+
+
+_bitbake() 
+{
+    if [[ $OE_HOME ]]; then
+        local cur prev general exact words
+        COMPREPLY=()
+        cur="${COMP_WORDS[COMP_CWORD]}"
+        prev="${COMP_WORDS[COMP_CWORD-1]}"
+       general=$(ls $OE_HOME/openembedded/recipes)
+       exact=$(find $OE_HOME/openembedded/recipes -name $cur*.bb | xargs -I"@@" basename @@ '.bb')
+       words="$general $exact"
+
+        COMPREPLY=( $(compgen -W "$words" -- ${cur}) )
+        return 0
+    fi
+    return -1
+}
+complete -F _bitbake bitbake
+