<dependency> <groupId>com.lexicalscope</groupId> <artifactId>jewelcli</artifactId> <version>0.11.0</version> </dependency> import com.lexicalscope.jewel.cli.Option; public interface MyToolOptions { @Option String getMyParameter(); @Option boolean isMySwitch(); } import com.lexicalscope.jewel.cli.CliFactory; public class MyTool { public static void main(String[] args) { MyToolOptions options = CliFactory.parseArguments(MyToolOptions.class, args); String parameter = options.getMyParameter(); boolean switchValue = options.isMySwitch(); } } java MyTool --myParameter "hello" --mySwitch


上一篇:
下一篇:
切换中文