Java Code Examples for org.apache.commons.cli.Option#setLongOpt()

The following examples show how to use org.apache.commons.cli.Option#setLongOpt() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DBToolOptions.java    From ctsms with GNU Lesser General Public License v2.1 6 votes vote down vote up
private static Option registerTaskOption(String opt, String longOpt, String description, int numArgs, LockId... lockIds) {
	Option option = OptionBuilder.create(opt);
	option.setRequired(false);
	option.setDescription("task: " + description);
	option.setLongOpt(longOpt);
	option.setArgs(numArgs);
	taskOptionMap.put(opt, option);
	LinkedHashSet<LockId> taskLockIdMap = new LinkedHashSet<LockId>();
	if (lockIds != null) {
		for (int i = 0; i < lockIds.length; i++) {
			if (lockIds[i] != null) {
				taskLockIdMap.add(lockIds[i]);
			}
		}
	}
	taskLockIdsMap.put(opt, taskLockIdMap);
	return option;
}
 
Example 2
Source File: PigStorage.java    From spork with Apache License 2.0 6 votes vote down vote up
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(" ", "Overwrites the destination.");
    overwrite.setLongOpt("overwrite");
    overwrite.setOptionalArg(true);
    overwrite.setArgs(1);
    overwrite.setArgName("overwrite");
    validOptions.addOption(overwrite);
    
    return validOptions;
}
 
Example 3
Source File: OptionBuilder.java    From datawave with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 4
Source File: DBToolOptions.java    From ctsms with GNU Lesser General Public License v2.1 5 votes vote down vote up
private static Option registerOptionalOption(String opt, String longOpt, String description, int numArgs) {
	Option option = OptionBuilder.create(opt);
	option.setRequired(false);
	option.setDescription("option: " + description);
	option.setLongOpt(longOpt);
	option.setArgs(numArgs);
	optionalOptionMap.put(opt, option);
	return option;
}
 
Example 5
Source File: ApplicationArguments.java    From bigtable-sql with Apache License 2.0 5 votes vote down vote up
private Option createAnOption(String[] argInfo)
{
	Option opt = new Option(argInfo[0], argInfo[2]);
	if (!isStringEmpty(argInfo[1]))
	{
		opt.setLongOpt(argInfo[1]);
	}

	return opt;
}
 
Example 6
Source File: ApplicationArguments.java    From bigtable-sql with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 7
Source File: CliToolConfig.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
private OptionBuilder(String shortName, String longName) {
    option = new Option(shortName, "");
    option.setLongOpt(longName);
    option.setArgName(longName);
}