Re: Query related to Apache Commons CLI

2023-11-14 Thread Sruteesh Kumar
Consider the following options scenario: Option.builder("1").longOpt("one").hasArgs().build() Option.builder("2").longOpt("two").hasArg().required().build() with the following args: String[] args = {"--one","arg1","-2","arg2"} It should consider -2 as an argument or an option? Because, the option

Re: Query related to Apache Commons CLI

2023-11-12 Thread Paul King
I think this question only makes sense if you give the Options spec you are using. Using an Options with both of these: Option.builder().longOpt('one').numberOfArgs(1).build() Option.builder('2').numberOfArgs(1).build() It treats the "-2" as you are expecting. Using an Options with both of thes

Query related to Apache Commons CLI

2023-11-12 Thread Sruteesh Kumar
I have a doubt on Apache Commons CLI For DefaultParser, why is a negative number preferably considered as an argument rather than an option Consider the following case, for example: String[] args= {"--one","arg1","-2","arg2"}; Here, -2 is considered as an argument to --one, even if there is a r