<dependency> <groupId>org.rogach</groupId> <artifactId>scallop</artifactId> <version>4.0.2</version> </dependency> groovy dependencies { implementation 'org.rogach:scallop:4.0.2' } import org.rogach.scallop.*; public class MyCommandLineArgs extends ScallopConf { public final ScallopOption<String> input = opt<String>("input", required = true, descr = "Input file path"); public final ScallopOption<Integer> count = opt<Integer>("count", descr = "Number of iterations", default = Some(10)); public final ScallopOption<Boolean> verbose = toggle("verbose", default = Some(false)); } import org.rogach.scallop.*; public class MyApp { public static void main(String[] args) { String inputFilePath = conf.input(); int iterationCount = conf.count(); boolean isVerbose = conf.verbose(); } }


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