# HG changeset patch # User Oleksandr Gavenko # Date 1381942109 -10800 # Node ID 5a6d6ad8e7f4358c939869bcdf786ddca7de35fe # Parent 9f5ece28cd08641e1c8c0dcac87981da5fd6d8fc Add cli option handling for gradle bash-completion. diff -r 9f5ece28cd08 -r 5a6d6ad8e7f4 .bash_completion.d/gradle --- a/.bash_completion.d/gradle Wed Oct 16 18:42:07 2013 +0300 +++ b/.bash_completion.d/gradle Wed Oct 16 19:48:29 2013 +0300 @@ -2,13 +2,25 @@ _gradle() { - local cmds cur colonprefixes - COMPREPLY=() + 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 \ + -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 \ + -q --quiet -r --properties -s --stacktrace -t --tasks -u --no-search-upward -v --version -x --exclude-task" local _help_cmds='dependencies dependencyInsight help projects properties tasks' local _java_cmds='assemble build buildDependents buildNeeded classes compileJava processResources clean cleanTest jar testClasses compileTestJava processTestResources javadoc check test uploadArchives' + local _application_cmds='run startScripts installApp distZip distTar' + local cur prev cur=${COMP_WORDS[COMP_CWORD]} + [[ $COMP_CWORD != 0 ]] && prev=${COMP_WORDS[COMP_CWORD-1]} + case "$prev" in + -I|--init-script|-b|--build-file|-c|--settings-file|-e|--embedded) + COMPREPLY=( $(compgen -f -- "$cur") ) + return ;; + -g|--gradle-user-home|-p|--project-dir) + COMPREPLY=( $(compgen -d -- "$cur") ) + return ;; + esac # colonprefixes=${cur%"${cur##*:}"} - COMPREPLY=( $(compgen -W '$_help_cmds $_java_cmds' -- $cur) ) + COMPREPLY=( $(compgen -W '$_opts $_help_cmds $_java_cmds $_application_cmds' -- $cur) ) # local i=${#COMPREPLY[*]} # while [ $((--i)) -ge 0 ]; do # COMPREPLY[$i]=${COMPREPLY[$i]#"$colonprefixes"}