# bash completion for ant and phing -*- shell-script -*- _comp_cmd_ant__targets() { local line basedir [[ $1 == */* ]] && basedir=${1%/*} || basedir=. # parse buildfile for targets while read -rd '>' line; do if [[ $line =~ \<(target|extension-point)[[:space:]].*name=[\"\']([^\"\']+) ]]; then REPLY+=("${BASH_REMATCH[2]}") fi done <"$1" # parse imports while read -rd '>' line; do if [[ $line =~ \/dev/null; then complete -C complete-ant-cmd.pl -F _comp_cmd_ant ant fi # ex: filetype=sh