about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2005-09-05 13:55:47 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2005-09-05 13:55:47 +0000
commit394ab0aeb72190e66aca3b3d21c9d3264fe1129f (patch)
tree2d158f060057b6f0060f6cdb2fb8a05a30fda7b2
parent9b05a714c3fefd05b4b06c6329f2ba3fc7e336c1 (diff)
downloadzsh-394ab0aeb72190e66aca3b3d21c9d3264fe1129f.tar.gz
zsh-394ab0aeb72190e66aca3b3d21c9d3264fe1129f.tar.xz
zsh-394ab0aeb72190e66aca3b3d21c9d3264fe1129f.zip
21698: Jean-Baptiste Quenot: _ant recursive completion could change dir
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Command/_ant10
2 files changed, 10 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 179e009c4..ad5d5a0fd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-09-05  Peter Stephenson  <pws@csr.com>
+
+	* 21698: Jean-Baptiste Quenot: Completion/Unix/Command/_ant:
+	recursive completion could change directory.
+
 2005-09-02  Clint Adams  <clint@zsh.org>
 
 	* 21696: Completion/Unix/Command/_date: completion for
diff --git a/Completion/Unix/Command/_ant b/Completion/Unix/Command/_ant
index bf70915d7..7e7d14c2a 100644
--- a/Completion/Unix/Command/_ant
+++ b/Completion/Unix/Command/_ant
@@ -8,14 +8,13 @@ local buildfile classpath cp userjars importedfiles target='*:target:->target' t
 
 find_targets() {
     importedfiles=( $(sed -n "s/ *<import[^>]* file=[\"']\([^\"']*\)[\"'].*/\1/p" < $1) )
-    targets=( $(sed -n "s/ *<target[^>]* name=[\"']\([^\"']*\)[\"'].*/\1/p" $1) )
+    sed -n "s/ *<target[^>]* name=[\"']\([^\"']*\)[\"'].*/\1/p" $1
     if (( $#importedfiles )) ; then
-	cd $1:h
+	( cd $1:h
     	for file in $importedfiles ; do
 	    find_targets $file
-	done
+	done )
     fi
-    _wanted targets expl target compadd -a targets && ret=0
 }
 
 if [[ $service = *ANT_ARGS* ]]; then
@@ -126,7 +125,8 @@ case $state in
         )//$'\015'}"
         _describe 'target' tmp && ret=0
       else
-        find_targets $buildfile
+        targets=( $(find_targets $buildfile) )
+        _wanted targets expl target compadd -a targets && ret=0
       fi
     else
       _message -e targets target