Example usage for org.apache.commons.cli Options addOptionGroup

List of usage examples for org.apache.commons.cli Options addOptionGroup

Introduction

In this page you can find the example usage for org.apache.commons.cli Options addOptionGroup.

Prototype

public Options addOptionGroup(OptionGroup group) 

Source Link

Document

Add the specified option group.

Usage

From source file:org.jalphanode.ui.JalphaNodeCli.java

private Options buildCmdOptions() {

    final OptionGroup optionGroup = new OptionGroup();
    optionGroup.setRequired(true);//from  ww w.j  av  a2 s. c  o  m
    optionGroup.addOption(ComandLineOptions.CONFIG_PATH.getOption());
    optionGroup.addOption(ComandLineOptions.GUI.getOption());
    optionGroup.addOption(ComandLineOptions.HELP.getOption());

    final Options options = new Options();
    options.addOptionGroup(optionGroup);

    return options;
}

From source file:org.javaan.commands.BaseDependencyGraphCommand.java

@Override
public Options buildCommandLineOptions(Options options) {
    options.addOption(StandardOptions.FILTER);
    OptionGroup outputVariations = new OptionGroup();
    outputVariations.addOption(StandardOptions.LEAVES);
    outputVariations.addOption(StandardOptions.DISPLAY_2D_GRAPH);
    options.addOptionGroup(outputVariations);
    options.addOption(StandardOptions.RESOLVE_DEPENDENCIES_IN_CLASS_HIERARCHY);
    options.addOption(StandardOptions.RESOLVE_METHOD_IMPLEMENTATIONS);
    return options;
}

From source file:org.javaan.commands.ListClasses.java

@Override
public Options buildCommandLineOptions(Options options) {
    OptionGroup additionalInformation = new OptionGroup();
    additionalInformation.addOption(StandardOptions.SUPER_TYPES).addOption(StandardOptions.SPECIALIZATIONS)
            .addOption(StandardOptions.INTERFACES).addOption(StandardOptions.METHODS)
            .addOption(StandardOptions.VIRTUAL_METHODS);
    options.addOptionGroup(additionalInformation);
    options.addOption(StandardOptions.FILTER);
    return options;
}

From source file:org.javaan.commands.ListInterfaces.java

@Override
public Options buildCommandLineOptions(Options options) {
    OptionGroup additionalInformation = new OptionGroup();
    additionalInformation.addOption(StandardOptions.SUPER_TYPES).addOption(StandardOptions.SPECIALIZATIONS)
            .addOption(StandardOptions.IMPLEMENTATIONS).addOption(StandardOptions.METHODS)
            .addOption(StandardOptions.VIRTUAL_METHODS);
    options.addOptionGroup(additionalInformation);
    options.addOption(StandardOptions.FILTER);
    return options;
}

From source file:org.jcryptool.commands.core.api.AbstractCommand.java

@SuppressWarnings("static-access")
protected void createInputOptions(Options options) {
    OptionGroup inputMode = new OptionGroup();

    inputMode.addOption(OptionBuilder.withLongOpt(TEXTINPUT_LONG_OPTIONNAME).hasArg(true)
            .withArgName(TEXTINPUT_ARGUMENT1_NAME).withDescription(Messages.AbstractCommand_0)
            .create(TEXTINPUT_OPTIONNAME));

    inputMode.addOption(OptionBuilder.withLongOpt(FILEINPUT_LONG_OPTIONNAME).hasArg(true)
            .withArgName(FILEINPUT_ARGUMENT1_NAME).withDescription(Messages.AbstractCommand_1)
            .create(FILEINPUT_OPTIONNAME));

    inputMode.addOption(OptionBuilder.withLongOpt(EDITORINPUT_LONG_OPTIONNAME).hasArg(false)
            .withDescription(Messages.AbstractCommand_2).create(EDITORINPUT_OPTIONNAME));

    inputMode.setRequired(true);/*from  w ww . j  a v a  2s.  co m*/

    options.addOptionGroup(inputMode);
}

From source file:org.jcryptool.crypto.classic.model.algorithm.ClassicAlgorithmCmd.java

@SuppressWarnings("static-access")
public Options createOptions() {
    Options options = new Options();

    // key input options
    createKeyOptions(options);/*w ww  . ja  v a 2 s . c  o m*/
    // Alphabet input options
    createAlphabetOptions(options);
    // Option not to filter nonalphabetic characters (if option is set, filtering does NOT occur) -> filtering by default. 
    options.addOption(OptionBuilder.withLongOpt(NOFILTER_LONG_OPTIONNAME).hasArg( //$NON-NLS-1$
            false).withDescription(Messages.ClassicAlgorithmCmd_filteroption).create(NOFILTER_OPTIONNAME)); //$NON-NLS-1$

    // Encoding or decoding options group:

    OptionGroup codingMode = new OptionGroup();
    codingMode.addOption(OptionBuilder.withLongOpt(MODEENCRYPTION_LONG_OPTIONNAME).hasArg( //$NON-NLS-1$
            false).withDescription(Messages.ClassicAlgorithmCmd_encryptMode).create(MODEENCRYPTION_OPTIONNAME)); //$NON-NLS-1$
    codingMode.addOption(OptionBuilder.withLongOpt(MODEDECRYPTION_LONG_OPTIONNAME).hasArg( //$NON-NLS-1$
            false).withDescription(Messages.ClassicAlgorithmCmd_decryptMode).create(MODEDECRYPTION_OPTIONNAME)); //$NON-NLS-1$
    codingMode.setRequired(true);
    options.addOptionGroup(codingMode);

    // Text input option group

    createInputOptions(options);

    // other options contributed by subclasses

    createOtherOptions(options);

    return options;
}

From source file:org.jcryptool.crypto.classic.xor.algorithm.XorCmd.java

@SuppressWarnings("static-access")
@Override//from w  w w .  j  av  a2 s . c o  m
protected void createKeyOptions(Options options) {
    OptionGroup keyGrp = new OptionGroup();
    keyGrp.addOption(OptionBuilder.withLongOpt("key").hasArg(true) //$NON-NLS-1$
            .withArgName("KEY").withDescription( //$NON-NLS-1$
                    Messages.XorCmd_keyDetailsString)
            .create("k")); //$NON-NLS-1$
    keyGrp.addOption(OptionBuilder.withLongOpt("keyFile").hasArg(true) //$NON-NLS-1$
            .withArgName("KEYFILE").withDescription( //$NON-NLS-1$
                    Messages.XorCmd_keyDetailsFilepath)
            .create("kFile")); //$NON-NLS-1$
    options.addOptionGroup(keyGrp);
}

From source file:org.jhub1.agent.run.cli.ParamsProcessorIQ.java

@Override
protected Options getOptions() {
    Options optionsIQ = new Options();
    Option q = getOption("q");
    q.setRequired(true);//from   w  ww. jav  a  2s. co  m
    optionsIQ.addOption(q);
    OptionGroup groupIQoperation = new OptionGroup();
    groupIQoperation.addOption(getOption("of"));
    groupIQoperation.addOption(getOption("po"));
    optionsIQ.addOptionGroup(groupIQoperation);
    OptionGroup groupIQtarget = new OptionGroup();
    groupIQtarget.addOption(getOption("in"));
    groupIQtarget.addOption(getOption("out"));
    optionsIQ.addOptionGroup(groupIQtarget);
    return optionsIQ;
}

From source file:org.jhub1.agent.run.cli.ParamsProcessorSample.java

@Override
protected Options getOptions() {
    Options optionsSamples = new Options();
    Option s = getOption("s");
    s.setRequired(true);//from w w  w.  ja  v  a 2 s  .c  o m
    optionsSamples.addOption(s);
    optionsSamples.addOption(getOption("n"));
    optionsSamples.addOption(getOption("v"));
    optionsSamples.addOption(getOption("t"));
    optionsSamples.addOption(getOption("g"));

    OptionGroup groupSampleMain = new OptionGroup();
    groupSampleMain.addOption(getOption("r"));
    groupSampleMain.addOption(getOption("p"));
    optionsSamples.addOptionGroup(groupSampleMain);

    return optionsSamples;
}

From source file:org.linqs.psl.cli.Launcher.java

private static Options setupOptions() {
    Options options = new Options();

    OptionGroup mainCommand = new OptionGroup();

    mainCommand.addOption(Option.builder(OPERATION_INFER).longOpt(OPERATION_INFER_LONG)
            .desc("Run MAP inference."
                    + " You can optionally supply a fully qualified name for an inference application"
                    + " (defaults to " + DEFAULT_IA + ").")
            .hasArg().argName("inferenceMethod").optionalArg(true).build());

    mainCommand.addOption(Option.builder(OPERATION_LEARN).longOpt(OPERATION_LEARN_LONG)
            .desc("Run weight learning."
                    + " You can optionally supply a fully qualified name for a weight learner"
                    + " (defaults to " + DEFAULT_WLA + ").")
            .hasArg().argName("learner").optionalArg(true).build());

    // Make sure that help and version are in the main group so a successful run can use them.

    mainCommand.addOption(Option.builder(OPTION_HELP).longOpt(OPTION_HELP_LONG)
            .desc("Print this help message and exit").build());

    mainCommand.addOption(Option.builder(OPTION_VERSION).longOpt(OPTION_VERSION_LONG)
            .desc("Print the PSL version and exit").build());

    mainCommand.setRequired(true);/*from   www .jav  a 2  s .c  o m*/
    options.addOptionGroup(mainCommand);

    options.addOption(Option.builder(OPTION_DATA).longOpt(OPTION_DATA_LONG).desc("Path to PSL data file")
            .hasArg().argName("path").build());

    options.addOption(Option.builder().longOpt(OPTION_DB_H2_PATH)
            .desc("Path for H2 database file (defaults to 'cli_<user name>@<host name>' ('" + DEFAULT_H2_DB_PATH
                    + "'))." + " Not compatible with the '--" + OPTION_DB_POSTGRESQL_NAME + "' option.")
            .hasArg().argName("path").build());

    options.addOption(Option.builder().longOpt(OPTION_DB_POSTGRESQL_NAME)
            .desc("Name for the PostgreSQL database to use (defaults to " + DEFAULT_POSTGRES_DB_NAME + ")."
                    + " Not compatible with the '--" + OPTION_DB_H2_PATH + "' option."
                    + " Currently only local databases without credentials are supported.")
            .hasArg().argName("name").optionalArg(true).build());

    options.addOption(Option.builder(OPTION_EVAL).longOpt(OPTION_EVAL_LONG)
            .desc("Run the named evaluator (" + Evaluator.class.getName()
                    + ") on any open predicate with a 'truth' partition.")
            .hasArg().argName("evaluator").build());

    options.addOption(Option.builder(OPTION_INT_IDS).longOpt(OPTION_INT_IDS_LONG)
            .desc("Use integer identifiers (UniqueIntID) instead of string identifiers (UniqueStringID).")
            .build());

    options.addOption(Option.builder(OPTION_LOG4J).longOpt(OPTION_LOG4J_LONG)
            .desc("Optional log4j properties file path").hasArg().argName("path").build());

    options.addOption(Option.builder(OPTION_MODEL).longOpt(OPTION_MODEL_LONG).desc("Path to PSL model file")
            .hasArg().argName("path").build());

    options.addOption(Option.builder(OPTION_OUTPUT_DIR).longOpt(OPTION_OUTPUT_DIR_LONG)
            .desc("Optional path for writing results to filesystem (default is STDOUT)").hasArg()
            .argName("path").build());

    options.addOption(Option.builder(OPTION_PROPERTIES_FILE).longOpt(OPTION_PROPERTIES_FILE_LONG)
            .desc("Optional PSL properties file path").hasArg().argName("path").build());

    options.addOption(Option.builder(OPTION_PROPERTIES).argName("name=value")
            .desc("Directly specify PSL properties (overrides options set via --" + OPTION_PROPERTIES_FILE_LONG
                    + ")."
                    + " See https://github.com/linqs/psl/wiki/Configuration-Options for a list of available options."
                    + " Log4j properties (properties starting with 'log4j') will be passed to the logger."
                    + " 'log4j.threshold=DEBUG', for example, will be passed to log4j and set the global logging threshold.")
            .hasArg().numberOfArgs(2).valueSeparator('=').build());

    return options;
}