commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Horman <jhor...@musicmatch.com>
Subject RE: [jelly] usage, output file
Date Fri, 04 Oct 2002 18:02:32 GMT
I have one additional item for the command line processing. It is a cmdline
tag that allows you to extract command line arguments easily. I am also
attaching a test jelly script that demonstrates. This may not be how you
want to handle this. It may make more sense for this functionality to be
bundled into "set", but this tag may be useful nonetheless.

Examples:

<!-- var a is set to option -a -->
<cmdline var="a" option="a" />

<!-- the script writes and error and exits if -b is not available -->
<cmdline var="b" option="b" required="true" />

<!-- if -c wasn't passed in var c will be set to "default" -->
<cmdline var="c" option="c" default="default" /> 

-jason horman



-----Original Message-----
From: James Strachan [mailto:james_strachan@yahoo.co.uk]
Sent: Friday, October 04, 2002 4:36 AM
To: Jakarta Commons Developers List
Subject: Re: [jelly] usage, output file


From: "Jason Horman" <jhorman@musicmatch.com>
> I am attaching the new Jelly.java and testCmdLineOptions.jelly files. New
> usage will be:
>
> Usage: jelly [scriptFile] [-script scriptFile -o outputFile
> -Dsysprop=syspropval]
>
> -script overrides the scriptFile specified. arg[2] = outputFile is
> deprecated.
>
> Additional command line options are available in jelly scripts by using
the
> commandLine.getOptionValue(optionName) method. Args is also still
available.
>
> context.setVariable("args", args);
> context.setVariable("commandLine", cmdLine);
>
> This change requires commons-lang and commons-cli. I developed this
against
> the cvs version of CLI which seems to be incompatible with the latest CLI
> binary dist from jakarta. I am attaching the jar of the latest cvs
version.
> BTW, the maven and ant configs of CLI don't work right with the latest
> version of MAVEN.

Great stuff Jason! Many thanks. I've committed all these changes.

FWIW I just tried to build the latest CLI via Maven (b7) and it worked fine.
(I did make one minor patch to a unit test case that wasn't working on
Windows). I've also updated the current commons-cli SNAPSHOT in the Maven
repository.

I've added a little target to maven.xml so that you can type...

    maven demo:cmdline

to run your command line Jelly script that demonstrates how to access the
command line options and arguments from inside a Jelly script (using
beanshell)

James
-------
http://radio.weblogs.com/0112098/

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

--
To unsubscribe, e-mail:
<mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:commons-dev-help@jakarta.apache.org>
This email message and any attachments are for the sole use of the intended
recipient(s) and may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited. If you
are not the intended recipient or his/her representative, please contact the
sender by reply email and destroy all copies of the original message.
    


Mime
View raw message