question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

picocli does not seem to support - as a positional parameter

See original GitHub issue

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 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:closed
  • Created 5 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
helpermethodcommented, Feb 2, 2019

Thank you very much. Was very low on time the last few weeks so couldn’t test the change 😕.

1reaction
remkopcommented, Jan 22, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found