private void addHelpLineWithArgument( OptionDescriptor descriptor, char begin, char end ) { String argDescription = descriptor.argumentDescription(); String typeIndicator = typeIndicator( descriptor ); StringBuilder collector = new StringBuilder(); if ( typeIndicator.length() > 0 ) { collector.append( typeIndicator ); if ( argDescription.length() > 0 ) collector.append( ": " ).append( argDescription ); } else if ( argDescription.length() > 0 ) collector.append( argDescription ); String helpLine = collector.length() == 0 ? "" : ' ' + surround( collector.toString(), begin, end ); addHelpLineFor( descriptor, helpLine ); }
private void addHelpLineWithArgument( OptionDescriptor descriptor, char begin, char end ) { String argDescription = descriptor.argumentDescription(); String typeIndicator = typeIndicator( descriptor ); StringBuilder collector = new StringBuilder(); if ( typeIndicator.length() > 0 ) { collector.append( typeIndicator ); if ( argDescription.length() > 0 ) collector.append( ": " ).append( argDescription ); } else if ( argDescription.length() > 0 ) collector.append( argDescription ); String helpLine = collector.length() == 0 ? "" : ' ' + surround( collector.toString(), begin, end ); addHelpLineFor( descriptor, helpLine ); }
private void addHelpLineWithArgument( OptionDescriptor descriptor, char begin, char end ) { String argDescription = descriptor.argumentDescription(); String typeIndicator = typeIndicator( descriptor ); StringBuilder collector = new StringBuilder(); if ( typeIndicator.length() > 0 ) { collector.append( typeIndicator ); if ( argDescription.length() > 0 ) collector.append( ": " ).append( argDescription ); } else if ( argDescription.length() > 0 ) collector.append( argDescription ); String helpLine = collector.length() == 0 ? "" : ' ' + surround( collector.toString(), begin, end ); addHelpLineFor( descriptor, helpLine ); }
o.append("["); o.append(d.argumentDescription()); if (d.requiresArgument()) { o.append(">");
o.append("["); o.append(d.argumentDescription()); if (d.requiresArgument()) { o.append(">");
/** * <p>Decides whether or not to show a non-option arguments help.</p> * * <p>This implementation responds with {@code true} if the non-option descriptor has a non-{@code null}, * non-empty value for any of {@link OptionDescriptor#description()}, * {@link OptionDescriptor#argumentTypeIndicator()}, or {@link OptionDescriptor#argumentDescription()}.</p> * * @param nonOptionDescriptor non-option argument descriptor * @return {@code true} if non-options argument help should be shown */ protected boolean shouldShowNonOptionArgumentDisplay( OptionDescriptor nonOptionDescriptor ) { return !Strings.isNullOrEmpty( nonOptionDescriptor.description() ) || !Strings.isNullOrEmpty( nonOptionDescriptor.argumentTypeIndicator() ) || !Strings.isNullOrEmpty( nonOptionDescriptor.argumentDescription() ); }
/** * <p>Decides whether or not to show a non-option arguments help.</p> * * <p>This implementation responds with {@code true} if the non-option descriptor has a non-{@code null}, * non-empty value for any of {@link OptionDescriptor#description()}, * {@link OptionDescriptor#argumentTypeIndicator()}, or {@link OptionDescriptor#argumentDescription()}.</p> * * @param nonOptionDescriptor non-option argument descriptor * @return {@code true} if non-options argument help should be shown */ protected boolean shouldShowNonOptionArgumentDisplay( OptionDescriptor nonOptionDescriptor ) { return !Strings.isNullOrEmpty( nonOptionDescriptor.description() ) || !Strings.isNullOrEmpty( nonOptionDescriptor.argumentTypeIndicator() ) || !Strings.isNullOrEmpty( nonOptionDescriptor.argumentDescription() ); }
/** * <p>Appends additional info about the given option to the given buffer.</p> * * <p>This implementation:</p> * <ul> * <li>calls {@link #extractTypeIndicator(OptionDescriptor)} for the descriptor</li> * <li>calls {@link joptsimple.OptionDescriptor#argumentDescription()} for the descriptor</li> * <li>if either of the above is present, calls * {@link #appendOptionHelp(StringBuilder, String, String, boolean)}</li> * </ul> * * @param buffer string buffer * @param descriptor a descriptor for a configured option of a parser */ protected void maybeAppendOptionInfo( StringBuilder buffer, OptionDescriptor descriptor ) { String indicator = extractTypeIndicator( descriptor ); String description = descriptor.argumentDescription(); if ( descriptor.acceptsArguments() || !isNullOrEmpty( description ) || descriptor.representsNonOptions() ) { appendOptionHelp( buffer, indicator, description, descriptor.requiresArgument() ); } }
/** * <p>Appends additional info about the given option to the given buffer.</p> * * <p>This implementation:</p> * <ul> * <li>calls {@link #extractTypeIndicator(OptionDescriptor)} for the descriptor</li> * <li>calls {@link joptsimple.OptionDescriptor#argumentDescription()} for the descriptor</li> * <li>if either of the above is present, calls * {@link #appendOptionHelp(StringBuilder, String, String, boolean)}</li> * </ul> * * @param buffer string buffer * @param descriptor a descriptor for a configured option of a parser */ protected void maybeAppendOptionInfo( StringBuilder buffer, OptionDescriptor descriptor ) { String indicator = extractTypeIndicator( descriptor ); String description = descriptor.argumentDescription(); if ( descriptor.acceptsArguments() || !isNullOrEmpty( description ) || descriptor.representsNonOptions() ) { appendOptionHelp( buffer, indicator, description, descriptor.requiresArgument() ); } }