ant.plugin.zsh 380 Bytes
Newer Older
Claus Witt's avatar
Claus Witt committed
1
_ant_does_target_list_need_generating () {
2
  [ ! -f .ant_targets ] && return 0;
3
  [ build.xml -nt .ant_targets ] && return 0;
4
  return 1;
Claus Witt's avatar
Claus Witt committed
5
6
7
8
9
}

_ant () {
  if [ -f build.xml ]; then
    if _ant_does_target_list_need_generating; then
Chris Peterson's avatar
Chris Peterson committed
10
    	ant -p | awk -F " " 'NR > 5 { print lastTarget }{lastTarget = $1}' > .ant_targets
Claus Witt's avatar
Claus Witt committed
11
12
13
14
15
16
    fi
    compadd `cat .ant_targets`
  fi
}

compdef _ant ant