author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Wed, 16 Oct 2013 19:48:29 +0300 | |
changeset 644 | 5a6d6ad8e7f4 |
parent 643 | 9f5ece28cd08 |
child 645 | 51f6d81be3da |
permissions | -rw-r--r-- |
643 | 1 |
# -*- mode: sh; sh-shell-file: bash -*- |
2 |
||
3 |
_gradle() |
|
4 |
{ |
|
644
5a6d6ad8e7f4
Add cli option handling for gradle bash-completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
643
diff
changeset
|
5 |
local _opts="-? -h --help -A --dep-tasks -C --cache -D --system-prop -I --init-script -P --project-prop -S --full-stacktrace -a --no-rebuild --all \ |
5a6d6ad8e7f4
Add cli option handling for gradle bash-completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
643
diff
changeset
|
6 |
-b --build-file -c --settings-file -d --debug -e --embedded -g --gradle-user-home --gui -i --info -m --dry-run -n --dependencies --no-opt -p --project-dir \ |
5a6d6ad8e7f4
Add cli option handling for gradle bash-completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
643
diff
changeset
|
7 |
-q --quiet -r --properties -s --stacktrace -t --tasks -u --no-search-upward -v --version -x --exclude-task" |
643 | 8 |
local _help_cmds='dependencies dependencyInsight help projects properties tasks' |
9 |
local _java_cmds='assemble build buildDependents buildNeeded classes compileJava processResources clean cleanTest jar testClasses compileTestJava processTestResources javadoc check test uploadArchives' |
|
644
5a6d6ad8e7f4
Add cli option handling for gradle bash-completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
643
diff
changeset
|
10 |
local _application_cmds='run startScripts installApp distZip distTar' |
5a6d6ad8e7f4
Add cli option handling for gradle bash-completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
643
diff
changeset
|
11 |
local cur prev |
643 | 12 |
cur=${COMP_WORDS[COMP_CWORD]} |
644
5a6d6ad8e7f4
Add cli option handling for gradle bash-completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
643
diff
changeset
|
13 |
[[ $COMP_CWORD != 0 ]] && prev=${COMP_WORDS[COMP_CWORD-1]} |
5a6d6ad8e7f4
Add cli option handling for gradle bash-completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
643
diff
changeset
|
14 |
case "$prev" in |
5a6d6ad8e7f4
Add cli option handling for gradle bash-completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
643
diff
changeset
|
15 |
-I|--init-script|-b|--build-file|-c|--settings-file|-e|--embedded) |
5a6d6ad8e7f4
Add cli option handling for gradle bash-completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
643
diff
changeset
|
16 |
COMPREPLY=( $(compgen -f -- "$cur") ) |
5a6d6ad8e7f4
Add cli option handling for gradle bash-completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
643
diff
changeset
|
17 |
return ;; |
5a6d6ad8e7f4
Add cli option handling for gradle bash-completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
643
diff
changeset
|
18 |
-g|--gradle-user-home|-p|--project-dir) |
5a6d6ad8e7f4
Add cli option handling for gradle bash-completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
643
diff
changeset
|
19 |
COMPREPLY=( $(compgen -d -- "$cur") ) |
5a6d6ad8e7f4
Add cli option handling for gradle bash-completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
643
diff
changeset
|
20 |
return ;; |
5a6d6ad8e7f4
Add cli option handling for gradle bash-completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
643
diff
changeset
|
21 |
esac |
643 | 22 |
# colonprefixes=${cur%"${cur##*:}"} |
644
5a6d6ad8e7f4
Add cli option handling for gradle bash-completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
643
diff
changeset
|
23 |
COMPREPLY=( $(compgen -W '$_opts $_help_cmds $_java_cmds $_application_cmds' -- $cur) ) |
643 | 24 |
# local i=${#COMPREPLY[*]} |
25 |
# while [ $((--i)) -ge 0 ]; do |
|
26 |
# COMPREPLY[$i]=${COMPREPLY[$i]#"$colonprefixes"} |
|
27 |
# done |
|
28 |
return 0 |
|
29 |
} && |
|
30 |
complete -F _gradle gradle |