mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-11 00:51:05 +02:00
21693: Jean-Baptiste Quenot: recursively find ant targets
This commit is contained in:
parent
a4d443af43
commit
16c84ec8de
1 changed files with 13 additions and 5 deletions
|
@ -6,6 +6,18 @@ local curcontext="$curcontext" state line expl ret=1
|
||||||
typeset -A opt_args
|
typeset -A opt_args
|
||||||
local buildfile classpath cp userjars importedfiles target='*:target:->target' targets tmp
|
local buildfile classpath cp userjars importedfiles target='*:target:->target' targets tmp
|
||||||
|
|
||||||
|
find_targets() {
|
||||||
|
importedfiles=( $(sed -n "s/ *<import[^>]* file=[\"']\([^\"']*\)[\"'].*/\1/p" < $1) )
|
||||||
|
targets=( $(sed -n "s/ *<target[^>]* name=[\"']\([^\"']*\)[\"'].*/\1/p" $1) )
|
||||||
|
if (( $#importedfiles )) ; then
|
||||||
|
cd $1:h
|
||||||
|
for file in $importedfiles ; do
|
||||||
|
find_targets $file
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
_wanted targets expl target compadd -a targets && ret=0
|
||||||
|
}
|
||||||
|
|
||||||
if [[ $service = *ANT_ARGS* ]]; then
|
if [[ $service = *ANT_ARGS* ]]; then
|
||||||
compset -q
|
compset -q
|
||||||
words=( fake "$words[@]" )
|
words=( fake "$words[@]" )
|
||||||
|
@ -114,11 +126,7 @@ case $state in
|
||||||
)//$'\015'}"
|
)//$'\015'}"
|
||||||
_describe 'target' tmp && ret=0
|
_describe 'target' tmp && ret=0
|
||||||
else
|
else
|
||||||
importedfiles=( $(sed -n "s/ *<import[^>]* file=[\"']\([^\"']*\)[\"'].*/\1/p" < $buildfile) )
|
find_targets $buildfile
|
||||||
targets=( $(sed -n "s/ *<target[^>]* name=[\"']\([^\"']*\)[\"'].*/\1/p" $buildfile) )
|
|
||||||
(( $#importedfiles )) && targets+=( $(cd $buildfile:h;
|
|
||||||
sed -n "s/ *<target[^>]* name=[\"']\([^\"']*\)[\"'].*/\1/p" $importedfiles) )
|
|
||||||
_wanted targets expl target compadd -a targets && ret=0
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
_message -e targets target
|
_message -e targets target
|
||||||
|
|
Loading…
Reference in a new issue