Options options = new Options(); Option option = new Option("c", "c desc"); // Set option c to take 1 to oo arguments option.setArgs(Option.UNLIMITED_VALUES); options.addOption(option);
opts.addOption(JOYConstants.SHELL_ARGS, true, "Command line args for the shell script." + "Multiple args can be separated by empty space."); opts.getOption(JOYConstants.SHELL_ARGS).setArgs(Option.UNLIMITED_VALUES); opts.addOption(JOYConstants.SHELL_ENV, true, "Environment for shell script. Specified as env_key=env_val pairs"); opts.addOption(JOYConstants.SHELL_CMD_PRIORITY, true, "Priority for the shell command containers");
@Test public void test31148() throws ParseException { Option multiArgOption = new Option("o","option with multiple args"); multiArgOption.setArgs(1); Options options = new Options(); options.addOption(multiArgOption); Parser parser = new PosixParser(); String[] args = new String[]{}; Properties props = new Properties(); props.setProperty("o","ovalue"); CommandLine cl = parser.parse(options,args,props); assertTrue(cl.hasOption('o')); assertEquals("ovalue",cl.getOptionValue('o')); }
@Test public void testHasArgs() { Option option = new Option("f", null); option.setArgs(0); assertFalse(option.hasArgs()); option.setArgs(1); assertFalse(option.hasArgs()); option.setArgs(10); assertTrue(option.hasArgs()); option.setArgs(Option.UNLIMITED_VALUES); assertTrue(option.hasArgs()); option.setArgs(Option.UNINITIALIZED); assertFalse(option.hasArgs()); }
option.setRequired(required); option.setOptionalArg(optionalArg); option.setArgs(numberOfArgs); option.setType(type); option.setValueSeparator(valuesep);
option = new Option(OPT_JDBC_TO_SFMD, OPT_JDBC_TO_SFMD_L, true, "Converts the JDBC file in the first argument to an SMFD file specified in the second argument."); option.setArgs(2); commandLineOptions.addOption(option);
Options options = new Options(); Option option = new Option("c", "c desc"); // Set option c to take maximum of 10 arguments option.setArgs(10); options.addOption(option);
@Test public void testGetValue() { Option option = new Option("f", null); option.setArgs(Option.UNLIMITED_VALUES); assertEquals("default", option.getValue("default")); assertEquals(null, option.getValue(0)); option.addValueForProcessing("foo"); assertEquals("foo", option.getValue()); assertEquals("foo", option.getValue(0)); assertEquals("foo", option.getValue("default")); }
@Override public Options getOptions() { final Options o = new Options(); secretOption = new Option("s", "secret", true, "specify the instance secret to use"); secretOption.setOptionalArg(false); o.addOption(secretOption); statusOption = new Option("t", "status-type", true, "filter 'print' on the transaction status type(s) {NEW, IN_PROGRESS," + " FAILED_IN_PROGRESS, FAILED, SUCCESSFUL}"); statusOption.setArgs(Option.UNLIMITED_VALUES); statusOption.setOptionalArg(false); o.addOption(statusOption); disablePaginationOpt = new Option("np", "no-pagination", false, "disables pagination of output"); o.addOption(disablePaginationOpt); return o; }
private Option buildOption(Node optionNode) { NamedNodeMap map = optionNode.getAttributes(); String opt = getString(map, "opt", ""); String description = getString(map, "description", ""); String longOpt = getString(map, "longOpt", ""); boolean isRequired = getBoolean(map, "required", false); boolean hasArg = getBoolean(map, "hasArg", false); if(opt.trim().length() == 0 || description.trim().length() == 0) { throw new IllegalArgumentException( "Must specify at least option and description"); } Option option = new Option(opt, description); if (longOpt.trim().length() > 0) { option.setLongOpt(longOpt); } if (isRequired) { option.setRequired(true); } if (hasArg) { option.setArgs(1); } return option; }
infoTypesOption.setArgs(Option.UNLIMITED_VALUES); commandLineOptions.addOption(infoTypesOption);
engine.setArgs(1); engine.setRequired(false); o.addOption(engine); script.setArgs(1); script.setRequired(false); inputGroup.addOption(script); file.setArgs(1); file.setRequired(false); object.setArgs(1); object.setArgName("objectName:methodName"); object.setRequired(false); function.setArgs(1); function.setRequired(false); invokeGroup.addOption(function); args.setArgs(Option.UNLIMITED_VALUES); args.setRequired(false); o.addOption(args); out.setArgs(1); out.setRequired(false); o.addOption(out);
infoTypesOption.setArgs(Option.UNLIMITED_VALUES); commandLineOptions.addOption(infoTypesOption);
infoTypesOption.setArgs(Option.UNLIMITED_VALUES); commandLineOptions.addOption(infoTypesOption);
"create locality groups at table creation"); createTableOptLocalityProps.setArgName("group=col_fam[,col_fam]"); createTableOptLocalityProps.setArgs(Option.UNLIMITED_VALUES); + " scopes are activated."); createTableOptIteratorProps.setArgName("profile[:[all]|[scan[,]][minc[,]][majc]]"); createTableOptIteratorProps.setArgs(Option.UNLIMITED_VALUES);
infoTypesOption.setArgs(Option.UNLIMITED_VALUES); commandLineOptions.addOption(infoTypesOption);
infoTypesOption.setArgs(Option.UNLIMITED_VALUES); commandLineOptions.addOption(infoTypesOption); customDictionariesOption.setArgs(Option.UNLIMITED_VALUES); commandLineOptions.addOption(customDictionariesOption); customRegexesOption.setArgs(Option.UNLIMITED_VALUES); commandLineOptions.addOption(customRegexesOption);
@Override protected void addAdditionalOptions(final Options options) { final Option option = new Option(FLAG_TIMESTAMPS_PARAMETER, "timestamps", true, "List of timestamps (UTC timezone) to convert"); option.setArgName("timestamp1 ... timestampN"); option.setRequired(false); option.setArgs(Option.UNLIMITED_VALUES); options.addOption(option); }
/** Constructs option group containing options required by all drivable jobs */ private static OptionGroup constructStartOptionGroup() { @SuppressWarnings("static-access") Option workflowFileOption = OptionBuilder.withLongOpt(WORKFLOW_FILE_OPTION) .withDescription("Local file describing workflow").create(); workflowFileOption.setArgs(1); workflowFileOption.setArgName("workflowFile"); OptionGroup group = new OptionGroup(); group.addOption(workflowFileOption); return group; }