#NEWLINE# def _format_command_usage( commands ) : #NEWLINE# #INDENT# 'Construct the Commands-part of the usage text.' #NEWLINE# if ( not commands ) : #NEWLINE# #INDENT# return '' #NEWLINE# #UNINDENT# command_usage = '\nCommands:\n' #NEWLINE# cmd_len = max ( ( [ len ( c ) for c in commands ] + [ 8 ] ) ) #NEWLINE# command_doc = OrderedDict ( [ ( cmd_name , _get_first_line_of_docstring ( cmd_doc ) ) for ( cmd_name , cmd_doc ) in commands . items ( ) ] ) #NEWLINE# for ( cmd_name , cmd_doc ) in command_doc . items ( ) : #NEWLINE# #INDENT# command_usage += ( '  {:%d}  {}\n' % cmd_len ) . format ( cmd_name , cmd_doc ) #NEWLINE# #UNINDENT# return command_usage