diff options
author | Robby Russell <robby@planetargon.com> | 2011-10-10 05:42:56 -0700 |
---|---|---|
committer | Robby Russell <robby@planetargon.com> | 2011-10-10 05:42:56 -0700 |
commit | cceb387e0bdad96a246f0374f835c37d8f2e5193 (patch) | |
tree | b3700a14c351108cf74b97feb2c69cb6dfe4efdc /plugins | |
parent | 0fe2462af8ba0b1fc080e9eea6bac583db4b3b48 (diff) | |
parent | f9c143b69c30396f79e2cb75d11e70e4b983c1bd (diff) | |
download | zsh-cceb387e0bdad96a246f0374f835c37d8f2e5193.tar.gz zsh-cceb387e0bdad96a246f0374f835c37d8f2e5193.tar.bz2 zsh-cceb387e0bdad96a246f0374f835c37d8f2e5193.zip |
Merge pull request #595 from zachriggle/grails-plugin
Grails plugin
Diffstat (limited to 'plugins')
-rwxr-xr-x | plugins/grails/grails.plugin.zsh | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/plugins/grails/grails.plugin.zsh b/plugins/grails/grails.plugin.zsh new file mode 100755 index 000000000..cc6f9c53b --- /dev/null +++ b/plugins/grails/grails.plugin.zsh @@ -0,0 +1,54 @@ +_enumerateGrailsScripts() { + # Default directoryies + directories=($GRAILS_HOME/scripts ~/.grails/scripts ./scripts) + + # Check all of the plugins directories, if they exist + if [ -d plugins ] + then + directories+=(plugins/*/scripts) + fi + + # Enumerate all of the Groovy files + files=() + for dir in $directories; + do + if [ -d $dir ] + then + files+=($dir/[^_]*.groovy) + fi + done + + # Don't try to basename () + if [ ${#files} -eq 0 ]; + then + return + fi + + # - Strip the path + # - Remove all scripts with a leading '_' + # - PackagePlugin_.groovy -> PackagePlugin + # - PackagePlugin -> Package-Plugin + # - Package-Plugin -> package-plugin + basename $files \ + | sed -E -e 's/^_?([^_]+)_?.groovy/\1/'\ + -e 's/([a-z])([A-Z])/\1-\2/g' \ + | tr "[:upper:]" "[:lower:]" \ + | sort \ + | uniq +} + +_grails() { + if (( CURRENT == 2 )); then + scripts=( $(_enumerateGrailsScripts) ) + + if [ ${#scripts} -ne 0 ]; + then + _multi_parts / scripts + return + fi + fi + + _files +} + +compdef _grails grails |