summaryrefslogtreecommitdiff
path: root/Completion/Unix/Command/_ant
diff options
context:
space:
mode:
authorBart Schaefer <schaefer@zsh.org>2023-12-09 19:47:09 -0800
committerBart Schaefer <schaefer@zsh.org>2023-12-09 19:47:09 -0800
commit71b7008ceb504822ab1e415951868b986bf57d74 (patch)
treea0efdc84ce9c4ad1b90a7fa1345758fac0d861cb /Completion/Unix/Command/_ant
parent0ecc456fb2a4dda75e9910bb019d381406f040e8 (diff)
downloadzsh-71b7008ceb504822ab1e415951868b986bf57d74.tar.gz
zsh-71b7008ceb504822ab1e415951868b986bf57d74.zip
52366 + fix typo: rename find_targets as _ant_targets, replace one sed with substitution
Diffstat (limited to 'Completion/Unix/Command/_ant')
-rw-r--r--Completion/Unix/Command/_ant11
1 files changed, 6 insertions, 5 deletions
diff --git a/Completion/Unix/Command/_ant b/Completion/Unix/Command/_ant
index 91428b854..fd6112add 100644
--- a/Completion/Unix/Command/_ant
+++ b/Completion/Unix/Command/_ant
@@ -6,7 +6,8 @@ local curcontext="$curcontext" state line expl ret=1
typeset -A opt_args
local buildfile classpath cp userjars importedfiles target='*:target:->target' targets tmp
-find_targets() {
+(( $+functions[_ant_targets] )) ||
+_ant_targets() {
importedfiles=( $(sed -n "s/ *<import[^>]* file=[\"']\([^\"']*\)[\"'].*/\1/p" < $1) )
# Tweaked to omit targets beginning with "-" that can't
# be invoked from the command line; see zsh-workers/24129.
@@ -14,12 +15,12 @@ find_targets() {
if (( $#importedfiles )) ; then
( cd $1:h
for file in $importedfiles ; do
- expanded=( $(echo $file | sed -n "s|\${ant.home}|$ANT_HOME|p") )
- if [[ ! "bla$expanded" = "bla" ]]; then
+ expanded=${file//\${ant.home}/$ANT_HOME}
+ if [[ "$expanded" != "$file" ]]; then
file=$expanded
fi
if [[ -f $file ]]; then
- find_targets $file
+ _ant_targets $file
fi
done )
fi
@@ -135,7 +136,7 @@ case $state in
)//$'\015'}"
_describe 'target' tmp && ret=0
else
- targets=( $(find_targets $buildfile) )
+ targets=( $(_ant_targets $buildfile) )
_wanted targets expl target compadd -a targets && ret=0
fi
else