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