ant: Support buildfile set in $ANT_ARGS (Alioth: #314735)

master
Ville Skyttä 2014-07-20 11:42:09 +03:00
parent 40db483174
commit 86df56d5ec
2 changed files with 16 additions and 0 deletions

View File

@ -48,6 +48,15 @@ _ant()
break
fi
done
if [[ $i -eq $cword ]]; then
for i in $ANT_ARGS; do
if [[ $prev == -@(?(build)file|f) ]]; then
buildfile=$i
break
fi
prev=$i
done
fi
[[ ! -f $buildfile ]] && return 0
# parse buildfile for targets

View File

@ -6,6 +6,7 @@ proc setup {} {
proc teardown {} {
assert_env_unmodified {
/OLDPWD=/d
/ANT_ARGS=/d
}
}
@ -25,4 +26,10 @@ assert_complete_dir "named-build" "ant -f named-build.xml " $::srcdir/fixtures/a
sync_after_int
assert_bash_exec {OLD_ANT_ARGS=$ANT_ARGS; ANT_ARGS="-f named-build.xml"}
assert_complete_dir "named-build" "ant " $::srcdir/fixtures/ant "ant with buildfile from ANT_ARGS"
sync_after_int
assert_bash_exec {ANT_ARGS=$OLD_ANT_ARGS; unset -v OLD_ANT_ARGS}
teardown