From 7f636ba5901b1abe9bb01d94b9e290bed982a873 Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Mon, 17 Nov 2014 20:38:22 -0800 Subject: [PATCH 1/3] Backwards logic in newer check. Regen .ant_targets only if it's newer than build.xml? Yeah, that seems wrong. --- plugins/ant/ant.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ant/ant.plugin.zsh b/plugins/ant/ant.plugin.zsh index 45f2b06eb..38d13f2a8 100644 --- a/plugins/ant/ant.plugin.zsh +++ b/plugins/ant/ant.plugin.zsh @@ -1,6 +1,6 @@ _ant_does_target_list_need_generating () { [ ! -f .ant_targets ] && return 0; - [ .ant_targets -nt build.xml ] && return 0; + [ build.xml -nt .ant_targets ] && return 0; return 1; } From 013b2bffcf11d0bc3ff29c96a8e6846166639c2c Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Mon, 17 Nov 2014 20:43:19 -0800 Subject: [PATCH 2/3] Change ant target enumeration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- plugins/ant/ant.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ant/ant.plugin.zsh b/plugins/ant/ant.plugin.zsh index 38d13f2a8..a945967d5 100644 --- a/plugins/ant/ant.plugin.zsh +++ b/plugins/ant/ant.plugin.zsh @@ -7,7 +7,7 @@ _ant_does_target_list_need_generating () { _ant () { if [ -f build.xml ]; then if _ant_does_target_list_need_generating; then - sed -n '/ .ant_targets + ant -p | awk -F " " 'NR > 5 { print lastTarget }{lastTarget = $1}' > .ant_targets fi compadd `cat .ant_targets` fi From 349493a0b81ae98117ea1a115a92ba509476298f Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Mon, 9 Feb 2015 12:43:51 -0800 Subject: [PATCH 3/3] Fix for ant targets with leading dash As suggested in https://github.com/robbyrussell/oh-my-zsh/pull/3329#issuecomment-72062236 --- plugins/ant/ant.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ant/ant.plugin.zsh b/plugins/ant/ant.plugin.zsh index a945967d5..0b738c94f 100644 --- a/plugins/ant/ant.plugin.zsh +++ b/plugins/ant/ant.plugin.zsh @@ -9,7 +9,7 @@ _ant () { if _ant_does_target_list_need_generating; then ant -p | awk -F " " 'NR > 5 { print lastTarget }{lastTarget = $1}' > .ant_targets fi - compadd `cat .ant_targets` + compadd -- `cat .ant_targets` fi }