ant.plugin.zsh 453 B

12345678910111213141516171819
  1. _ant_does_target_list_need_generating () {
  2. if [ ! -f .ant_targets ]; then return 0;
  3. else
  4. accurate=$(stat -f%m .ant_targets)
  5. changed=$(stat -f%m build.xml)
  6. return $(expr $accurate '>=' $changed)
  7. fi
  8. }
  9. _ant () {
  10. if [ -f build.xml ]; then
  11. if _ant_does_target_list_need_generating; then
  12. sed -n '/<target/s/<target.*name="\([^"]*\).*$/\1/p' build.xml > .ant_targets
  13. fi
  14. compadd `cat .ant_targets`
  15. fi
  16. }
  17. compdef _ant ant