chezmoi init
This commit is contained in:
commit
530d6d7195
1176 changed files with 111325 additions and 0 deletions
16
dot_oh-my-zsh/plugins/grails/README.md
Normal file
16
dot_oh-my-zsh/plugins/grails/README.md
Normal file
|
@ -0,0 +1,16 @@
|
|||
# Grails plugin
|
||||
|
||||
This plugin adds completion for the [Grails 2 CLI](https://grails.github.io/grails2-doc/2.5.x/guide/commandLine.html)
|
||||
|
||||
To use it, add `grails` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... grails)
|
||||
```
|
||||
|
||||
It looks for scripts in the following paths:
|
||||
|
||||
- `$GRAILS_HOME/scripts`
|
||||
- `~/.grails/scripts`
|
||||
- `./scripts`
|
||||
- `./plugins/*/scripts`
|
60
dot_oh-my-zsh/plugins/grails/grails.plugin.zsh
Normal file
60
dot_oh-my-zsh/plugins/grails/grails.plugin.zsh
Normal file
|
@ -0,0 +1,60 @@
|
|||
_enumerateGrailsScripts() {
|
||||
# Default directories
|
||||
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
|
||||
|
||||
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() {
|
||||
if (( CURRENT == 2 )); then
|
||||
scripts=( $(_enumerateGrailsScripts) )
|
||||
|
||||
if [ ${#scripts} -ne 0 ];
|
||||
then
|
||||
_multi_parts / scripts
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
_files
|
||||
}
|
||||
|
||||
compdef _grails grails
|
Loading…
Add table
Add a link
Reference in a new issue