ohmyzsh/plugins/ant/ant.plugin.zsh
Chris Peterson 013b2bffcf 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
2015-02-09 13:12:02 -08:00

16 lines
380 B
Bash

_ant_does_target_list_need_generating () {
[ ! -f .ant_targets ] && return 0;
[ build.xml -nt .ant_targets ] && return 0;
return 1;
}
_ant () {
if [ -f build.xml ]; then
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`
fi
}
compdef _ant ant