Skip to content

picocli does not seem to support - as a positional parameter #613

@helpermethod

Description

@helpermethod

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions