-
Notifications
You must be signed in to change notification settings - Fork 418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
picocli does not seem to support - as a positional parameter #613
Comments
Is there a stack trace or more detailed error message? |
I agree that the single dash character |
I was able to reproduce the problem with this test: @Test
public void testSingleDashPositionalParam() {
@Command(name = "dashtest", mixinStandardHelpOptions = true)
class App {
@Parameters(index = "0")
private String json;
@Parameters(index = "1")
private String template;
}
System.setProperty("picocli.trace", "DEBUG");
App app = new App();
CommandLine commandLine = new CommandLine(app);
commandLine.parseArgs("-", "~/hello.mustache");
assertEquals("-", app.json);
assertEquals("~/hello.mustache", app.template);
} I see the following DEBUG output:
So the problem is that the single dash resembles an option in picocli's heuristics for unmatched arguments. The workaround is to set
This will make parse the input as expected. Maybe the heuristic should be improved. |
Fixed in master. Please verify. |
Picocli 3.9.3 has been released. This includes a fix for this issue. Enjoy! |
Thank you very much. Was very low on time the last few weeks so couldn't test the change :/. |
Hi,
I'm preparing some demo project for picocli and stumbled over some interesting, currently unsupported case.
Some shell commands, like
cat
accept-
as a positional parameterwhich means
cat
will read it's input from STDIN instead of a file.But it seems picocli currently doesn't support such a case?
When I call
with the following parameters
picocli complains that the second parameter isn't set :/.
But
works.
The text was updated successfully, but these errors were encountered: