Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Oh My Zsh
Commits
c6e8c856
Commit
c6e8c856
authored
Sep 10, 2011
by
Zach Riggle
Browse files
[plugins/grails] Added grails plugin
parent
762b55bb
Changes
1
Hide whitespace changes
Inline
Side-by-side
plugins/grails/grails.plugin.zsh
0 → 100755
View file @
c6e8c856
if
[[
!
-d
$GRAILS_HOME
/scripts
]]
;
then
echo
"
$0
:"
echo
"Please set
\$
GRAILS_HOME to use the 'grails' plugin, and ensure that
\$
GRAILS_HOME/scripts exists"
fi
_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
\
|
grep
-vE
-e
'^_'
\
|
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment