public String printExample(OptionHandlerFilter mode, ResourceBundle rb) {
        StringBuilder buf = new StringBuilder();

        checkNonNull(mode, "mode");
        
        for (OptionHandler h : options) {
            OptionDef option = h.option;
            if(option.usage().length()==0)  continue;   // ignore
            if(!mode.select(h))             continue;

            buf.append(' ');
            buf.append(h.getNameAndMeta(rb, parserProperties));
        }

        return buf.toString();
    }
public String printExample ( OptionHandlerFilter mode , ResourceBundle rb ) { StringBuilder buf = new StringBuilder ( ) ; checkNonNull ( mode , "mode" ) ; for ( OptionHandler h : options ) { OptionDef option = h . option ; if ( option . usage ( ) . length ( ) == 0 ) continue ; if ( ! mode . select ( h ) ) continue ; buf . append ( ' ' ) ; buf . append ( h . getNameAndMeta ( rb , parserProperties ) ) ; } return buf . toString ( ) ; }
Formats a command line example into a string.

<p>
This method produces a string like <code> -d &lt;dir&gt; -v -b</code>.
This is useful for printing a command line example (perhaps
as a part of the usage screen).


@param mode
Determines which options will be a part of the returned string.
Must not be {@code null}.
@param rb
If non-{@code null}, meta variables (<code>&lt;dir&gt;</code> in the above example)
is treated as a key to this resource bundle, and the associated
value is printed. See {@link Option#metaVar()}. This is to support
localization.

Passing {@code null} would print {@link Option#metaVar()} directly.
@return
always non-{@code null}. If there's no option, this method returns
just the empty string {@code ""}. Otherwise, this method returns a
string that contains a space at the beginning (but not at the end).
This allows you to do something like:
<code>System.err.println("java -jar my.jar"+parser.printExample(REQUIRED)+" arg1 arg2");</code>
@throws NullPointerException if {@code mode} is {@code null}.