option.setLongOpt(longopt); option.setRequired(required); option.setOptionalArg(optionalArg);
private Option buildOption(Node optionNode) { NamedNodeMap map = optionNode.getAttributes(); String opt = getString(map, "opt", ""); String description = getString(map, "description", ""); String longOpt = getString(map, "longOpt", ""); boolean isRequired = getBoolean(map, "required", false); boolean hasArg = getBoolean(map, "hasArg", false); if(opt.trim().length() == 0 || description.trim().length() == 0) { throw new IllegalArgumentException( "Must specify at least option and description"); } Option option = new Option(opt, description); if (longOpt.trim().length() > 0) { option.setLongOpt(longOpt); } if (isRequired) { option.setRequired(true); } if (hasArg) { option.setArgs(1); } return option; }
private Option createAnOptionWithArgument(String[] argInfo) { OptionBuilder.withArgName(argInfo[0]); OptionBuilder.hasArg(); OptionBuilder.withDescription(argInfo[2]); Option opt = OptionBuilder.create( argInfo[0]); if (!isStringEmpty(argInfo[1])) { opt.setLongOpt(argInfo[1]); } return opt; }
private Option createAnOption(String[] argInfo) { Option opt = new Option(argInfo[0], argInfo[2]); if (!isStringEmpty(argInfo[1])) { opt.setLongOpt(argInfo[1]); } return opt; }
private Option createAnOptionWithArgument(String[] argInfo) { OptionBuilder.withArgName(argInfo[0]); OptionBuilder.hasArg(); OptionBuilder.withDescription(argInfo[2]); Option opt = OptionBuilder.create( argInfo[0]); if (!isStringEmpty(argInfo[1])) { opt.setLongOpt(argInfo[1]); } return opt; }
private Option createAnOption(String[] argInfo) { Option opt = new Option(argInfo[0], argInfo[2]); if (!isStringEmpty(argInfo[1])) { opt.setLongOpt(argInfo[1]); } return opt; }
private Options populateValidOptions() { Options validOptions = new Options(); validOptions.addOption("schema", false, "Loads / Stores the schema of the relation using a hidden JSON file."); validOptions.addOption("noschema", false, "Disable attempting to load data schema from the filesystem."); validOptions.addOption(TAG_SOURCE_FILE, false, "Appends input source file name to beginning of each tuple."); validOptions.addOption(TAG_SOURCE_PATH, false, "Appends input source file path to beginning of each tuple."); validOptions.addOption("tagsource", false, "Appends input source file name to beginning of each tuple."); Option overwrite = new Option("overwrite", "Overwrites the destination."); overwrite.setLongOpt("overwrite"); overwrite.setOptionalArg(true); overwrite.setArgs(1); overwrite.setArgName("overwrite"); validOptions.addOption(overwrite); return validOptions; }
public SyncLaunchArgsOption() { this.option = OptionBuilder.create("a"); this.option.setLongOpt("args"); this.option.setArgs(100); this.option.setArgName("arg1=value1 arg2=value2 ... argx=valueX"); this.option.setDescription("Arguments of the Program"); this.option.setRequired(false); }
public SyncLaunchIdOption() { this.option = OptionBuilder.create("i"); this.option.setLongOpt("id"); this.option.setArgs(1); this.option.setArgName("id"); this.option.setDescription("Id of the Program from the list return by ll command"); this.option.setRequired(true); }
public AsyncLaunchArgsOption() { this.option = OptionBuilder.create("a"); this.option.setLongOpt("args"); this.option.setArgs(100); this.option.setArgName("arg1=value1 arg2=value2 ... argx=valueX"); this.option.setDescription("Arguments of the Program"); this.option.setRequired(false); }
public AsyncLaunchIdOption() { this.option = OptionBuilder.create("i"); this.option.setLongOpt("id"); this.option.setArgs(1); this.option.setArgName("id"); this.option .setDescription("Id of the Program from the list return by ll command"); this.option.setRequired(true); }
/** * Get the options. * * @return the specific CrawlToCsv options */ @Override protected Options getOptions() { final Options options = super.getOptions(); final Option filenameOption = new Option("f", "the name of the csv output file, default name is " + DEFAULT_FILENAME + " [optional]"); filenameOption.setArgName("FILENAME"); filenameOption.setLongOpt("filename"); filenameOption.setRequired(false); filenameOption.setArgs(1); options.addOption(filenameOption); return options; } }
/** * Get the options. * * @return the specific CrawlToCsv options */ @Override protected Options getOptions() { final Options options = super.getOptions(); final Option filenameOption = new Option("k", "the keyword to search for in the page [required]"); filenameOption.setArgName("KEYWORD"); filenameOption.setLongOpt("keyword"); filenameOption.setRequired(true); filenameOption.setArgs(1); options.addOption(filenameOption); return options; } }
/** * Get the options. * * @return the specific CrawlToCsv options */ @Override protected Options getOptions() { final Options options = super.getOptions(); final Option filenameOption = new Option("k", "the keyword to search for in the page [required]"); filenameOption.setArgName("KEYWORD"); filenameOption.setLongOpt("keyword"); filenameOption.setRequired(true); filenameOption.setArgs(1); options.addOption(filenameOption); return options; } }
/** * Get the options. * * @return the specific CrawlToCsv options */ @Override protected Options getOptions() { final Options options = super.getOptions(); final Option filenameOption = new Option("f", "the name of the csv output file, default name is " + DEFAULT_FILENAME + " [optional]"); filenameOption.setArgName("FILENAME"); filenameOption.setLongOpt("filename"); filenameOption.setRequired(false); filenameOption.setArgs(1); options.addOption(filenameOption); return options; } }
public Option op() { Option option = new Option( id!=null ? id : " ", description ); option.setLongOpt(name); option.setRequired( required ); option.setOptionalArg(optional); option.setType( type ); option.setValueSeparator(sperator); if( arg !=null && args==-1 ) { args=1; } option.setArgs(args); option.setArgName(arg); return option; }
/** * Creates an Option using OptionBuilder's State and the given parameters. * * @param opt * short representation of the option * @param longOpt * long representation of the option * @param desc * descibes the function of the option * @return the new Option */ public Option create(final String opt, final String longOpt, final String desc) { final Option option = new Option(opt, desc); option.setLongOpt(longOpt); option.setArgs(args); option.setRequired(required); option.setOptionalArg(optionalArg); option.setType(type); option.setValueSeparator(valSeparator); return option; }
public Option op() { Option option = new Option( id!=null ? id : " ", description ); option.setLongOpt(name); option.setRequired( required ); option.setOptionalArg(optional); option.setType( type ); option.setValueSeparator(sperator); if( arg !=null && args==-1 ) { args=1; } option.setArgs(args); option.setArgName(arg); return option; }
public Option op() { Option option = new Option( id!=null ? id : " ", description ); option.setLongOpt(name); option.setRequired( required ); option.setOptionalArg(optional); option.setType( type ); option.setValueSeparator(sperator); if( arg !=null && args==-1 ) { args=1; } option.setArgs(args); option.setArgName(arg); return option; }
/** * Create an Option using the current settings and with * the specified Option <code>char</code>. * * @param opt the <code>java.lang.String</code> representation * of the Option * @return the Option instance * @throws IllegalArgumentException if <code>opt</code> is not * a valid character. See Option. */ public static Option create(String opt) throws IllegalArgumentException { // create the option Option option = new Option(opt, description); // set the option properties option.setLongOpt(longopt); option.setRequired(required); option.setOptionalArg(optionalArg); option.setArgs(numberOfArgs); option.setType(type); option.setValueSeparator(valuesep); option.setArgName(argName); // reset the OptionBuilder properties OptionBuilder.reset(); // return the Option instance return option; } }