Thank you! If you want to speed up things, how about provided in patch for
this issue?

Regards,
Benedikt

Veit Guna <veit.g...@gmx.de> schrieb am Di., 6. Sep. 2016 um 22:35 Uhr:

> Hi Benedikt.
>
> Thanks for your feedback! Looks there's already one:
>
> https://issues.apache.org/jira/browse/CLI-265
>
> joined it and linked this thread.
>
> Thanks
> Veit
>
> Am 06.09.2016 um 19:56 schrieb Benedikt Ritter:
> > Hello Veit,
> >
> > it looks to me, like this is a bug in 1.3.1 Could you please file a bug
> in
> > our Issue tracker [1] and provide your code sample there?
> >
> > Thank you!
> > Benedikt
> >
> > [1] https://issues.apache.org/jira/browse/CLI
> >
> > Veit Guna <veit.g...@gmx.de> schrieb am Di., 6. Sep. 2016 um 10:09 Uhr:
> >
> >> Hi.
> >>
> >> I'm using 1.3.1 for parsing cmdline parameters. I stumbled across an odd
> >> things when working with optional parameters like in the following
> >> example:
> >>
> >>         public static void main(String[] args) throws ParseException {
> >>
> >>                 Options options = new Options();
> >>
> >>                 options.addOption(
> >>
> >> Option.builder("ls").longOpt("logSsl").desc("Activates SSL logging (very
> >> noisy!)").build());
> >>                 options.addOption(
> >>
>  Option.builder("lr").longOpt("logRequest")
> >>                                                 .desc("Activates
> >> request/response logging with a maximum of n bytes per payload (default:
> >> 10000)")
> >>
> >> .argName("byte-count").optionalArg(true).numberOfArgs(1).build());
> >>
> >>                 CommandLineParser parser = new DefaultParser();
> >>                 CommandLine line = parser.parse(options, args);
> >>                 System.out.println(line.getOptionValue("lr"));
> >>         }
> >>
> >> Executing it with "-lr -ls" returns "-ls". If I invoke it with "-lr 5000
> >> -ls" it returns 5000.
> >> So it seems, although I marked it as an optional argument, it just takes
> >> the next parameter "-ls"
> >> as an argument for "-lr" - which I wouldn't expect. It could simply
> >> identify whether it is an argument
> >> by simply checking against the list of valid parameters and just return
> >> null or something.
> >>
> >> Is this expected behavior? If so, how can I check if an optional
> argument
> >> has been provided or not?
> >>
> >> Thanks.
> >> Veit
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> >> For additional commands, e-mail: user-h...@commons.apache.org
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>
>

Reply via email to