picocli does not seem to support - as a positional parameter
See original GitHub issueHi,
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 parameter
cat -
which 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
@Command(name = "mst-cli", mixinStandardHelpOptions = true)
public class Cli implements Runnable {
@Parameters(index = "0")
private String json;
@Parameters(index = "1")
private String template;
// more code
}
with the following parameters
- ~/hello.mustache
picocli complains that the second parameter isn’t set 😕.
But
~/data.json ~/hello.mustache
works.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
picocli - a mighty tiny command line interface
Picocli 3.5 introduced password support: for options and positional parameters marked as interactive , the user is prompted to enter a value on...
Read more >CommandLine.Model.PositionalParamSpec (picocli 4.6.3 API)
Positional parameters have an index (or a range of indices). A positional parameter is matched when the parser encounters a command line argument...
Read more >Quick Guide - Picocli
Positional Parameters. Any command line arguments that are not subcommands, options or option parameters are interpreted as positional ...
Read more >a mighty tiny command line interface - picocli
Any command line argument that is not an option or subcommand is interpreted as a positional parameter. String[] args = { "param0", " ......
Read more >CommandLine (picocli 4.7.0 API)
Help command that can be installed as a subcommand on all application commands. ... Options or positional parameters can be assigned a IParameterConsumer ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thank you very much. Was very low on time the last few weeks so couldn’t test the change 😕.
Fixed in master. Improved the heuristics for unmatched options: single-character arguments that don’t exactly match options (like
-
) are now always considered positional parameters.Please verify.