2010-11-25 13:48:07 -07:00
|
|
|
_ant_does_target_list_need_generating () {
|
2013-03-12 10:11:18 -07:00
|
|
|
[ ! -f .ant_targets ] && return 0;
|
2014-11-17 21:38:22 -07:00
|
|
|
[ build.xml -nt .ant_targets ] && return 0;
|
2013-03-12 10:11:18 -07:00
|
|
|
return 1;
|
2010-11-25 13:48:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
_ant () {
|
|
|
|
if [ -f build.xml ]; then
|
|
|
|
if _ant_does_target_list_need_generating; then
|
2014-11-17 21:43:19 -07:00
|
|
|
ant -p | awk -F " " 'NR > 5 { print lastTarget }{lastTarget = $1}' > .ant_targets
|
2010-11-25 13:48:07 -07:00
|
|
|
fi
|
2015-02-09 13:43:51 -07:00
|
|
|
compadd -- `cat .ant_targets`
|
2010-11-25 13:48:07 -07:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
compdef _ant ant
|