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