commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henryk Konsek <h...@wp.pl>
Subject [CLI] Option.setArgs and Option.setArgName issues
Date Sat, 30 Dec 2006 21:41:49 GMT
Hi.
    I was wondering about two scenarios. The first one:

 option.setArgs(2);
 option.setArgName( "argName" );

Which results in something like this when printing help:

 -myoption <argName>

I can't code something like:

 option.setArgs(2);
 option.setArgName( 1, "argName1" );
 option.setArgName( 2, "argName2" );

...so I was wondering whether is there any way to achieve something like:

 -myoption <argName1> <argName2>



The second issue I can't figure out is how to enforce checking of amount 
of arguments for option. That is how to prevent situations in which user 
passes too much arguments for option (for instance for option with two 
arguments):

java -jar command.jar -myoption one two three

At this moment I can't even check it in the code after getOptionValues() 
due to the fact that additional arguments are simply ignored.


I would be grateful for any suggestions.

Greetings.

-- 
Henryk Konsek
http://hekonsek.blogspot.com


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message