Skip to content

Commit

Permalink
fix: no longer get an exception when using option names as values (#1790
Browse files Browse the repository at this point in the history
)
  • Loading branch information
quintesse authored Apr 3, 2024
1 parent c59eb1b commit e835e50
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ dependencies {

implementation 'org.apache.commons:commons-text:1.11.0'
implementation 'org.apache.commons:commons-compress:1.25.0'
implementation 'info.picocli:picocli:4.6.3'
implementation 'info.picocli:picocli:4.7.5'
implementation 'io.quarkus.qute:qute-core:1.12.2.Final'
implementation 'kr.motd.maven:os-maven-plugin:1.7.1'
implementation 'org.codehaus.plexus:plexus-java:1.2.0'
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/dev/jbang/cli/JBang.java
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ public static CommandLine getCommandLine(PrintWriter localout, PrintWriter local
.setDefaultValueProvider(defaultValueProvider)
.setResourceBundle(new ConfigurationResourceBundle())
.setStopAtPositional(true)
.setAllowOptionsAsOptionParameters(true)
.setAllowSubcommandsAsOptionParameters(true)
.setOut(localout)
.setErr(localerr);
}
Expand Down
7 changes: 7 additions & 0 deletions src/test/java/dev/jbang/cli/TestRun.java
Original file line number Diff line number Diff line change
Expand Up @@ -2516,4 +2516,11 @@ void testCatalogAliasArguments() throws IOException {

assertThat(cmdline, endsWith("echo baz"));
}

@Test
void testNativeOptsVerbose() {
String arg = examplesTestFolder.resolve("helloworld.java").toAbsolutePath().toString();
CommandLine.ParseResult pr = JBang.getCommandLine().parseArgs("build", "-n", "-N=--verbose", arg);
}

}

0 comments on commit e835e50

Please sign in to comment.