commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From LAURENT Frederic SZSIC13 softeam <frederic.laur...@interieur.gouv.fr>
Subject Re: [CLI] UnrecognizedOptionException on simple test
Date Thu, 11 Dec 2003 08:30:39 GMT
Martin van den Bemt wrote:
> Tried --url instead of -url? Normally the single dash is for single
> letter parmater names and the double dash for the "readable" name..
> Not a cli developer / user though..

well I've got another wrong result :( (wich seems to be correct)

 >>> test="--url http://foo.com"
 >>> parser=PosixParser()
 >>> line = parser.parse(options,[String(test)])
Traceback (innermost last):
   File "<console>", line 1, in ?
org.apache.commons.cli.UnrecognizedOptionException: Unrecognized option: 
--url http://foo.com
         at org.apache.commons.cli.Parser.processOption(Parser.java:253)
...


According to the documentation [*], if you want a -listener argument you
have to create an option by invoking the OptionBuilder like this

Option listener  = OptionBuilder.withArgName( "classname" )
       .hasArg()
       .withDescription( "add an instance of class as "
                                     + "a project listener" )
       .create( "listener");



[*] http://jakarta.apache.org/commons/cli/usage.html


Fred

-- 
XPath free testing software :  http://lantern.sourceforge.net
Frédéric Laurent                     http://www.opikanoba.org


---------------------------------------------------------------------
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