From a3125e6e7837395ba6674d57f5f677f07bccda76 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Wed, 24 Dec 2014 13:31:29 +0100 Subject: [PATCH] enhance complete-ant-cmd.pl to know about -file and $ANT_ARGS Bugzilla Report 57371 Submitted by Christian Schmidt --- CONTRIBUTORS | 1 + WHATSNEW | 7 +++++++ contributors.xml | 4 ++++ src/script/complete-ant-cmd.pl | 8 ++++---- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index de19a80cd..d83a68389 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -53,6 +53,7 @@ Charles Hudak Charlie Hubbard Chris Povirk Christian Knorr +Christian Schmidt Christoph Gysin Christoph Wilhelms Christophe Labouisse diff --git a/WHATSNEW b/WHATSNEW index 79670f3e3..e6a0b1b34 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -52,6 +52,9 @@ Fixed bugs: * now supports nested and elements. Bugzilla Report 47002 + * complete-ant-cmd.pl now also knows about the -file option. + Bugzilla Report 57371 + Other changes: -------------- @@ -59,6 +62,10 @@ Other changes: when using the timestamped authority. Bugzilla Report 56678 + * complete-ant-cmd.pl now also analyzes the ANT_ARGS environment + variable. + Bugzilla Report 57371 + Changes from Ant 1.9.3 TO Ant 1.9.4 =================================== diff --git a/contributors.xml b/contributors.xml index be1a4ca07..3ce31a53e 100644 --- a/contributors.xml +++ b/contributors.xml @@ -233,6 +233,10 @@ Christian Knorr + + Christian + Schmidt + Christoph Gysin diff --git a/src/script/complete-ant-cmd.pl b/src/script/complete-ant-cmd.pl index 809192101..4dd51a74d 100644 --- a/src/script/complete-ant-cmd.pl +++ b/src/script/complete-ant-cmd.pl @@ -31,14 +31,14 @@ # } # compctl -K ant_complete ant build.sh -my $cmdLine = $ENV{'COMP_LINE'}; +my $cmdLine = "$ENV{'ANT_ARGS'} $ENV{'COMP_LINE'}"; my $antCmd = $ARGV[0]; my $word = $ARGV[1]; my @completions; if ($word =~ /^-/) { list( restrict( $word, getArguments() )); -} elsif ($cmdLine =~ /-(f|buildfile)\s+\S*$/) { +} elsif ($cmdLine =~ /-(f|file|buildfile)\s+\S*$/) { list( getBuildFiles($word) ); } else { list( restrict( $word, getTargets() )); @@ -58,7 +58,7 @@ sub restrict { } sub getArguments { - qw(-buildfile -debug -emacs -f -find -help -listener -logfile + qw(-buildfile -debug -emacs -f -file -find -help -listener -logfile -logger -projecthelp -quiet -verbose -version); } @@ -72,7 +72,7 @@ sub getTargets { # Look for build-file my $buildFile = 'build.xml'; - if ($cmdLine =~ /-(f|buildfile)\s+(\S+)/) { + if ($cmdLine =~ /-(f|file|buildfile)\s+(\S+)(?!.*\s-(f|file|buildfile)\s)/) { $buildFile = $2; } return () unless (-f $buildFile);