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