PicoCLI:如何将 @ArgGroup 用于方法?

问题描述

我希望以下代码段具有互斥的命令选项:

@Command(description = "test command")
public void test(
        @Option(names = { "-a"},required = true,arity = "0",description = "print A") boolean a,@Option(names = { "-b"},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"},description = "print A") boolean a ;
    @Option(names = { "-b"},description = "pint B") boolean b ;
    
    }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)