You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Henryk Konsek <ha...@wp.pl> on 2006/12/30 22:41:49 UTC

[CLI] Option.setArgs and Option.setArgName issues

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