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 ); }
public String format( Map<String, ? extends OptionDescriptor> options ) { if ( options.isEmpty() ) return "No options specified"; grid = new ColumnarData( optionHeader( options ), "Description" ); Comparator<OptionDescriptor> comparator = new Comparator<OptionDescriptor>() { public int compare( OptionDescriptor first, OptionDescriptor second ) { return first.options().iterator().next().compareTo( second.options().iterator().next() ); } }; Set<OptionDescriptor> sorted = new TreeSet<OptionDescriptor>( comparator ); sorted.addAll( options.values() ); for ( OptionDescriptor each : sorted ) addHelpLineFor( each ); return grid.format(); }
public String format( Map<String, ? extends OptionDescriptor> options ) { if ( options.isEmpty() ) return "No options specified"; grid = new ColumnarData( optionHeader( options ), "Description" ); Comparator<OptionDescriptor> comparator = new Comparator<OptionDescriptor>() { public int compare( OptionDescriptor first, OptionDescriptor second ) { return first.options().iterator().next().compareTo( second.options().iterator().next() ); } }; Set<OptionDescriptor> sorted = new TreeSet<OptionDescriptor>( comparator ); sorted.addAll( options.values() ); for ( OptionDescriptor each : sorted ) addHelpLineFor( each ); return grid.format(); }
public String format( Map<String, ? extends OptionDescriptor> options ) { if ( options.isEmpty() ) return "No options specified"; grid = new ColumnarData( optionHeader( options ), "Description" ); Comparator<OptionDescriptor> comparator = new Comparator<OptionDescriptor>() { public int compare( OptionDescriptor first, OptionDescriptor second ) { return first.options().iterator().next().compareTo( second.options().iterator().next() ); } }; Set<OptionDescriptor> sorted = new TreeSet<OptionDescriptor>( comparator ); sorted.addAll( options.values() ); for ( OptionDescriptor each : sorted ) addHelpLineFor( each ); return grid.format(); }
private void addHelpLineFor( OptionDescriptor descriptor ) { if ( descriptor.acceptsArguments() ) { if ( descriptor.requiresArgument() ) addHelpLineWithArgument( descriptor, '<', '>' ); else addHelpLineWithArgument( descriptor, '[', ']' ); } else { addHelpLineFor( descriptor, "" ); } }
private void addHelpLineFor( OptionDescriptor descriptor ) { if ( descriptor.acceptsArguments() ) { if ( descriptor.requiresArgument() ) addHelpLineWithArgument( descriptor, '<', '>' ); else addHelpLineWithArgument( descriptor, '[', ']' ); } else { addHelpLineFor( descriptor, "" ); } }
private void addHelpLineFor( OptionDescriptor descriptor ) { if ( descriptor.acceptsArguments() ) { if ( descriptor.requiresArgument() ) addHelpLineWithArgument( descriptor, '<', '>' ); else addHelpLineWithArgument( descriptor, '[', ']' ); } else { addHelpLineFor( descriptor, "" ); } }