commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Weder <>
Subject Parsed Option missing value
Date Fri, 29 Oct 2004 15:47:53 GMT
Just started using CLI (the download is commons-cli-1.0.jar)

All was going well untill I encountered this problem demonstated below:

        Options ops = new Options();

         ops.addOption(  OptionBuilder
                            .withDescription("this is param 1" )

         ops.addOption(  OptionBuilder
                            .withDescription("this is param 2")

        CommandLineParser parser = new PosixParser();
        String[] args = new String[]{"-a=abc", "--param2=xyz"};
        CommandLine cmd = parser.parse(permittedOptions, args);
        Option[] t = cmd.getOptions();

When I use the getValue() on the Option instances that CommandLine 
returns, the "-a" option has "" as a value, but the "-b" has "xyz". 
Tried all kinds of permutations but anything I try using the short 
option, I get no value.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message