You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Gary Gregory <ga...@gmail.com> on 2023/08/01 12:50:20 UTC
Re: commons-cli: Trouble understanding the purpose of optionalArg method
The tests have to cover both deprecated and current APIs.
Gary
On Mon, Jul 31, 2023, 12:18 PM Sruteesh Kumar
<sr...@protonmail.com.invalid> wrote:
> But all the test cases are following deprecated OptionBuilder class right?
> optionalArg is handled differently in OptionBuilder and Option.builder()
> and that's where I got confused
>
> -------- Original Message --------
> On 31 Jul 2023, 8:27 pm, Gary Gregory wrote:
>
> > Please have a look at the unit tests and the web site, the combination
> of those two is a good way to see the API in action. Gary On Mon, Jul 31,
> 2023, 9:58 AM Sruteesh Kumar wrote: > What does it mean when
> optionalArg(true) is called for building an option? > > As per my
> understanding, it may or may not take an argument. But in this > case,
> getOptionValue is giving null even when a value is given after the > option
> > > For example, if args = {"-foo","value"} and option = >
> Option.builder().option("f").longOpt("foo").optionalArg(true).build(). In >
> this case, getOptionValue is returning null. But, as per my understanding,
> > it should return value > > Thank you, > Sruteesh Kumar Paramata