OpenFrameworks ofProject tab completion September 1, 2010
I prefer to do many things in console and am used to tab completion in programs. It felt uncomfortable to type the plugin and project names in ofProject, especially when you have many of them. So I have created a small script that looks into appropriate directories and then autocompletes the names when you press tab.
_ofProject()
{
local cur prev
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="add"
local ADDON_DIRS=$(ls -l /home/alius/Code/openframeworks/addons/ | grep '^d' | awk '{ print $8 }')
local APP_DIRS=$(ls -l /home/alius/Code/openframeworks/apps/myApps/ | grep '^d' | awk '{ print $8 }')
case "${prev}" in
add)
COMPREPLY=( $(compgen -W "${ADDON_DIRS}" -- ${cur}))
return 0
;;
*)
COMPREPLY=( $(compgen -W "${APP_DIRS}" -- ${cur}))
return 0
;;
esac
}
complete -F _ofProject ofProject
What you need is just change the paths and place this script into /etc/bash_completion.d/ as ofProject
