public String getUsage ( ) { Set < Option > set = new HashSet <> ( ) ; StringBuilder sb = new StringBuilder ( ) ; sb . append ( "usage: " ) ; boolean n1 = false ; for ( Entry < String , List < Option > > e : groups . entrySet ( ) ) { if ( n1 ) { sb . append ( "|" ) ; } n1 = true ; sb . append ( "[" ) ; boolean n2 = false ; for ( Option opt : e . getValue ( ) ) { if ( n2 ) { sb . append ( " " ) ; } n2 = true ; append ( sb , opt ) ; set . add ( opt ) ; } sb . append ( "]" ) ; } for ( Option opt : map . values ( ) ) { if ( ! set . contains ( opt ) ) { sb . append ( " " ) ; append ( sb , opt ) ; } } for ( int ii = 0 ; ii < names . size ( ) ; ii ++ ) { sb . append ( " <" ) . append ( names . get ( ii ) ) . append ( ">" ) ; if ( types . get ( ii ) . isArray ( ) ) { sb . append ( "..." ) ; } } return sb . toString ( ) ; }
Returns usage string .