The Kaptain on … stuff

03 Apr, 2009

Griffon bash completion…

Posted by: TheKaptain In: Development

… 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
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"
# 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.
COMPREPLY=( $(compgen -W ‘$cmds’ — $cur))
local i=${#COMPREPLY[*]}
while [ $((–i)) -ge 0 ]; do

return 0
} &&
complete -F _griffon griffon

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’.

Reblog this post [with Zemanta]

2 Responses to "Griffon bash completion…"

1 | Andres Almiray

April 4th, 2009 at 8:27 am


Here is another bash completion script (based on Grails) that will also take into account plugin scripts

2 | TheKaptain

April 4th, 2009 at 8:48 am


Thanks for pointing me to it Andres! That certainly beats the heck out of my brute force attempt. Will be incorporating it immediately. Great work on the book so far by the way. Looking forward to the next chapter!

Comment Form