import org.apache.commons.cli.*; public class CommandLineExample { public static void main(String[] args) { Options options = new Options(); CommandLineParser parser = new DefaultParser(); try { CommandLine cmd = parser.parse(options, args); if (cmd.hasOption("h")) { HelpFormatter formatter = new HelpFormatter(); } if (cmd.hasOption("v")) { } String[] remainingArgs = cmd.getArgs(); for (String arg : remainingArgs) { } } catch (ParseException e) { } } }


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