List of usage examples for org.apache.commons.cli Option getValueSeparator
public char getValueSeparator()
From source file:com.marklogic.contentpump.utilities.CommandlineOption.java
public CommandlineOption(Option opt) throws IllegalArgumentException { super(opt.getOpt(), opt.hasArg(), opt.getDescription()); this.setLongOpt(opt.getLongOpt()); this.setRequired(opt.isRequired()); this.setArgName(opt.getArgName()); this.setArgs(opt.getArgs()); this.setOptionalArg(opt.hasOptionalArg()); this.setType(opt.getType()); this.setValueSeparator(opt.getValueSeparator()); }
From source file:net.nicholaswilliams.java.licensing.licensor.interfaces.cli.spi.TestCliOptionsBuilder.java
@Test public void testWithValueSeparator() { Option option = this.builder.withValueSeparator().create("test"); assertNotNull("The option should not be null.", option); assertTrue("hasValueSeparator should be true.", option.hasValueSeparator()); assertEquals("getValueSeparator is not correct.", '=', option.getValueSeparator()); }
From source file:net.nicholaswilliams.java.licensing.licensor.interfaces.cli.spi.TestCliOptionsBuilder.java
@Test public void testWithValueSeparatorCharArg() { Option option = this.builder.withValueSeparator(':').create("test"); assertNotNull("The option should not be null.", option); assertTrue("hasValueSeparator should be true.", option.hasValueSeparator()); assertEquals("getValueSeparator is not correct.", ':', option.getValueSeparator()); }
From source file:de.uni_koblenz.ist.utilities.option_handler.OptionHandler.java
/** * Used by the method getUsageString for adding an Option to the String. * /*from ww w. ja v a 2s . com*/ * @param out * The StringBuilder to write into. * @param current * The option to add. */ private void appendOption(StringBuilder out, Option current) { out.append("-"); out.append(current.getOpt()); int numberOfArgs = current.getArgs(); out.append(" "); if (current.hasOptionalArg()) { out.append("["); } if (numberOfArgs == Option.UNLIMITED_VALUES) { appendArgName(out, current); out.append("{"); out.append(current.getValueSeparator()); appendArgName(out, current); out.append("}"); } if (numberOfArgs >= 1) { appendArgName(out, current); for (int i = 1; i < numberOfArgs; i++) { out.append(current.getValueSeparator()); appendArgName(out, current); } } if (current.hasOptionalArg()) { out.append("]"); } }
From source file:org.lib4j.cli.Options.java
public String getOption(final String name) { final Option options = optionNameToOption.get(name); if (options == null || options.getValues().length == 0) return null; if (options.getValues().length == 1) return options.getValues()[0]; return Arrays.stream(options.getValues()).reduce(String.valueOf(options.getValueSeparator()), String::concat);/*from w w w .j ava 2 s . com*/ }
From source file:org.libx4j.cli.Options.java
public String getOption(final String name) { final Option options = optionNameToOption.get(name); return options == null || options.getValues().length == 0 ? null : options.getValues().length == 1 ? options.getValues()[0] : Arrays.toString(options.getValues(), options.getValueSeparator()); }