Skip to content

Commit

Permalink
Fix grails plugin
Browse files Browse the repository at this point in the history
Fix problem with "basename" command error "extra operand" (do not work with array)
  • Loading branch information
lifinsky committed Mar 25, 2013
1 parent 0ab0e67 commit c1c7768
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions plugins/grails/grails.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,23 @@ _enumerateGrailsScripts() {
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
scripts=()
for file in $files
do
# - Strip the path
# - Remove all scripts with a leading '_'
# - PackagePlugin_.groovy -> PackagePlugin
# - PackagePlugin -> Package-Plugin
# - Package-Plugin -> package-plugin
command=$(basename $file \
| sed -E -e 's/^_?([^_]+)_?.groovy/\1/'\
-e 's/([a-z])([A-Z])/\1-\2/g' \
| tr "[:upper:]" "[:lower:]" \
| sort \
| uniq)
scripts+=($command)
done
echo $scripts
}

_grails() {
Expand Down

0 comments on commit c1c7768

Please sign in to comment.