#NEWLINE# def list_commands( docstring , format_ ) : #NEWLINE# #INDENT# '\n    Print all found commands/tasks, then exit. Invoked with ``-l/--list.``\n\n    If ``docstring`` is non-empty, it will be printed before the task list.\n\n    ``format_`` should conform to the options specified in\n    ``LIST_FORMAT_OPTIONS``, e.g. ``"short"``, ``"normal"``.\n    ' #NEWLINE# if ( format_ == 'short' ) : #NEWLINE# #INDENT# return _task_names ( state . commands ) #NEWLINE# #UNINDENT# result = [ ] #NEWLINE# if docstring : #NEWLINE# #INDENT# trailer = ( '\n' if ( not docstring . endswith ( '\n' ) ) else '' ) #NEWLINE# result . append ( ( docstring + trailer ) ) #NEWLINE# #UNINDENT# header = COMMANDS_HEADER #NEWLINE# result . append ( header ) #NEWLINE# c = _normal_list ( ) #NEWLINE# result . extend ( c ) #NEWLINE# result . extend ( '\n' ) #NEWLINE# return docstring