… means I don’t have to remember all of the available Griffon commands. My primary development platform is a Mac, so I used MacPorts to install the bash-completion package long ago.
This script is based entirely on the excellent maven completion script documented here on willcodeforbeer. It does the same job for Griffon and includes commands for the plugins I’m using.
[bash smarttabs=”true” language=”language=”]
# Griffon completion for the bash shell
#
_griffon()
{
local cmds cur colonprefixes
cmds="bootstrap clean compile console create-app \
create-fest-test create-integration-test create-mvc \
create-plugin create-script create-unit-test \
create-fest-test run-fest -cobertura help init \
install-plugin list-plugins package package-plugin \
plugin-info release-plugin run-app run-applet run-fest \
run-webstart set-proxy set-version shell stats test-app \
test-app-cobertura uninstall-plugin upgrade"
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
# Work-around bash_completion issue where bash interprets a colon
# as a separator.
# Work-around borrowed from the darcs work-around for the same
# issue.
colonprefixes=${cur%"${cur##*:}"}
COMPREPLY=( $(compgen -W ‘$cmds’ — $cur))
local i=${#COMPREPLY[*]}
while [ $((–i)) -ge 0 ]; do
COMPREPLY[$i]=${COMPREPLY[$i]#"$colonprefixes"}
done
return 0
} &&
complete -F _griffon griffon
[/bash]
Add this to your .bash_profile file and you’re good to go for saving a whole bunch of keystrokes and calls to ‘griffon help’.