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-parameter gets lost in Argument Groups #1054

Closed
waacc-gh opened this issue May 18, 2020 · 2 comments
Closed

option-parameter gets lost in Argument Groups #1054

waacc-gh opened this issue May 18, 2020 · 2 comments
Labels
theme: arg-group An issue or change related to argument groups theme: parser An issue or change related to the parser type: bug 🐛
Milestone

Comments

@waacc-gh
Copy link

waacc-gh commented May 18, 2020

see: #1055

    @ArgGroup(exclusive = false, multiplicity = "1..*")
    private List<Modification> modifications = null;

    private static class Modification {
        @Option(names = { "-f", "--find" }, required = true)
        public  Pattern findPattern = null;
        @ArgGroup(exclusive = true, multiplicity = "1")
        private Change  change      = null;
    }

    private static class Change {
        @Option(names = { "-d", "--delete" }, required = true)
        public boolean delete      = false;
        @Option(names = { "-w", "--replace-with" }, required = true)
        public String  replacement = null;
    }

called with:

  • -f pattern -d --> accepted --> ok
  • -f pattern -w text --> accepted --> ok
  • -f pattern -d -w text --> error --> ok
  • -d -f pattern -w text --> error --> ok
  • -f pattern1 -f pattern2 -d --> accepted --> wrong: findPattern = "pattern2", "pattern1" is lost/ignored
@remkop
Copy link
Owner

remkop commented May 18, 2020

@waacc-gh Thank you for raising this!
I have been able to reproduce the issue.
Still investigating the cause...

@remkop remkop added theme: arg-group An issue or change related to argument groups type: bug 🐛 labels May 18, 2020
@remkop remkop added this to the 4.4 milestone May 18, 2020
remkop added a commit that referenced this issue May 25, 2020
…s was accepted when an option was specified multiple times
@remkop
Copy link
Owner

remkop commented May 25, 2020

Thank you for raising this.
I believe this is fixed in master now.

To verify, check out picocli master locally, and build it with publishToMavenLocal. That should publish picocli-4.3.3-SNAPSHOT to your local .m2 Maven cache.

git clone https://github.com/remkop/picocli.git
cd picocli
gradlew publishToMavenLocal

You can then try this in a project that uses the info.picocli:picocli:4.3.3-SNAPSHOT dependency. Feedback very welcome!

@remkop remkop closed this as completed May 25, 2020
@remkop remkop added the theme: parser An issue or change related to the parser label May 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: arg-group An issue or change related to argument groups theme: parser An issue or change related to the parser type: bug 🐛
Projects
None yet
Development

No branches or pull requests

2 participants