line.append(" "); final int blankSize = line.length() + 2; if(descriptor.isRequired()) { line.append("REQUIRED: ");
/** * Tells whether the given option descriptors contain a "required" option. * * @param options descriptors for the configured options of a parser * @return {@code true} if at least one of the options is "required" */ protected final boolean hasRequiredOption( Collection<? extends OptionDescriptor> options ) { for ( OptionDescriptor each : options ) { if ( each.isRequired() ) return true; } return false; }
/** * Tells whether the given option descriptors contain a "required" option. * * @param options descriptors for the configured options of a parser * @return {@code true} if at least one of the options is "required" */ protected final boolean hasRequiredOption( Collection<? extends OptionDescriptor> options ) { for ( OptionDescriptor each : options ) { if ( each.isRequired() ) return true; } return false; }
private String optionHeader( Map<String, ? extends OptionDescriptor> options ) { for ( OptionDescriptor each : options.values() ) { if ( each.isRequired() ) return "Option (* = required)"; } return "Option"; }
private String optionHeader( Map<String, ? extends OptionDescriptor> options ) { for ( OptionDescriptor each : options.values() ) { if ( each.isRequired() ) return "Option (* = required)"; } return "Option"; }
private String optionHeader( Map<String, ? extends OptionDescriptor> options ) { for ( OptionDescriptor each : options.values() ) { if ( each.isRequired() ) return "Option (* = required)"; } return "Option"; }
private String createOptionDisplay( OptionDescriptor descriptor ) { StringBuilder buffer = new StringBuilder( descriptor.isRequired() ? "* " : "" ); for ( Iterator<String> iter = descriptor.options().iterator(); iter.hasNext(); ) { String option = iter.next(); buffer.append( option.length() > 1 ? DOUBLE_HYPHEN : HYPHEN ); buffer.append( option ); if ( iter.hasNext() ) buffer.append( ", " ); } return buffer.toString(); }
private String createOptionDisplay( OptionDescriptor descriptor ) { StringBuilder buffer = new StringBuilder( descriptor.isRequired() ? "* " : "" ); for ( Iterator<String> iter = descriptor.options().iterator(); iter.hasNext(); ) { String option = iter.next(); buffer.append( option.length() > 1 ? DOUBLE_HYPHEN : HYPHEN ); buffer.append( option ); if ( iter.hasNext() ) buffer.append( ", " ); } return buffer.toString(); }
private String createOptionDisplay( OptionDescriptor descriptor ) { StringBuilder buffer = new StringBuilder( descriptor.isRequired() ? "* " : "" ); for ( Iterator<String> iter = descriptor.options().iterator(); iter.hasNext(); ) { String option = iter.next(); buffer.append( option.length() > 1 ? DOUBLE_HYPHEN : HYPHEN ); buffer.append( option ); if ( iter.hasNext() ) buffer.append( ", " ); } return buffer.toString(); }
/** * <p>Creates a string for how the given option descriptor is to be represented in help.</p> * * <p>This implementation gives a string consisting of the concatenation of:</p> * <ul> * <li>{@code "* "} for "required" options, otherwise {@code ""}</li> * <li>For each of the {@link OptionDescriptor#options()} of the descriptor, separated by {@code ", "}: * <ul> * <li>{@link #optionLeader(String)} of the option</li> * <li>the option</li> * </ul> * </li> * <li>the result of {@link #maybeAppendOptionInfo(StringBuilder, OptionDescriptor)}</li> * </ul> * * @param descriptor a descriptor for a configured option of a parser * @return help string */ protected String createOptionDisplay( OptionDescriptor descriptor ) { StringBuilder buffer = new StringBuilder( descriptor.isRequired() ? "* " : "" ); for ( Iterator<String> i = descriptor.options().iterator(); i.hasNext(); ) { String option = i.next(); buffer.append( optionLeader( option ) ); buffer.append( option ); if ( i.hasNext() ) buffer.append( ", " ); } maybeAppendOptionInfo( buffer, descriptor ); return buffer.toString(); }
/** * <p>Creates a string for how the given option descriptor is to be represented in help.</p> * * <p>This implementation gives a string consisting of the concatenation of:</p> * <ul> * <li>{@code "* "} for "required" options, otherwise {@code ""}</li> * <li>For each of the {@link OptionDescriptor#options()} of the descriptor, separated by {@code ", "}: * <ul> * <li>{@link #optionLeader(String)} of the option</li> * <li>the option</li> * </ul> * </li> * <li>the result of {@link #maybeAppendOptionInfo(StringBuilder, OptionDescriptor)}</li> * </ul> * * @param descriptor a descriptor for a configured option of a parser * @return help string */ protected String createOptionDisplay( OptionDescriptor descriptor ) { StringBuilder buffer = new StringBuilder( descriptor.isRequired() ? "* " : "" ); for ( Iterator<String> i = descriptor.options().iterator(); i.hasNext(); ) { String option = i.next(); buffer.append( optionLeader( option ) ); buffer.append( option ); if ( i.hasNext() ) buffer.append( ", " ); } maybeAppendOptionInfo( buffer, descriptor ); return buffer.toString(); }
if (od.isRequired()) { sb.append(" (required)");