This repository has been archived on 2022-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
prezto/plugins/ant/ant.plugin.zsh

28 lines
577 B
Bash
Raw Normal View History

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