]> src.twobees.de Git - dotfiles.git/blob - stow/oh-my-zsh/.oh-my-zsh/plugins/ant/_ant
...
[dotfiles.git] / stow / oh-my-zsh / .oh-my-zsh / plugins / ant / _ant
1 #compdef ant
2
3 _ant_does_target_list_need_generating () {
4   [[ ! -f .ant_targets ]] && return 0
5   [[ build.xml -nt .ant_targets ]] && return 0
6   return 1
7 }
8
9 _ant () {
10   if [[ ! -f build.xml ]]; then
11     return
12   fi
13
14   if ! _ant_does_target_list_need_generating; then
15     return
16   fi
17
18   ant -p | awk -F " " 'NR > 5 { print lastTarget } { lastTarget = $1 }' >| .ant_targets
19   compadd -- "$(cat .ant_targets)"
20 }
21
22 _ant "$@"