[Bash-completion-commits] [bash-completion] 03/03: ant: Support buildfile set in $ANT_ARGS (Alioth: #314735)

Ville Skyttä scop-guest at moszumanska.debian.org
Sun Jul 20 08:53:22 UTC 2014


This is an automated email from the git hooks/post-receive script.

scop-guest pushed a commit to branch master
in repository bash-completion.

commit 86df56d5ec986566a33cc5b1067c6dbc6078dab1
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sun Jul 20 11:42:09 2014 +0300

    ant: Support buildfile set in $ANT_ARGS (Alioth: #314735)
---
 completions/ant              | 9 +++++++++
 test/lib/completions/ant.exp | 7 +++++++
 2 files changed, 16 insertions(+)

diff --git a/completions/ant b/completions/ant
index c020550..7c14fe7 100644
--- a/completions/ant
+++ b/completions/ant
@@ -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
diff --git a/test/lib/completions/ant.exp b/test/lib/completions/ant.exp
index fa07459..1294724 100644
--- a/test/lib/completions/ant.exp
+++ b/test/lib/completions/ant.exp
@@ -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

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/bash-completion/bash-completion.git



More information about the Bash-completion-commits mailing list