2011-11-01 22:14:45 +02:00
|
|
|
# bash completion for ant and phing -*- shell-script -*-
|
2009-04-30 18:54:07 +03:00
|
|
|
|
|
|
|
_ant()
|
|
|
|
{
|
2011-04-20 14:18:27 +03:00
|
|
|
local cur prev words cword
|
|
|
|
_init_completion || return
|
2009-04-30 18:54:07 +03:00
|
|
|
|
2009-12-30 00:39:59 +01:00
|
|
|
case $prev in
|
2009-10-19 21:24:25 +03:00
|
|
|
-buildfile|-file|-f)
|
|
|
|
_filedir 'xml'
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-logfile|-l)
|
|
|
|
_filedir
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-propertyfile)
|
|
|
|
_filedir properties
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-nice)
|
2011-04-25 23:44:08 +03:00
|
|
|
COMPREPLY=( $( compgen -W '{1..10}' -- "$cur" ) )
|
2009-10-19 21:24:25 +03:00
|
|
|
return 0
|
|
|
|
;;
|
2011-05-03 09:43:29 +03:00
|
|
|
-lib)
|
|
|
|
_filedir -d
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-logger|-listener|-inputhandler|-main|-find|-s)
|
2009-10-19 21:24:25 +03:00
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
2009-04-30 18:54:07 +03:00
|
|
|
|
2011-05-03 09:43:29 +03:00
|
|
|
if [[ $cur == -D* ]]; then
|
|
|
|
return 0
|
|
|
|
elif [[ "$cur" == -* ]]; then
|
2011-05-03 09:46:30 +03:00
|
|
|
COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) )
|
2009-10-19 21:24:25 +03:00
|
|
|
else
|
|
|
|
# available targets completion
|
|
|
|
# find which buildfile to use
|
2011-04-20 14:18:27 +03:00
|
|
|
local buildfile=build.xml i
|
|
|
|
for (( i=1; i < cword; i++ )); do
|
|
|
|
if [[ "${words[i]}" == -@(?(build)file|f) ]]; then
|
|
|
|
buildfile=${words[i+1]}
|
2009-10-19 21:24:25 +03:00
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
2011-11-09 23:28:11 +02:00
|
|
|
[[ ! -f $buildfile ]] && return 0
|
2009-04-30 18:54:07 +03:00
|
|
|
|
2009-10-19 21:24:25 +03:00
|
|
|
# parse buildfile for targets
|
2011-05-08 14:46:12 +03:00
|
|
|
local line targets
|
|
|
|
while read -rd '>' line; do
|
|
|
|
[[ $line =~ \
|
|
|
|
\<(targe|extension-poin)t[[:space:]].*name=[\"\']([^\"\']+) ]] \
|
|
|
|
&& targets+=" ${BASH_REMATCH[2]}"
|
|
|
|
done < $buildfile
|
|
|
|
COMPREPLY=( $( compgen -W '$targets' -- "$cur" ) )
|
2011-04-26 00:21:55 +03:00
|
|
|
fi
|
2011-04-04 22:14:39 +03:00
|
|
|
} &&
|
2011-10-12 00:19:50 +03:00
|
|
|
complete -F _ant ant phing
|
|
|
|
type complete-ant-cmd.pl &>/dev/null && \
|
2011-10-16 10:39:02 +03:00
|
|
|
complete -C complete-ant-cmd.pl -F _ant ant || :
|
2009-10-01 20:54:51 +03:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
# ex: ts=4 sw=4 et filetype=sh
|