def list_commands(docstring, format_):
 if (format_ == 'short'):
  return _task_names(state.commands)
 result = []
 if docstring:
  trailer = ('\n' if (not docstring.endswith('\n')) else '')
  result.append((docstring + trailer))
 header = COMMANDS_HEADER
 if (format_ == 'nested'):
  header += NESTED_REMINDER
 result.append((header + ':\n'))
 c = (_normal_list() if (format_ == 'normal') else _nested_list(state.commands))
 result.extend(c)
 return result

def list_commands ( docstring , format_ ) : if ( format_ == 'short' ) : return _task_names ( state . commands ) result = [ ] if docstring : trailer = ( '\n' if ( not docstring . endswith ( '\n' ) ) else '' ) result . append ( ( docstring + trailer ) ) header = COMMANDS_HEADER if ( format_ == 'nested' ) : header += NESTED_REMINDER result . append ( ( header + ':\n' ) ) c = ( _normal_list ( ) if ( format_ == 'normal' ) else _nested_list ( state . commands ) ) result . extend ( c ) return result
print all found commands/tasks .