$0 refers to the first argument. Where is the end? Is $9 the last
accessible argument or $10...? Then using that reference must be followed by
a split character.
ant -- one two .... eleven
<echo>$10HelloWorld</echo>
a) two0HelloWorld
b) elevenHelloWorld
Printing out multiple arguments with $* seems to ignore $0.
C:\oss\org_apache\ant16>build start -- toto titi tutu
$* = titi tutu
Where is "toto"?
(not tested, just the docu in the bug-report)
The sign: $
Because it is a property the $ seems to be ok to me. Using with out
the curly brackets {} shows the special meaning and avoids conflicts
with existing properties. $1 != ${1}
The number of arguments: $#
Ok with me. ... ok, I often write perl ...
The array: $*
Should be a list which can easily be iterated by <ac:for>.
I would prefer a comma separated list
- easier for <ac:for> as the comma is its default separator
- usually you (ok me) show a list separated by comma
The dividing argument: --
The '-' is a valid sign for target names, so '--' would be a valid target.
But because a starting '-' is responsible for passing arguments to Ant, targets
with a leading '-' cant be started from commandline. Which is there since .... a long time.
And we dont have a '--' argument yet.
Ok with me.
Additional task: <cliargs/>
As this thread showed, we need to pass the parameters directly to <java> task (or <exec>...).
So converting the $* parameter list to couple of <arg/> tags should be easy.
The easiest would be a
<arg line="$*"/>
but with additional information this would become difficult.
<arg value="-opt $0"/>
<arg value="-opt $1"/>
...
So my idea is something like
<java|exec>
<cliargs format="-opt *"/>
</java|exec>
which will be same with an "ant -- one two" as
<java|exec>
<arg value="-opt one"/>
<arg value="-opt two"/>
</java|exec>
Makes sence or too special?
Jan
>-----Ursprüngliche Nachricht-----
>Von: Dominique Devienne [mailto:ddevienne@gmail.com]
>Gesendet: Freitag, 2. Dezember 2005 03:21
>An: Ant Users List
>Betreff: Re: idiom to pass ant command line args to java task?
>
>> If you search the archives you may find more info.
>> Dominique Devienne (of the Ant PMC) had either (a) a
>proposal for, or
>> (b) a version of, Ant, that did this using imaginary
>properties ${0},
>> ${1}, etc. He will probably have something to say here. :)
>
>;-) Here it is: http://issues.apache.org/bugzilla/show_bug.cgi?id=30651
>
>I was using the weirder $0, $#, $*, $1... var names, which
>de-referenced looked like ${$0}, ${$#}, and ${$*}.
>
>And since I didn't hear any negative feedback, I was thinking
>of committing the patch.
>
>Any last comment, on the syntax or otherwise? any -1? --DD
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For
>additional commands, e-mail: user-help@ant.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
|