Example usage for org.apache.commons.cli PatternOptionBuilder FILE_VALUE

List of usage examples for org.apache.commons.cli PatternOptionBuilder FILE_VALUE

Introduction

In this page you can find the example usage for org.apache.commons.cli PatternOptionBuilder FILE_VALUE.

Prototype

Class FILE_VALUE

To view the source code for org.apache.commons.cli PatternOptionBuilder FILE_VALUE.

Click Source Link

Document

File class

Usage

From source file:de.haber.xmind2latex.cli.CliOptionBuilder.java

@SuppressWarnings("static-access")
/**/*from www .j  a va  2 s .co m*/
 * 
 * @return the CLI options for the XMindToLatex exporter.
 */
protected static Options getOptions() {
    Options o = new Options();

    o.addOption(OptionBuilder.withArgName("input file").withLongOpt("input")
            .withDescription("Required input file name.").hasArg(true).isRequired(false)
            .withType(PatternOptionBuilder.FILE_VALUE).create(INPUT));
    o.addOption(OptionBuilder.withArgName("force").withLongOpt("force")
            .withDescription("Force overwrite existing files (optional).").hasArg(false).isRequired(false)
            .create(FORCE));
    o.addOption(OptionBuilder.withArgName("output file").withLongOpt("output")
            .withDescription("Output file name (optional). Default output file is \"<input file>.tex.\"")
            .hasArg().isRequired(false).withType(PatternOptionBuilder.FILE_VALUE).create(OUTPUT));
    o.addOption(OptionBuilder.withArgName("template level").withLongOpt("template-level")
            .withDescription("Maximal level for template usage.").hasArg().isRequired(false)
            .withType(PatternOptionBuilder.NUMBER_VALUE).create(TEMPLATE_LEVEL));
    o.addOption(OptionBuilder.withArgName("help").withLongOpt("help")
            .withDescription("Prints this help message.").hasArg(false).isRequired(false).create(HELP));
    o.addOption(OptionBuilder.withArgName("level> <start> <end").withLongOpt("env").hasArgs(3)
            .withDescription("Sets the start and end environment templates for the given level (optional). "
                    + "Templates must be either loadable from the classpath with the given full qualified name (no file extension, "
                    + "directories separated by a '.', or as a file (with '.ftl' extension, directories separated by a path separator).")
            .isRequired(false).create(ENVIRONMENT));
    o.addOption(OptionBuilder.withArgName("level> <template").withLongOpt("level-template")
            .withValueSeparator(' ')
            .withDescription("Sets the template that is to be used for the given level (optional). "
                    + "Templates must be either loadable from the classpath with the given full qualified name (no file extension, "
                    + "directories separated by a '.', or as a file (with '.ftl' extension, directories separated by a path separator).")
            .hasArgs(2).isRequired(false).create(LEVEL));
    o.addOption(OptionBuilder.withArgName("version").withLongOpt("version")
            .withDescription("Prints the version.").hasArg(false).isRequired(false).create(VERSION));
    return o;
}

From source file:org.apache.ambari.servicemonitor.clients.BaseClient.java

private void addToolOptions(Options options, boolean confRequired) {
    //conf is required
    Option option = OptionHelper.addStringArgOpt(options, "cf", "conf", "configuration file");
    option.setType(PatternOptionBuilder.FILE_VALUE);
    option.setRequired(confRequired);/*from  w  w w.  ja  va  2s  .c o  m*/
    OptionHelper.addStringArgOpt(options, "fs", "filesystem", "filesystem to use");
    OptionHelper.addStringArgOpt(options, "jt", "jobtracker", "job tracker to connect to");
}