013b2bffcf11d0bc3ff29c96a8e6846166639c2c

Author
Chris Peterson <cpeterson@financialforce.com>
Committer
Chris Peterson <cpeterson@financialforce.com>
Date

Message

Change ant target enumeration

Make use of ant's project help feature instead of trying to parse XML with regex (see: http://stackoverflow.com/a/1732454/740787).
This is a behavioral change that does a few things:
 • adds support for ant imports, which were previously not recognized as possibly containing targets
 • supresses targets with no description, as these are conventionally for internal use only

Diff

 1diff --git a/plugins/ant/ant.plugin.zsh b/plugins/ant/ant.plugin.zsh
 2index 38d13f2a8e6b5b674460e7ade47d3b41a8a7de72..a945967d54df789343e93322085e4bde8ab0df29 100644
 3--- a/plugins/ant/ant.plugin.zsh
 4+++ b/plugins/ant/ant.plugin.zsh
 5@@ -7,7 +7,7 @@ _ant_does_target_list_need_generating () {
 6 _ant () {
 7   if [ -f build.xml ]; then
 8     if _ant_does_target_list_need_generating; then
 9-     sed -n '/<target/s/<target.*name="\([^"]*\).*$/\1/p' build.xml > .ant_targets
10+    	ant -p | awk -F " " 'NR > 5 { print lastTarget }{lastTarget = $1}' > .ant_targets
11     fi
12     compadd `cat .ant_targets`
13   fi