1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-06-09 06:28:06 +02:00

52366 + fix typo: rename find_targets as _ant_targets, replace one sed with substitution

This commit is contained in:
Bart Schaefer 2023-12-09 19:47:09 -08:00
parent 0ecc456fb2
commit 71b7008ceb
2 changed files with 9 additions and 5 deletions
ChangeLog
Completion/Unix/Command

View file

@ -1,5 +1,8 @@
2023-12-09 Bart Schaefer <schaefer@zsh.org> 2023-12-09 Bart Schaefer <schaefer@zsh.org>
* 52366 + fix typo: Completion/Unix/Command/_ant: rename
find_targets as _ant_targets, replace one sed with substitution
* 52365: Src/jobs.c, Src/signals.c: record state of exited * 52365: Src/jobs.c, Src/signals.c: record state of exited
background jobs sooner so as to be visible in TRAPCHLD background jobs sooner so as to be visible in TRAPCHLD

View file

@ -6,7 +6,8 @@ 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() { (( $+functions[_ant_targets] )) ||
_ant_targets() {
importedfiles=( $(sed -n "s/ *<import[^>]* file=[\"']\([^\"']*\)[\"'].*/\1/p" < $1) ) importedfiles=( $(sed -n "s/ *<import[^>]* file=[\"']\([^\"']*\)[\"'].*/\1/p" < $1) )
# Tweaked to omit targets beginning with "-" that can't # Tweaked to omit targets beginning with "-" that can't
# be invoked from the command line; see zsh-workers/24129. # be invoked from the command line; see zsh-workers/24129.
@ -14,12 +15,12 @@ find_targets() {
if (( $#importedfiles )) ; then if (( $#importedfiles )) ; then
( cd $1:h ( cd $1:h
for file in $importedfiles ; do for file in $importedfiles ; do
expanded=( $(echo $file | sed -n "s|\${ant.home}|$ANT_HOME|p") ) expanded=${file//\${ant.home}/$ANT_HOME}
if [[ ! "bla$expanded" = "bla" ]]; then if [[ "$expanded" != "$file" ]]; then
file=$expanded file=$expanded
fi fi
if [[ -f $file ]]; then if [[ -f $file ]]; then
find_targets $file _ant_targets $file
fi fi
done ) done )
fi fi
@ -135,7 +136,7 @@ case $state in
)//$'\015'}" )//$'\015'}"
_describe 'target' tmp && ret=0 _describe 'target' tmp && ret=0
else else
targets=( $(find_targets $buildfile) ) targets=( $(_ant_targets $buildfile) )
_wanted targets expl target compadd -a targets && ret=0 _wanted targets expl target compadd -a targets && ret=0
fi fi
else else