List of usage examples for org.apache.commons.cli OptionBuilder hasArg
public static OptionBuilder hasArg()
From source file:com.beaconhill.yqd.CmdLine.java
Options buildOptions() { Options options = new Options(); Option dataDirectoryOption = OptionBuilder.hasArg().withArgName("DATA DIR") .withDescription("Data Directory").withLongOpt("data-dir").isRequired(false).create("d"); Option symbolFileOption = OptionBuilder.hasArg().withArgName("SYMBOL FILE").withDescription("Symbol File") .withLongOpt("symbol-file").isRequired(false).create("s"); // output/* w ww .j a v a 2s. c om*/ Option outputOption = OptionBuilder.withDescription("Output to STDIO").withLongOpt("output-stdio") .isRequired(false).create("o"); Option helpOption = OptionBuilder.withDescription("Help").withLongOpt("help").isRequired(false).create("h"); options.addOption(dataDirectoryOption); options.addOption(symbolFileOption); options.addOption(outputOption); options.addOption(helpOption); return options; }
From source file:de.clusteval.data.dataset.generator.HyperCubeCornersDataSetGenerator.java
@Override protected Options getOptions() { Options options = new Options(); OptionBuilder.withArgName("n"); OptionBuilder.isRequired();//from w ww . j a v a 2 s .c o m OptionBuilder.hasArg(); OptionBuilder.withDescription("The number of points."); Option option = OptionBuilder.create("n"); options.addOption(option); OptionBuilder.withArgName("d"); OptionBuilder.hasArg(); OptionBuilder.withDescription("The number of dimensions."); option = OptionBuilder.create("d"); options.addOption(option); OptionBuilder.withArgName("sd"); OptionBuilder.hasArg(); OptionBuilder.withDescription("The standard deviation."); option = OptionBuilder.create("sd"); options.addOption(option); return options; }
From source file:com.google.code.stackexchange.client.examples.AnswersApiExample.java
/** * Builds the options./* w w w . j a v a 2 s .c o m*/ * * @return the options */ private static Options buildOptions() { Options opts = new Options(); String helpMsg = "Print this message."; Option help = new Option(HELP_OPTION, helpMsg); opts.addOption(help); String consumerKeyMsg = "You API Key."; OptionBuilder.withArgName("key"); OptionBuilder.hasArg(); OptionBuilder.withDescription(consumerKeyMsg); Option consumerKey = OptionBuilder.create(APPLICATION_KEY_OPTION); opts.addOption(consumerKey); String idMsg = "ID of the users to whom a message is to be sent (separated by comma)."; OptionBuilder.withArgName("id"); OptionBuilder.hasArg(); OptionBuilder.withDescription(idMsg); Option id = OptionBuilder.create(ID_OPTION); opts.addOption(id); return opts; }
From source file:info.extensiblecatalog.OAIToolkit.importer.CLIProcessor.java
/** * Setup the command line options object * @return the command line options object *///from www .ja v a 2 s . c o m public static Options getCommandLineOptions() { Option convert = new Option("convert", "Flag to convert file(s) with raw MARC records into MARCXML"); OptionBuilder.withArgName("modify"); OptionBuilder.hasArg(); OptionBuilder.withDescription("Flag to modify MARCXML file(s) with XSLT transromation with the" + "given XSLT files before loading into the OAI repository"); Option modify = OptionBuilder.create("modify"); Option load = new Option("load", "Flag to load file(s) into the OAI repository"); Option production = new Option("production", "Flag to switch production mode. It means, that the" + "toolkit won't create any temporary files (except error" + " records) so it read MARC records, process it, and put " + "directly to the database or the target file format [DEPRECATED: OPTION IS NO LONGER AVAILABLE]"); OptionBuilder.withArgName("source"); OptionBuilder.hasArg(); OptionBuilder.withDescription("The directory where the toolkit looks " + "for files to process"); Option source = OptionBuilder.create("source"); OptionBuilder.withArgName("destination"); OptionBuilder.hasArg(); OptionBuilder.withDescription("The directory that the toolkit moves the source files into " + "as it successfully completes the processing of each file."); Option destination = OptionBuilder.create("destination"); OptionBuilder.withArgName("destination_xml"); OptionBuilder.hasArg(); OptionBuilder .withDescription("The directory that the toolkit places " + "MARCXML versions of the source data."); Option destination_xml = OptionBuilder.create("destination_xml"); OptionBuilder.withArgName("destination_modifiedxml"); OptionBuilder.hasArg(); OptionBuilder.withDescription( "The directory that the toolkit places " + "modified MARCXML versions of the source data."); Option destination_modifiedxml = OptionBuilder.create("destination_modifiedxml"); OptionBuilder.withArgName("error"); OptionBuilder.hasArg(); OptionBuilder.withDescription("The directory that the toolkit moves files into when " + "there is a processing error for that file."); Option error = OptionBuilder.create("error"); OptionBuilder.hasArg(); OptionBuilder.withArgName("error_xml"); OptionBuilder.withDescription("The directory that the toolkit places MARCXML versions of " + "the source data, if that MARCXML file was unable to be " + "loaded into the OAI repository due to an error condition."); Option error_xml = OptionBuilder.create("error_xml"); OptionBuilder.hasArg(); OptionBuilder.withArgName("error_modifiedxml"); OptionBuilder.withDescription("The directory that the toolkit places MARCXML versions of " + "the source data, if that MARCXML file was unable to be " + "loaded into the OAI repository due to an error condition."); Option error_modifiedxml = OptionBuilder.create("error_modifiedxml"); OptionBuilder.withArgName("log"); OptionBuilder.hasArg(); OptionBuilder.withDescription("The directory of log files for " + "warnings and errors"); Option log = OptionBuilder.create("log"); Option log_detail = new Option("log_detail", "Flag to offer more detailed processing log information"); OptionBuilder.withArgName("marc_schema"); OptionBuilder.hasArg(); OptionBuilder.withDescription("XML Schema file for MARCXML validation"); Option marc_schema = OptionBuilder.create("marc_schema"); OptionBuilder.withArgName("marc_encoding"); OptionBuilder.hasArg(); OptionBuilder.withDescription("The encoding of the MARC file"); Option marc_encoding = OptionBuilder.create("marc_encoding"); OptionBuilder.withArgName("char_conversion"); OptionBuilder.hasArg(); OptionBuilder.withDescription( "The character conversion method. " + "Possible values: MARC8 (Ansel), ISO5426, ISO6937, none"); Option char_conversion = OptionBuilder.create("char_conversion"); OptionBuilder.withArgName("split_size"); OptionBuilder.hasArg(); OptionBuilder.withDescription("How many records can an XML file" + " contain?"); Option split_size = OptionBuilder.create("split_size"); OptionBuilder.withArgName("lucene_index"); OptionBuilder.hasArg(); OptionBuilder.withDescription("Lucene index directory."); Option lucene_index = OptionBuilder.create("lucene_index"); //OptionBuilder.withArgName("storage_type"); //OptionBuilder.hasArg(); //OptionBuilder.withDescription("The storage type of records: MySQL," + //" mixed, Lucene."); //Option storage_type = OptionBuilder.create("storage_type"); Option indent_xml = new Option("indent_xml", "Flag to indent XML"); Option xml_version_11 = new Option("xml_version_11", "Flag to create XML 1.1 instead of 1.0"); Option translate_leader_bad_chars_to_zero = new Option("translate_leader_bad_chars_to_zero", "Change the Bad characters in the leader to zeros"); Option translate_nonleader_bad_chars_to_spaces = new Option("translate_nonleader_bad_chars_to_spaces", "Change the Bad characters in the control and the data fields to spaces"); Option modify_validation = new Option("modify_validation", "Perform validation check during modify step"); OptionBuilder.withArgName("replace_repository_code"); OptionBuilder.hasArg(); OptionBuilder.withDescription("Replace repository code."); Option replace_repository_code = OptionBuilder.create("replace_repository_code"); OptionBuilder.withArgName("convert_dir"); OptionBuilder.hasArg(); OptionBuilder.withDescription("The directory of marc files after " + "process."); Option convert_dir = OptionBuilder.create("convert_dir"); Option fileof_deleted_records = new Option("fileof_deleted_records", "The source marc file should be considered as deleted"); Option lucene_statistics = new Option("lucene_statistics", "Statistics for Lucene Database"); Option lucene_dump_ids = new Option("lucene_dump_ids", "List all ids (001s) to standard output"); OptionBuilder.withArgName("load_dir"); OptionBuilder.hasArg(); OptionBuilder.withDescription("The directory of marcxml files after" + " process."); Option load_dir = OptionBuilder.create("load_dir"); OptionBuilder.withArgName("modify_dir"); OptionBuilder.hasArg(); OptionBuilder.withDescription("The directory of modified marcxml " + "files after process."); Option modify_dir = OptionBuilder.create("modify_dir"); OptionBuilder.withArgName("error_suffix"); OptionBuilder.hasArg(); OptionBuilder.withDescription("The suffix of directory name of error" + " files after process."); Option error_suffix = OptionBuilder.create("error_suffix"); OptionBuilder.withArgName("destination_suffix"); OptionBuilder.hasArg(); OptionBuilder.withDescription("The suffix of directory name of files" + " after process."); Option destination_suffix = OptionBuilder.create("destination_suffix"); OptionBuilder.withArgName("default_repository_code"); OptionBuilder.hasArg(); OptionBuilder.withDescription("The default value of " + "repository code (field 003)."); Option default_repository_code = OptionBuilder.create("default_repository_code"); Option delete = new Option("delete", "Delete temporary files?"); Option ignore_repository_code = new Option("ignore_repository_code", "Do not merge 003 and 001 together."); Option help = new Option("help", "list available options"); Options options = new Options(); options.addOption(production); options.addOption(convert); options.addOption(modify); options.addOption(load); options.addOption(source); options.addOption(destination); options.addOption(destination_xml); options.addOption(error); options.addOption(error_xml); options.addOption(log); options.addOption(log_detail); options.addOption(marc_schema); options.addOption(marc_encoding); options.addOption(char_conversion); options.addOption(split_size); options.addOption(lucene_index); //options.addOption(storage_type); options.addOption(indent_xml); options.addOption(xml_version_11); options.addOption(translate_leader_bad_chars_to_zero); options.addOption(modify_validation); options.addOption(translate_nonleader_bad_chars_to_spaces); options.addOption(fileof_deleted_records); options.addOption(lucene_statistics); options.addOption(lucene_dump_ids); options.addOption(replace_repository_code); options.addOption(convert_dir); options.addOption(load_dir); options.addOption(modify_dir); options.addOption(error_suffix); options.addOption(destination_suffix); options.addOption(delete); options.addOption(destination_modifiedxml); options.addOption(error_modifiedxml); options.addOption(default_repository_code); options.addOption(ignore_repository_code); options.addOption(help); return options; }
From source file:edu.harvard.med.lincs.screensaver.io.libraries.ReagentAttachmentImporter.java
@SuppressWarnings("static-access") public ReagentAttachmentImporter(String[] cmdLineArgs) { super(cmdLineArgs); String[] option = OPTION_INPUT_FILE; addCommandLineOption(OptionBuilder.hasArg().isRequired().withArgName(option[ARG_INDEX]) .withDescription(option[DESCRIPTION_INDEX]).withLongOpt(option[LONG_OPTION_INDEX]) .create(option[SHORT_OPTION_INDEX])); option = OPTION_INPUT_FACILITY_ID;/* w w w .j a va 2s . c o m*/ addCommandLineOption(OptionBuilder.hasArg().isRequired().withArgName(option[ARG_INDEX]) .withDescription(option[DESCRIPTION_INDEX]).withLongOpt(option[LONG_OPTION_INDEX]) .create(option[SHORT_OPTION_INDEX])); option = OPTION_INPUT_SALT_ID; addCommandLineOption(OptionBuilder.hasArg().isRequired().withArgName(option[ARG_INDEX]) .withDescription(option[DESCRIPTION_INDEX]).withLongOpt(option[LONG_OPTION_INDEX]) .create(option[SHORT_OPTION_INDEX])); option = OPTION_INPUT_BATCH_ID; addCommandLineOption(OptionBuilder.hasArg().isRequired().withArgName(option[ARG_INDEX]) .withDescription(option[DESCRIPTION_INDEX]).withLongOpt(option[LONG_OPTION_INDEX]) .create(option[SHORT_OPTION_INDEX])); option = OPTION_INPUT_QC_ATTACMENT_TYPE; addCommandLineOption(OptionBuilder.hasArg().isRequired().withArgName(option[ARG_INDEX]) .withDescription(option[DESCRIPTION_INDEX]).withLongOpt(option[LONG_OPTION_INDEX]) .create(option[SHORT_OPTION_INDEX])); }
From source file:com.github.joemcintyre.pdffinish.Main.java
/** * Populate command line options, making available for command line * processing and usage message functions. *//*from w ww .j av a 2s .co m*/ private static void populateOptions() { options = new Options(); options.addOption("s", "show", false, "Show PDF metadata and ToC"); options.addOption("v", "version", false, "Show version number"); options.addOption("h", "help", false, "Print this message"); OptionBuilder.withArgName("inputFile"); OptionBuilder.hasArg(); OptionBuilder.withDescription("input PDF file"); options.addOption(OptionBuilder.create("i")); OptionBuilder.withArgName("outputFile"); OptionBuilder.hasArg(); OptionBuilder.withDescription("output PDF file"); options.addOption(OptionBuilder.create("o")); OptionBuilder.withArgName("configFile"); OptionBuilder.hasArg(); OptionBuilder.withDescription("configuration file (JSON)"); options.addOption(OptionBuilder.create("c")); }
From source file:chibi.gemmaanalysis.MetaLinkFinderCli.java
@SuppressWarnings("static-access") @Override// ww w .j av a 2 s. co m protected void buildOptions() { Option writeLinkMatrixo = OptionBuilder.withDescription( "Giving this option will generate the new link matrix, Otherwise reading the link matrix from file") .withLongOpt("linkMatrix").create('l'); addOption(writeLinkMatrixo); Option writeTree = OptionBuilder.withDescription( "Giving this option will generate the new clustering tree, Otherwise reading the tree from file") .withLongOpt("clusteringTree").create('c'); addOption(writeTree); Option matrixFileo = OptionBuilder.hasArg().withArgName("Bit Matrixfile").isRequired() .withDescription("The file for saving bit matrix").withLongOpt("matrixfile").create('m'); addOption(matrixFileo); Option mapFile = OptionBuilder.hasArg().withArgName("Expression Experiment Map File").isRequired() .withDescription("The File for Saving the Expression Experiment Mapping").withLongOpt("mapfile") .create('e'); addOption(mapFile); Option treeFileo = OptionBuilder.hasArg().withArgName("Clustering Tree File").isRequired() .withDescription("The file for saving clustering tree").withLongOpt("treefile").create('t'); addOption(treeFileo); Option specieso = OptionBuilder.hasArg().withArgName("The name of the species").isRequired() .withDescription("The name of the species").withLongOpt("species").create('s'); addOption(specieso); }
From source file:com.google.code.stackexchange.client.examples.BadgesApiExample.java
/** * Builds the options./*from ww w. ja v a 2s . c om*/ * * @return the options */ private static Options buildOptions() { Options opts = new Options(); String helpMsg = "Print this message."; Option help = new Option(HELP_OPTION, helpMsg); opts.addOption(help); String consumerKeyMsg = "You API Key."; OptionBuilder.withArgName("key"); OptionBuilder.hasArg(); OptionBuilder.withDescription(consumerKeyMsg); Option consumerKey = OptionBuilder.create(APPLICATION_KEY_OPTION); opts.addOption(consumerKey); String siteNameMsg = "Your site name."; OptionBuilder.withArgName("site"); OptionBuilder.hasArg(); OptionBuilder.withDescription(siteNameMsg); Option siteName = OptionBuilder.create(STACK_EXCHANGE_SITE); opts.addOption(siteName); return opts; }
From source file:de.clusteval.data.dataset.generator.QiuJoeCovarianceClusterDataSetGenerator.java
@Override protected Options getOptions() { Options options = new Options(); OptionBuilder.withArgName("n"); OptionBuilder.isRequired();/* ww w . j av a2 s. com*/ OptionBuilder.hasArg(); OptionBuilder.withDescription("The number of points."); Option option = OptionBuilder.create("n"); options.addOption(option); OptionBuilder.withDescription("Make the cluster sizes different."); option = OptionBuilder.create("sizes"); options.addOption(option); OptionBuilder.withArgName("k"); OptionBuilder.isRequired(); OptionBuilder.hasArg(); OptionBuilder.withDescription("The number of clusters."); option = OptionBuilder.create("k"); options.addOption(option); OptionBuilder.withArgName("noisyfeatures"); OptionBuilder.isRequired(); OptionBuilder.hasArg(); OptionBuilder.withDescription("The number of noisy features."); option = OptionBuilder.create("dn"); options.addOption(option); OptionBuilder.withArgName("features"); OptionBuilder.isRequired(); OptionBuilder.hasArg(); OptionBuilder.withDescription("The number of non-noisy (clustered/separated) features."); option = OptionBuilder.create("d"); options.addOption(option); OptionBuilder.withArgName("clusterSeparation"); OptionBuilder.isRequired(); OptionBuilder.hasArg(); OptionBuilder.withDescription("The cluster separation (between -1.0 and +1.0)."); option = OptionBuilder.create("s"); options.addOption(option); return options; }
From source file:de.clusteval.data.dataset.generator.Gaussian2DDataSetGenerator.java
@Override public Options getOptions() { Options options = new Options(); // init valid command line options OptionBuilder.withArgName("radius"); OptionBuilder.hasArg(); OptionBuilder.withDescription("The radius of the circle on which the gaussians are located."); Option option = OptionBuilder.create("r"); options.addOption(option);//from w w w.j a v a 2 s .c o m OptionBuilder.withArgName("sd"); OptionBuilder.hasArg(); OptionBuilder.withDescription("The standard deviation of the gaussians."); option = OptionBuilder.create("sd"); options.addOption(option); OptionBuilder.withArgName("n"); OptionBuilder.hasArg(); OptionBuilder.withDescription("The number of points."); option = OptionBuilder.create("n"); options.addOption(option); OptionBuilder.withArgName("cl"); OptionBuilder.hasArg(); OptionBuilder.withDescription("The number of gaussians."); option = OptionBuilder.create("cl"); options.addOption(option); options.addOption(option); return options; }