# Path: awsshell/makeindex.py
# SHORTHAND_DOC = ParamShorthandDocGen()
# def new_index():
# def index_command(index_dict, help_command):
# def write_index(output_filename=None):
# def write_doc_index(output_filename=None, db=None, help_command=None):
# def do_write_doc_index(db, help_command, close_db_on_finish):
# def _index_docs(db, help_command):
# def render_docs_for_cmd(help_command):
# def convert_rst_to_basic_text(contents):
#     def __init__(self):
#     def render(self, contents):
#     def contents(self):
#     def translate(self):
#     def depart_title(self, node):
#     def visit_literal(self, node):
#     def depart_literal(self, node):
# class FileRenderer(object):
# class BasicTextWriter(textwriter.TextWriter):
# class BasicTextTranslator(textwriter.TextTranslator):


import awscli.clidriver
import pytest
from awsshell import makeindex



@pytest.fixture
def cloudformation_command():
    driver = awscli.clidriver.create_clidriver()
    cmd = driver.create_help_command()
    cfn = cmd.command_table['cloudformation']
    return cfn


def test_can_write_doc_index_for_single_operation(cloudformation_command):
    # We don't want to try to generate the entire doc index
    # for all commands.  We're just trying to ensure we're
    # integrating with the AWS CLi's help commands properly
    # so we're going to pick a single operation to document.
    create_stack = cloudformation_command.create_help_command()\
            .command_table['create-stack']
    help_command = create_stack.create_help_command()

# Path: awsshell/makeindex.py
# SHORTHAND_DOC = ParamShorthandDocGen()
# def new_index():
# def index_command(index_dict, help_command):
# def write_index(output_filename=None):
# def write_doc_index(output_filename=None, db=None, help_command=None):
# def do_write_doc_index(db, help_command, close_db_on_finish):
# def _index_docs(db, help_command):
# def render_docs_for_cmd(help_command):
# def convert_rst_to_basic_text(contents):
#     def __init__(self):
#     def render(self, contents):
#     def contents(self):
#     def translate(self):
#     def depart_title(self, node):
#     def visit_literal(self, node):
#     def depart_literal(self, node):
# class FileRenderer(object):
# class BasicTextWriter(textwriter.TextWriter):
# class BasicTextTranslator(textwriter.TextTranslator):


# Path: tests/integration/test_makeindex.py
import awscli.clidriver
import pytest
from awsshell import makeindex




@pytest.fixture
def cloudformation_command():
    driver = awscli.clidriver.create_clidriver()
    cmd = driver.create_help_command()
    cfn = cmd.command_table['cloudformation']
    return cfn


def test_can_write_doc_index_for_single_operation(cloudformation_command):
    # We don't want to try to generate the entire doc index
    # for all commands.  We're just trying to ensure we're
    # integrating with the AWS CLi's help commands properly
    # so we're going to pick a single operation to document.
    create_stack = cloudformation_command.create_help_command()\
            .command_table['create-stack']
    help_command = create_stack.create_help_command()

    rendered = makeindex.render_docs_for_cmd(help_command=help_command)