List of usage examples for org.apache.commons.cli Option setLongOpt
public void setLongOpt(String longOpt)
From source file:fr.inria.atlanmod.emf.graphs.Connectedness.java
/** * Creates the program options//from w ww.ja v a 2 s .co m * * @param options * @return */ private static Options createOptions() { Options options = new Options(); Option inputMetamodelOpt = OptionBuilder.create(INPUT_METAMODEL); inputMetamodelOpt.setLongOpt(INPUT_METAMODEL_LONG); inputMetamodelOpt.setArgName("source.ecore"); inputMetamodelOpt.setDescription("Path of the source metamodel file"); inputMetamodelOpt.setArgs(1); inputMetamodelOpt.setRequired(true); Option inputModelOpt = OptionBuilder.create(INPUT_MODEL); inputModelOpt.setLongOpt(INPUT_MODEL_LONG); inputModelOpt.setArgName("input.xmi"); inputModelOpt.setDescription("Path of the input file"); inputModelOpt.setArgs(1); inputModelOpt.setRequired(true); Option logUnreachableOpt = OptionBuilder.create(LOG_UNREACHABLE); logUnreachableOpt.setLongOpt(LOG_UNREACHABLE_LONG); logUnreachableOpt.setDescription("Log information about unreachable objects"); logUnreachableOpt.setArgs(0); logUnreachableOpt.setRequired(false); options.addOption(inputMetamodelOpt); options.addOption(inputModelOpt); options.addOption(logUnreachableOpt); return options; }
From source file:com.octo.mbo.CopyNotes.java
static CommandLine parseCommandLine(String[] args) throws CommandLineException { Options options = new Options(); Option optSource = new Option("s", "Source file where the comments can be extracted (only pptx format supported)"); optSource.setRequired(true);// ww w . j a va2 s . co m optSource.setArgs(1); optSource.setLongOpt("source"); options.addOption(optSource); Option optTarget = new Option("t", "Target file where the comments are merged (case of pptx format)"); optTarget.setRequired(true); optTarget.setArgs(1); optTarget.setLongOpt("target"); options.addOption(optTarget); HelpFormatter formatter = new HelpFormatter(); final String header = "CopyNotes allows to extract, copy and merge notes of pptx files. \n" + "Notes can be merged with the notes of an existing files \n" + "Notes can be exported to a xml file with a custom format or imported \n" + "from this xml format and merged into an existing pptx document. \n" + "The target file is updated \n"; final String footer = ""; CommandLineParser cliParser = new DefaultParser(); try { return cliParser.parse(options, args); } catch (MissingOptionException mex) { log.error(mex.getMessage()); log.debug("Error parsing command line", mex); formatter.printHelp( "java -jar copypptxnotes-<version>-jar-with-dependencies.jar -s <source> -t <target>", header, options, footer); throw new CommandLineException("Missing option", mex); } catch (ParseException pex) { log.debug("Error parsing the command line. Please use CopyComment --help", pex); formatter.printHelp( "java -jar copypptxnotes-<version>-jar-with-dependencies.jar -s <source> -t <target>", header, options, footer); throw new CommandLineException("Parse Exception", pex); } }
From source file:com.dobrunov.zktreeutil.zkTreeUtilMain.java
public static Options initOptions() { Options options = new Options(); options.addOption("e", "export", false, "exports the zookeeper tree"); Option outdir = OptionBuilder.withArgName("dir").hasArg().withDescription( "output directory to which znode information should be written (must be a normal, empty directory)") .create("od"); outdir.setLongOpt("output-dir"); options.addOption(outdir);/*w ww. j av a2s . com*/ Option plainfile = OptionBuilder.withArgName("filename").hasArg() .withDescription("output file to which znode information should be written").create("of"); plainfile.setLongOpt("output-file"); options.addOption(plainfile); Option xmlfile = OptionBuilder.withArgName("filename").hasArg() .withDescription("output xml-file to which znode information should be written").create("ox"); xmlfile.setLongOpt("output-xmlfile"); options.addOption(xmlfile); Option znodepath = OptionBuilder.withArgName("znodepath").hasArg() .withDescription("path to the zookeeper subtree rootnode.").create("p"); znodepath.setLongOpt("path"); options.addOption(znodepath); Option server = OptionBuilder.withArgName("zkhosts").hasArg().isRequired(true) .withDescription("zookeeper remote servers (ie \"localhost:2181\")").create("z"); server.setLongOpt("zookeeper"); options.addOption(server); return options; }
From source file:edu.wisc.my.portlets.dmp.tools.XmlMenuPublisherRunner.java
/** * Set up the command line options//from w w w. java 2s . c o m */ private static Options setupOptions() { final Options opts = new Options(); final Option xmlSource = new Option(XML_FILE_OPT, true, "The relative or absolute file system location of the menu XML document."); xmlSource.setRequired(true); xmlSource.setArgs(1); xmlSource.setArgName("path"); xmlSource.setLongOpt("menuXmlFile"); opts.addOption(xmlSource); return opts; }
From source file:lee.util.jtap.JTapCli.java
public static Options constructOptions() { final Options options = new Options(); options.addOption("h", false, "Print help for this application"); options.addOption("dumpkeys", false, "Dumps keys for the specified bucket"); options.addOption("dumpall", false, "Dumps keys and values for the specified bucket"); Option session = OptionBuilder.withArgName("host,bucket,[password,port]").hasArg() .withDescription("host address of membase server, bucket name and optional port if not default.") .create("s"); session.setLongOpt("session"); session.setValueSeparator(','); session.setArgs(4);/*w w w . j a v a 2s . c om*/ options.addOption(session); Option deleteKey = OptionBuilder.withArgName("key").hasArg().withDescription("key to be deleted.") .create("dk"); deleteKey.setLongOpt("deletekey"); options.addOption(deleteKey); Option getKey = OptionBuilder.withArgName("key").hasArg().withDescription("key to be retrieved.") .create("gk"); getKey.setLongOpt("getkey"); options.addOption(getKey); options.addOption("cs", "clearsession", false, "Clear session info from drive."); return options; }
From source file:at.ac.tuwien.ims.latex2mobiformulaconv.app.Main.java
private static void initializeOptions() { options = new Options(); Option inputOption = new Option("i", "inputPaths", true, "inputPaths file"); inputOption.setRequired(true);/*from w ww . j av a 2 s . c om*/ inputOption.setArgs(Option.UNLIMITED_VALUES); inputOption.setOptionalArg(false); inputOption.setValueSeparator(','); options.addOption(inputOption); options.addOption("f", "filename", true, "output filename"); options.addOption("o", "output-dir", true, "output directory"); options.addOption("m", "export-markup", false, "export html markup"); options.addOption("n", "no-mobi", false, "no Mobi conversion, just markup, NOTE: makes -m implicit!"); options.addOption("t", "title", true, "Document title"); options.addOption("h", "help", false, "show this help"); options.addOption("d", "debugMarkupOutput", false, "show debug output in html markup"); options.addOption("u", "use-calibre", false, "use calibre ebook-convert instead of kindlegen"); Option picturesOption = new Option("r", "replace latex formulas with pictures, override html"); picturesOption.setLongOpt("replace-with-images"); picturesOption.setArgs(0); picturesOption.setRequired(false); options.addOption(picturesOption); // implementation specific options options.addOption( ((LatexToHtmlConverter) applicationContext.getBean("latex2html-converter")).getExecOption()); options.addOption( ((HtmlToMobiConverter) applicationContext.getBean(KINDLEGEN_HTML2MOBI_CONVERTER)).getExecOption()); options.addOption( ((HtmlToMobiConverter) applicationContext.getBean(CALIBRE_HTML2MOBI_CONVERTER)).getExecOption()); }
From source file:fr.inria.atlanmod.dag.instantiator.Launcher.java
/** * Configures the program options//from ww w . ja v a2s. co m * * @param options */ private static void configureOptions(Options options) { Option outDirOpt = OptionBuilder.create(OUTPUT_PATH); outDirOpt.setLongOpt(OUTPUT_PATH_LONG); outDirOpt.setArgName("neoEMF output uri"); outDirOpt.setDescription("Output directory (defaults to working dir)"); outDirOpt.setArgs(1); outDirOpt.setRequired(true); Option nModelsOpt = OptionBuilder.create(N_MODELS); nModelsOpt.setLongOpt(N_MODELS_LONG); nModelsOpt.setArgName("models"); nModelsOpt.setDescription("Number of generated models (defaults to 1)"); nModelsOpt.setType(Number.class); nModelsOpt.setArgs(1); Option sizeOption = OptionBuilder.create(SIZE); sizeOption.setLongOpt(SIZE_LONG); sizeOption.setArgName("size"); sizeOption.setDescription(MessageFormat.format("Average models'' size (defaults to {0})", Launcher.DEFAULT_AVERAGE_MODEL_SIZE)); sizeOption.setType(Number.class); sizeOption.setArgs(1); Option densityOption = OptionBuilder.create(VARIATION); densityOption.setLongOpt(VARIATION_LONG); densityOption.setArgName("proportion"); densityOption.setDescription(MessageFormat .format("Variation ([0..1]) in the models'' size (defaults to {0})", Launcher.DEFAULT_DEVIATION)); densityOption.setType(Number.class); densityOption.setArgs(1); Option propVariationOption = OptionBuilder.create(PROP_VARIATION); propVariationOption.setLongOpt(PROP_VARIATION_LONG); propVariationOption.setArgName("properties deviation"); propVariationOption.setDescription(MessageFormat.format( "Variation ([0..1]) in the properties'' size (defaults to {0})", Launcher.DEFAULT_DEVIATION)); propVariationOption.setType(Number.class); propVariationOption.setArgs(1); Option seedOption = OptionBuilder.create(SEED); seedOption.setLongOpt(SEED_LONG); seedOption.setArgName("seed"); seedOption.setDescription("Seed number (random by default)"); seedOption.setType(Number.class); seedOption.setArgs(1); Option valuesSizeOption = OptionBuilder.create(VALUES_SIZE); valuesSizeOption.setLongOpt(VALUES_SIZE_LONG); valuesSizeOption.setArgName("size"); valuesSizeOption.setDescription(MessageFormat.format( "Average size for attributes with variable length (defaults to {0}). Actual sizes may vary +/- {1}%.", GenericMetamodelConfig.DEFAULT_AVERAGE_VALUES_LENGTH, GenericMetamodelConfig.DEFAULT_VALUES_DEVIATION * 100)); valuesSizeOption.setType(Number.class); valuesSizeOption.setArgs(1); Option degreeOption = OptionBuilder.create(DEGREE); degreeOption.setLongOpt(DEGREE_LONG); degreeOption.setArgName("degree"); degreeOption.setDescription(MessageFormat.format( "Average number of references per EObject (defaults to {0}). Actual sizes may vary +/- {1}%.", GenericMetamodelConfig.DEFAULT_AVERAGE_REFERENCES_SIZE, GenericMetamodelConfig.DEFAULT_REFERENCES_DEVIATION * 100)); degreeOption.setType(Number.class); degreeOption.setArgs(1); Option forceOption = OptionBuilder.create(FORCE); forceOption.setLongOpt(FORCE_LONG); forceOption.setDescription("Force the generation, even if input metamodels contain errors"); Option diagnoseOption = OptionBuilder.create(DIAGNOSE); diagnoseOption.setLongOpt(DIAGNOSE_LONG); diagnoseOption.setDescription("Run diagnosis on the result model"); options.addOption(outDirOpt); options.addOption(nModelsOpt); options.addOption(sizeOption); options.addOption(propVariationOption); options.addOption(valuesSizeOption); options.addOption(degreeOption); options.addOption(seedOption); options.addOption(forceOption); options.addOption(diagnoseOption); options.addOption(densityOption); }
From source file:fr.inria.atlanmod.instantiator.neoEMF.Launcher.java
/** * Configures the program options// ww w .j ava2 s . co m * * @param options */ private static void configureOptions(Options options) { Option metamodelOpt = OptionBuilder.create(E_PACKAGE_CLASS); metamodelOpt.setLongOpt(E_PACKAGE_CLASS_LONG); metamodelOpt.setArgName("path to the ePackage implementation"); metamodelOpt.setDescription("PackgeImpl"); metamodelOpt.setArgs(1); metamodelOpt.setRequired(true); Option outDirOpt = OptionBuilder.create(OUTPUT_PATH); outDirOpt.setLongOpt(OUTPUT_PATH_LONG); outDirOpt.setArgName("neoEMF output uri"); outDirOpt.setDescription("Output directory (defaults to working dir)"); outDirOpt.setArgs(1); outDirOpt.setRequired(true); Option nModelsOpt = OptionBuilder.create(N_MODELS); nModelsOpt.setLongOpt(N_MODELS_LONG); nModelsOpt.setArgName("models"); nModelsOpt.setDescription("Number of generated models (defaults to 1)"); nModelsOpt.setType(Number.class); nModelsOpt.setArgs(1); Option sizeOption = OptionBuilder.create(SIZE); sizeOption.setLongOpt(SIZE_LONG); sizeOption.setArgName("size"); sizeOption.setDescription(MessageFormat.format("Average models'' size (defaults to {0})", Launcher.DEFAULT_AVERAGE_MODEL_SIZE)); sizeOption.setType(Number.class); sizeOption.setArgs(1); Option variationOption = OptionBuilder.create(VARIATION); variationOption.setLongOpt(VARIATION_LONG); variationOption.setArgName("proportion"); variationOption.setDescription(MessageFormat .format("Variation ([0..1]) in the models'' size (defaults to {0})", Launcher.DEFAULT_DEVIATION)); variationOption.setType(Number.class); variationOption.setArgs(1); Option propVariationOption = OptionBuilder.create(PROP_VARIATION); propVariationOption.setLongOpt(PROP_VARIATION_LONG); propVariationOption.setArgName("properties deviation"); propVariationOption.setDescription(MessageFormat.format( "Variation ([0..1]) in the properties'' size (defaults to {0})", Launcher.DEFAULT_DEVIATION)); propVariationOption.setType(Number.class); propVariationOption.setArgs(1); Option seedOption = OptionBuilder.create(SEED); seedOption.setLongOpt(SEED_LONG); seedOption.setArgName("seed"); seedOption.setDescription("Seed number (random by default)"); seedOption.setType(Number.class); seedOption.setArgs(1); Option valuesSizeOption = OptionBuilder.create(VALUES_SIZE); valuesSizeOption.setLongOpt(VALUES_SIZE_LONG); valuesSizeOption.setArgName("size"); valuesSizeOption.setDescription(MessageFormat.format( "Average size for attributes with variable length (defaults to {0}). Actual sizes may vary +/- {1}%.", GenericMetamodelConfig.DEFAULT_AVERAGE_VALUES_LENGTH, GenericMetamodelConfig.DEFAULT_VALUES_DEVIATION * 100)); valuesSizeOption.setType(Number.class); valuesSizeOption.setArgs(1); Option degreeOption = OptionBuilder.create(DEGREE); degreeOption.setLongOpt(DEGREE_LONG); degreeOption.setArgName("degree"); degreeOption.setDescription(MessageFormat.format( "Average number of references per EObject (defaults to {0}). Actual sizes may vary +/- {1}%.", GenericMetamodelConfig.DEFAULT_AVERAGE_REFERENCES_SIZE, GenericMetamodelConfig.DEFAULT_REFERENCES_DEVIATION * 100)); degreeOption.setType(Number.class); degreeOption.setArgs(1); Option forceOption = OptionBuilder.create(FORCE); forceOption.setLongOpt(FORCE_LONG); forceOption.setDescription("Force the generation, even if input metamodels contain errors"); Option diagnoseOption = OptionBuilder.create(DIAGNOSE); diagnoseOption.setLongOpt(DIAGNOSE_LONG); diagnoseOption.setDescription("Run diagnosis on the result model"); options.addOption(metamodelOpt); options.addOption(outDirOpt); options.addOption(nModelsOpt); options.addOption(sizeOption); options.addOption(variationOption); options.addOption(propVariationOption); options.addOption(valuesSizeOption); options.addOption(degreeOption); options.addOption(seedOption); options.addOption(forceOption); options.addOption(diagnoseOption); }
From source file:fr.inria.atlanmod.instantiator.SpecimenGenerator.java
/** * Configures the program options/* w ww . j a v a 2 s. co m*/ * * @param options */ private static void configureOptions(Options options) { Option metamodelOpt = OptionBuilder.create(METAMODEL); metamodelOpt.setLongOpt(METAMODEL_LONG); metamodelOpt.setArgName("path_to_metamodel.ecore"); metamodelOpt.setDescription("Ecore metamodel"); metamodelOpt.setArgs(1); metamodelOpt.setRequired(true); Option additionalMetamodelOpt = OptionBuilder.create(ADDITIONAL_METAMODEL); additionalMetamodelOpt.setLongOpt(ADDITIONAL_METAMODEL_LONG); additionalMetamodelOpt.setArgName("path_to_metamodel.ecore"); additionalMetamodelOpt.setDescription("Additional ecore metamodel(s) that need to be registered"); additionalMetamodelOpt.setArgs(Option.UNLIMITED_VALUES); Option outDirOpt = OptionBuilder.create(OUTPUT_DIR); outDirOpt.setLongOpt(OUTPUT_DIR_LONG); outDirOpt.setArgName("path_to_output.dir"); outDirOpt.setDescription("Output directory (defaults to working dir)"); outDirOpt.setArgs(1); Option nModelsOpt = OptionBuilder.create(N_MODELS); nModelsOpt.setLongOpt(N_MODELS_LONG); nModelsOpt.setArgName("models"); nModelsOpt.setDescription("Number of generated models (defaults to 1)"); nModelsOpt.setType(Number.class); nModelsOpt.setArgs(1); Option sizeOption = OptionBuilder.create(SIZE); sizeOption.setLongOpt(SIZE_LONG); sizeOption.setArgName("size"); sizeOption.setDescription("Models' size (defaults to 1000)"); sizeOption.setType(Number.class); sizeOption.setArgs(1); Option seedOption = OptionBuilder.create(SEED); seedOption.setLongOpt(SEED_LONG); seedOption.setArgName("seed"); seedOption.setDescription("Seed number (random by default)"); seedOption.setType(Number.class); seedOption.setArgs(1); options.addOption(metamodelOpt); options.addOption(additionalMetamodelOpt); options.addOption(outDirOpt); options.addOption(nModelsOpt); options.addOption(sizeOption); options.addOption(seedOption); }
From source file:com.emc.ecs.util.OptionBuilder.java
public Option create(String opt) { // create the option Option option = new Option(opt, description); // set the option properties option.setLongOpt(longOpt); option.setArgs(argNum);/*from w w w. j a v a 2 s.c om*/ option.setValueSeparator(valueSep); option.setArgName(argName); return option; }