我想为以下代码段提供互斥的命令选项:
@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)
//
}
如果我将@ArgGroup 用于类字段,那么它可以工作,但我想为方法实现相同的效果。
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 ;
}
}