summaryrefslogtreecommitdiff
path: root/plugins/ant/ant.plugin.zsh
diff options
context:
space:
mode:
authorTristan Carel <tcarel@exalead.com>2011-10-10 14:58:28 +0200
committerTristan Carel <tcarel@exalead.com>2011-10-10 14:58:28 +0200
commitdb90589c8a02e98e657af17bb0b460b752d9ed61 (patch)
treed1354a9338bf9921ad0f66d2f5394272e1cfec77 /plugins/ant/ant.plugin.zsh
parent7066bf7c6b522af9147ebf03c00361c4c6490d42 (diff)
parent57f04b921ea1c12a0a283331778848cd4011bf21 (diff)
downloadzsh-db90589c8a02e98e657af17bb0b460b752d9ed61.tar.gz
zsh-db90589c8a02e98e657af17bb0b460b752d9ed61.tar.bz2
zsh-db90589c8a02e98e657af17bb0b460b752d9ed61.zip
Merge remote-tracking branch 'upstream/master' into emacs
Conflicts: plugins/emacs/emacs.plugin.zsh plugins/emacs/emacsclient.sh
Diffstat (limited to 'plugins/ant/ant.plugin.zsh')
-rw-r--r--plugins/ant/ant.plugin.zsh26
1 files changed, 26 insertions, 0 deletions
diff --git a/plugins/ant/ant.plugin.zsh b/plugins/ant/ant.plugin.zsh
new file mode 100644
index 000000000..691d4d2db
--- /dev/null
+++ b/plugins/ant/ant.plugin.zsh
@@ -0,0 +1,26 @@
+stat -f%m . > /dev/null 2>&1
+if [ "$?" = 0 ]; then
+ stat_cmd=(stat -f%m)
+else
+ stat_cmd=(stat -L --format=%Y)
+fi
+
+_ant_does_target_list_need_generating () {
+ if [ ! -f .ant_targets ]; then return 0;
+ else
+ accurate=$($stat_cmd .ant_targets)
+ changed=$($stat_cmd build.xml)
+ return $(expr $accurate '>=' $changed)
+ fi
+}
+
+_ant () {
+ if [ -f build.xml ]; then
+ if _ant_does_target_list_need_generating; then
+ sed -n '/<target/s/<target.*name="\([^"]*\).*$/\1/p' build.xml > .ant_targets
+ fi
+ compadd `cat .ant_targets`
+ fi
+}
+
+compdef _ant ant