List of usage examples for org.apache.commons.cli OptionBuilder isRequired
public static OptionBuilder isRequired()
From source file:ubic.gemma.core.apps.ArrayDesignProbeRenamerCli.java
@Override protected void buildOptions() { super.buildOptions(); //noinspection AccessStaticViaInstance this.addOption(OptionBuilder.isRequired().hasArg().withArgName("file") .withDescription("Two-column file with old and new identifiers (additional columns ignored)") .create('f')); }
From source file:ubic.gemma.core.apps.PazarLoaderCli.java
@Override protected void buildOptions() { OptionBuilder.isRequired(); OptionBuilder.withLongOpt("file"); OptionBuilder.hasArg();// w w w. j av a 2 s .c om super.addOption(OptionBuilder.create('f')); }
From source file:yaphyre.app.YaPhyRe.java
private static Options createCommandLineOptions() { Options options = new Options(); OptionBuilder.withArgName("scene file"); OptionBuilder.withDescription("Scene file to render"); OptionBuilder.hasArg();/*from www. java 2 s . co m*/ OptionBuilder.isRequired(); options.addOption(OptionBuilder.create(COMMANDLINE_OPTION_SCENE_FILE)); OptionBuilder.withArgName("<sampler name> [number of samples]"); OptionBuilder.withDescription("The Sampler to use for the camera (single, regular, stratified, halton)"); OptionBuilder.hasArgs(2); OptionBuilder.isRequired(); options.addOption(OptionBuilder.create(COMMANDLINE_OPTION_CAMERA_SAMPLER)); OptionBuilder.withArgName("gamma value"); OptionBuilder.withDescription("Optional gamma correction"); OptionBuilder.hasArg(); OptionBuilder.isRequired(false); options.addOption(OptionBuilder.create(COMMANDLINE_OPTION_GAMMA)); return options; }
From source file:yrun.YarnRunner.java
@SuppressWarnings("static-access") public static CommandLine parse(String[] otherArgs, Writer out) { Options options = new Options(); options.addOption(OptionBuilder.isRequired().withArgName("name").hasArg() .withDescription("The name of yarn application.").create("n")); options.addOption(OptionBuilder.isRequired().withArgName("resourceManagerAddress").hasArg() .withDescription("The address of the yarn resource manager.").create("rma")); options.addOption(OptionBuilder.isRequired().withArgName("path").hasArg() .withDescription("The path where this application will be installed in yarn.").create("p")); options.addOption(OptionBuilder.withArgName("queue").hasArg() .withDescription("The yarn queue to execute this application.").create("q")); options.addOption(OptionBuilder.isRequired().withArgName("command").hasArgs() .withDescription("The command to execute in the yarn application.").create("c")); options.addOption(OptionBuilder.withArgName("archive").hasArgs() .withDescription("The archive(s) to delivery and extract in the application.").create("a")); options.addOption(OptionBuilder.withArgName("kill").withDescription("Kill the application on client death.") .create("k")); options.addOption(/* w w w . ja v a2s . co m*/ OptionBuilder.withArgName("help").withDescription("Displays help for this command.").create("h")); CommandLineParser parser = new PosixParser(); CommandLine cmd = null; try { cmd = parser.parse(options, otherArgs); if (cmd.hasOption("h")) { HelpFormatter formatter = new HelpFormatter(); PrintWriter pw = new PrintWriter(out, true); formatter.printHelp(pw, HelpFormatter.DEFAULT_WIDTH, "run", null, options, HelpFormatter.DEFAULT_LEFT_PAD, HelpFormatter.DEFAULT_DESC_PAD, null, false); return null; } } catch (ParseException e) { HelpFormatter formatter = new HelpFormatter(); PrintWriter pw = new PrintWriter(out, true); formatter.printHelp(pw, HelpFormatter.DEFAULT_WIDTH, "run", null, options, HelpFormatter.DEFAULT_LEFT_PAD, HelpFormatter.DEFAULT_DESC_PAD, null, false); return null; } return cmd; }