summaryrefslogtreecommitdiff
path: root/Completion/Unix/Command/_ant
diff options
context:
space:
mode:
authorJoe Rayhawk <jrayhawk@fairlystable.org>2025-04-30 02:07:56 -0700
committerJoe Rayhawk <jrayhawk@fairlystable.org>2025-04-30 02:07:56 -0700
commit26e09889646be3ea65b4a3dfeda26213e4bb6a27 (patch)
tree4f3c73a9416bf47ad7e125383d23cf42879e38d7 /Completion/Unix/Command/_ant
parent841bce705a58b04220b1f257abcc00ae71cbdbdc (diff)
parent001cba48ce3b964cf01fb3e2af54b20eacbc9bf5 (diff)
downloadzsh-26e09889646be3ea65b4a3dfeda26213e4bb6a27.tar.gz
zsh-26e09889646be3ea65b4a3dfeda26213e4bb6a27.zip
Merge branch 'upstream' into debian
Diffstat (limited to 'Completion/Unix/Command/_ant')
-rw-r--r--Completion/Unix/Command/_ant19
1 files changed, 10 insertions, 9 deletions
diff --git a/Completion/Unix/Command/_ant b/Completion/Unix/Command/_ant
index 7401c7449..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
@@ -79,8 +80,8 @@ case $state in
compset -P '*:'
compset -S ':*'
_alternative \
- "classpath:$state:_path_files -qS: -g '*.(jar|zip)(-.)'" \
- "classpath:$state:_path_files -r': ' -/" && ret=0
+ "classpath:${state}:_path_files -qS: -g '*.(jar|zip)(-.)'" \
+ "classpath:${state}:_path_files -r': ' -/" && ret=0
;;
property)
if compset -P 1 '*='; then
@@ -122,20 +123,20 @@ case $state in
read default_target junk
fi
# Output target again indicating its the default one.
- print -n "'${default_target}:(Default target) ' "
+ print -rn -- "${(qq):-${default_target}:(Default target)} "
;;
(Searching:*|Main:targets:|Subtargets:|BUILD:SUCCESSFUL|Total:time:*)
;;
(*)
# Return target and description
- print -n "'$ln' "
+ print -rn -- "${(qq)ln} "
;;
esac
done
)//$'\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