diff options
author | James Smith <james@loopj.com> | 2012-07-24 13:39:07 -0700 |
---|---|---|
committer | James Smith <james@loopj.com> | 2012-07-24 13:39:07 -0700 |
commit | 772bc51c3a2372592c400e0d4e159a0128989ba2 (patch) | |
tree | 191af002e272ce95418910b9c0ea63443e48e681 /plugins/grails | |
parent | 0ba398f9e1aaf05e72406d5c840f013eebb6b260 (diff) | |
parent | d05b2010ffd4cd33ff9402c402051b1caf985d97 (diff) | |
download | zsh-772bc51c3a2372592c400e0d4e159a0128989ba2.tar.gz zsh-772bc51c3a2372592c400e0d4e159a0128989ba2.tar.bz2 zsh-772bc51c3a2372592c400e0d4e159a0128989ba2.zip |
Merge
Diffstat (limited to 'plugins/grails')
-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 |