Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 48320 invoked from network); 10 Dec 2003 16:12:48 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 10 Dec 2003 16:12:48 -0000 Received: (qmail 31763 invoked by uid 500); 10 Dec 2003 16:12:38 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 31685 invoked by uid 500); 10 Dec 2003 16:12:37 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 31672 invoked from network); 10 Dec 2003 16:12:36 -0000 Received: from unknown (HELO tigre1.interieur.gouv.fr) (212.234.218.75) by daedalus.apache.org with SMTP; 10 Dec 2003 16:12:36 -0000 Received: from piloux.daum (tigre1 [212.234.218.75]) by tigre1.interieur.gouv.fr (8.12.9/8.12.9) with ESMTP id hBAGCYTs002991 for ; Wed, 10 Dec 2003 17:12:35 +0100 Received: from puma20.interieur.gouv.fr ([10.253.20.7]) Received: from interieur.gouv.fr (localhost [127.0.0.1]) Received: from interieur.gouv.fr (localhost [127.0.0.1]) id 3FC37D8C00091EA9 for commons-user@jakarta.apache.org; Wed, 10 Dec 2003 17:12:36 +0100 Message-Id: <3FD7468E.3040204@intermel.si.mi> Date: Wed, 10 Dec 2003 17:15:10 +0100 From: LAURENT Frederic SZSIC13 softeam User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031013 Thunderbird/0.3 X-Accept-Language: en-us, en MIME-Version: 1.0 To: commons-user@jakarta.apache.org Subject: [CLI] UnrecognizedOptionException on simple test Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hello I am trying to make a simple test working with CLI, but without success :( Well, I add an Option (ie "url"), and when I test this command line java fooMain -url http://foo.com an exception is thrown org.apache.commons.cli.UnrecognizedOptionException: Unrecognized option: -u Here some Jython code of what I am doing >>> options = Options() >>> OptionBuilder.withArgName("url") org.apache.commons.cli.OptionBuilder@1795327 >>> OptionBuilder.hasArg() org.apache.commons.cli.OptionBuilder@1795327 >>> OptionBuilder.withDescription("an url") org.apache.commons.cli.OptionBuilder@1795327 >>> url = OptionBuilder.create("url") >>> options.addOption(url) [ Options: [ short {-url=[ option: url :: an url ]} ] [ long {} ] >>> test="-url http://foo.com" >>> parser=PosixParser() >>> line = parser.parse(options,[String(test)]) Traceback (innermost last): File "", line 1, in ? org.apache.commons.cli.UnrecognizedOptionException: Unrecognized option: -u at org.apache.commons.cli.Parser.processOption(Parser.java:253) at org.apache.commons.cli.Parser.parse(Parser.java:170) at org.apache.commons.cli.Parser.parse(Parser.java:114) ... then If I remove the '-', no exception is thrown but the result is null (None in Jython) >>>>>> test="url http://foo.com" >>>>>> line = parser.parse(options,[String(test)]) >>>>>> print line.getOptionValue("url") None I have downloaded the zip file available on the jakarta website (1.0), and so I do not get sources from cvs. any idea ? thanks -- 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