public static void printCommandInfo ( Command command , PrintWriter pw ) { String description = String . format ( "%s: %s" , command . getCommandName ( ) , command . getDescription ( ) ) ; int width = 80 ; try { width = TerminalFactory . get ( ) . getWidth ( ) ; } catch ( Exception e ) { // In case the terminal factory failed to decide terminal type, use default width } HELP_FORMATTER . printWrapped ( pw , width , description ) ; HELP_FORMATTER . printUsage ( pw , width , command . getUsage ( ) ) ; if ( command . getOptions ( ) . getOptions ( ) . size ( ) > 0 ) { HELP_FORMATTER . printOptions ( pw , width , command . getOptions ( ) , HELP_FORMATTER . getLeftPadding ( ) , HELP_FORMATTER . getDescPadding ( ) ) ; } }
Prints the info about a command to the given print writer .