Skip to content

option is treated as option-parameter (was: option is treated as option-parameter in Arguments Groups) #1055

@waacc-gh

Description

@waacc-gh

see: #1054

    @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 -w text --> accepted --> ok
  • -f -f -w text --> accepted --> wrong: findPattern = "-f", means, the second -f is treated as an option-parameter for the first -f
  • -f pattern -w -d --> wrong: replacement = "-d", means -d is treated as an option-parameter for -w

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions