You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import picocli.CommandLine;
import picocli.CommandLine.ScopeType;
import picocli.CommandLine.*;
@Command(scope = ScopeType.INHERIT)
public class InheritHelpApp {
@Command(mixinStandardHelpOptions = true)
void sub(@Option(names = "-foo") int foo) {
System.out.printf("Foo: %d", foo);
}
public static void main (String... args) {
new CommandLine(new InheritHelpApp()).execute("sub", "-foo", "42" );
}
}
When running this code, I'm getting
java.lang.IllegalArgumentException: argument type mismatch
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at picocli.CommandLine.executeUserObject(CommandLine.java:1972)
at picocli.CommandLine.access$1300(CommandLine.java:145)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
at picocli.CommandLine.execute(CommandLine.java:2078)
at InheritHelpApp.main(InheritHelpApp.java:14)
It's the combination of inherited scope + mixinStandardHelpOptions = true on the method subcommand that's causing trouble here. If I set scope to ScopeType.LOCAL, the sample runs fine.
The text was updated successfully, but these errors were encountered:
Avoid `IllegalArgumentException` when parent has no standard help options and `scope = INHERIT`, while subcommand does have mixed-in standard help options.
There was a logic bug that ended up removing the mixed-in standard help options from the subcommand, because it inherited from the parent and the parent did not have the mixed-in standard help options...
Avoid `IllegalArgumentException` when parent has no standard help options and `scope = INHERIT`, while subcommand does have mixed-in standard help options.
Minimum working example:
When running this code, I'm getting
It's the combination of inherited
scope
+mixinStandardHelpOptions = true
on the method subcommand that's causing trouble here. If I setscope
toScopeType.LOCAL
, the sample runs fine.The text was updated successfully, but these errors were encountered: