Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
1.4
-
None
-
None
Description
Currently when I specify a flag that requires an argument, but I actually don't specify that argument, I get the usage plus an exception. It would be nicer for the user if the exception did not happen:
$ myCliApp -a error: Missing argument for option: a usage: [options] Options: -a,--argument <arg> specify this argument Exception in thread "main" java.lang.NullPointerException: Cannot invoke method hasOption() on null object at org.codehaus.groovy.runtime.NullObject.invokeMethod(NullObject.java:91) at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:47) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) at org.codehaus.groovy.runtime.callsite.NullCallSite.call(NullCallSite.java:34) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:127) at groovy.cli.commons.CliBuilder.processSetAnnotation(CliBuilder.groovy:561)
And I cannot control this because I just call:
cli.parseFromInstance options, args
Thanks in advance.