Skip to content
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

"Option Names as Option Values" not working #1272

Closed
clausnagel opened this issue Dec 3, 2020 · 1 comment
Closed

"Option Names as Option Values" not working #1272

clausnagel opened this issue Dec 3, 2020 · 1 comment

Comments

@clausnagel
Copy link

I would like one of my options to be able to take option names as the parameter value. The release info of version 4.4.0 indicates that the parser does no longer assign values that match an option name to an option, unless the value is in quotes. I am happy to use quotes for this purpose.

However, the following example code copied from the online documentation does not work for me:

class App {
    @Option(names = "-x") String x;
    @Option(names = "-y") String y;

    public static void main(String... args) {
        App app = new App();
        new CommandLine(app).setTrimQuotes(true).parseArgs(args);
        System.out.printf("x='%s', y='%s'%n", app.x, app.y);
    }
}

When passing -x="-y" to the code, I do not get the expected result (-y is assigned to x) but the following error is thrown:

picocli.CommandLine$MissingParameterException: Expected parameter for option '-x' but found '-y'

I tested with 4.4.0 and 4.5.2. What am I doing wrong?

@clausnagel
Copy link
Author

Sorry, discussed in #1125.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant