public String getSingleLineUsage ( ) { StringBuilder writer = new StringBuilder ( ) ; writer . append ( program ) ; // first just list up all the unary short opts. StringBuilder sh = new StringBuilder ( ) ; // Only include the first short name form the flag. options . stream ( ) . filter ( opt -> opt instanceof Flag ) . filter ( opt -> opt . getShortNames ( ) . length ( ) > 0 ) . forEachOrdered ( opt -> sh . append ( opt . getShortNames ( ) . charAt ( 0 ) ) ) ; if ( sh . length ( ) > 0 ) { writer . append ( " [-" ) . append ( sh . toString ( ) ) . append ( ' ' ) ; } for ( BaseOption opt : options ) { if ( opt instanceof Flag && opt . getShortNames ( ) . length ( ) > 0 ) { // already included as short opt. continue ; } String usage = opt . getSingleLineUsage ( ) ; if ( usage != null ) { writer . append ( ' ' ) . append ( usage ) ; } } for ( BaseArgument arg : arguments ) { String usage = arg . getSingleLineUsage ( ) ; if ( usage != null ) { writer . append ( ' ' ) . append ( usage ) ; } } return writer . toString ( ) ; }
Get the single line usage string for the parser . Contains essentially the line program options args .