2021年1月14日星期四

PicoCLI : How can I use @ArgGroup for a method?

I want to have mutually exclusive command options for the below snippet :

@Command(description = "test command")  public void test(          @Option(names = { "-a"}, required = true, arity = "0", description = "print A") boolean a,          @Option(names = { "-b"}, required = true, description = "pint B") boolean b)         //   }  

If I use @ArgGroup for a class field then It works but I want to achieve the same for methods.

class TestClass{    @ArgGroup(exclusive = true, multiplicity = "1")  private Sample sample = new Sample();    public static class Sample {      @Option(names = { "-a"}, required = true, arity = "0", description = "print A") boolean a ;      @Option(names = { "-b"}, required = true, description = "pint B") boolean b ;            }  }  
https://stackoverflow.com/questions/65700629/picocli-how-can-i-use-arggroup-for-a-method January 13, 2021 at 07:03PM

没有评论:

发表评论