1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2024-11-15 03:51:12 +00:00
prezto/plugins/ant/ant.plugin.zsh

28 lines
577 B
Bash
Raw Normal View History

2011-08-31 03:16:15 +00:00
if stat -f%m . &> /dev/null; then
stat_cmd=(stat -f%m)
else
2011-08-31 03:16:15 +00:00
stat_cmd=(stat -L --format=%Y)
fi
2011-08-31 03:16:15 +00:00
function _ant_does_target_list_need_generating() {
if [[ ! -f .ant_targets ]]; then
return 0
2010-11-25 20:48:07 +00:00
else
accurate=$($stat_cmd .ant_targets)
changed=$($stat_cmd build.xml)
2010-11-25 20:48:07 +00:00
return $(expr $accurate '>=' $changed)
fi
}
2011-08-31 03:16:15 +00:00
function _ant() {
if [[ -f build.xml ]]; then
2010-11-25 20:48:07 +00:00
if _ant_does_target_list_need_generating; then
2011-08-31 03:16:15 +00:00
sed -n '/<target/s/<target.*name="\([^"]*\).*$/\1/p' build.xml > .ant_targets
2010-11-25 20:48:07 +00:00
fi
compadd `cat .ant_targets`
fi
}
compdef _ant ant
2011-08-31 03:16:15 +00:00