# Path: cli_bdd/core/steps/command.py
# def run(command, fail_on_error=False, interactively=False, timeout=30):
# def ensure_command_finished(child):
#     def step(self, command, timeout):
#     def step(self, command):
#     def step(self, command):
#     def step(self, input_):
#     def step(self, dialog_matcher, timeout):
#     def step(self, output, should_not=False, exactly=False):
#     def step(self, output, should_not=False, comparison=None, count=None):
#     def step(self, should_not=False, exit_status=None):
# class RunCommand(StepBase):
# class SuccessfullyRunCommand(StepBase):
# class RunCommandInteractively(StepBase):
# class TypeIntoCommand(StepBase):
# class GotInteractiveDialogCommand(StepBase):
# class OutputShouldContainText(StepBase):
# class OutputShouldContainLines(StepBase):
# class ExitStatusShouldBe(StepBase):
# 
# Path: cli_bdd/core/steps/environment.py
# def _append_to_the_environment_variable(variable, value):
# def _prepend_to_the_environment_variable(variable, value):
#     def step(self, variable, value):
#     def step(self, value, variable):
#     def step(self, value, variable):
#     def step(self):
#     def step(self):
#     def step(self):
# class SetTheEnvironmentVariableBase(StepBase):
# class AppendToTheEnvironmentVariable(StepBase):
# class PrependToTheEnvironmentVariable(StepBase):
# class SetTheEnvironmentVariables(StepBase):
# class AppendTheValuesToTheEnvironmentVariables(StepBase):
# class PrependTheValuesToTheEnvironmentVariables(StepBase):
# 
# Path: cli_bdd/core/steps/file.py
# class CopyFileOrDirectory(StepBase):
# class MoveFileOrDirectory(StepBase):
# class CreateDirectory(StepBase):
# class ChangeDirectory(StepBase):
# class CreateFileWithContent(StepBase):
# class CreateFileWithMultilineContent(StepBase):
# class CheckFileOrDirectoryExist(StepBase):
#     def step(self, file_or_directory, source, destination):
#     def step(self, file_or_directory, source, destination):
#     def step(self, dir_path):
#     def step(self, dir_path):
#     def step(self, file_path, file_content):
#     def step(self, file_path):
#     def step(self, file_or_directory, path, should_not=None):


import sys
import os
import re
from jinja2 import Template
from cli_bdd.core.steps import (
    command,
    environment,
    file as file_steps,
)
def _prepare_docstring(value):
    if not value:
        return ''
    remove_spaces = 0
    for line in value.split('\n')[1:]:
        if line:
            for char in line:
                if char != ' ':
                    break
                else:
                    remove_spaces += 1
            break

    return re.sub(
        r'^ {%s}' % remove_spaces,
        '',
        unicode(value),
        flags=re.MULTILINE
    ).strip()


def _render_and_save_template(path, dest, context):
    template_path = os.path.join(TEMPLATES_PATH, path + '.tpl')
    destination_path = os.path.join(BASE_PATH, dest + '.md')
    with open(destination_path, 'wt') as dest_file:
        dest_file.write(
            Template(open(template_path).read()).render(context)
        )



# Path: cli_bdd/core/steps/command.py
# def run(command, fail_on_error=False, interactively=False, timeout=30):
# def ensure_command_finished(child):
#     def step(self, command, timeout):
#     def step(self, command):
#     def step(self, command):
#     def step(self, input_):
#     def step(self, dialog_matcher, timeout):
#     def step(self, output, should_not=False, exactly=False):
#     def step(self, output, should_not=False, comparison=None, count=None):
#     def step(self, should_not=False, exit_status=None):
# class RunCommand(StepBase):
# class SuccessfullyRunCommand(StepBase):
# class RunCommandInteractively(StepBase):
# class TypeIntoCommand(StepBase):
# class GotInteractiveDialogCommand(StepBase):
# class OutputShouldContainText(StepBase):
# class OutputShouldContainLines(StepBase):
# class ExitStatusShouldBe(StepBase):
# 
# Path: cli_bdd/core/steps/environment.py
# def _append_to_the_environment_variable(variable, value):
# def _prepend_to_the_environment_variable(variable, value):
#     def step(self, variable, value):
#     def step(self, value, variable):
#     def step(self, value, variable):
#     def step(self):
#     def step(self):
#     def step(self):
# class SetTheEnvironmentVariableBase(StepBase):
# class AppendToTheEnvironmentVariable(StepBase):
# class PrependToTheEnvironmentVariable(StepBase):
# class SetTheEnvironmentVariables(StepBase):
# class AppendTheValuesToTheEnvironmentVariables(StepBase):
# class PrependTheValuesToTheEnvironmentVariables(StepBase):
# 
# Path: cli_bdd/core/steps/file.py
# class CopyFileOrDirectory(StepBase):
# class MoveFileOrDirectory(StepBase):
# class CreateDirectory(StepBase):
# class ChangeDirectory(StepBase):
# class CreateFileWithContent(StepBase):
# class CreateFileWithMultilineContent(StepBase):
# class CheckFileOrDirectoryExist(StepBase):
#     def step(self, file_or_directory, source, destination):
#     def step(self, file_or_directory, source, destination):
#     def step(self, dir_path):
#     def step(self, dir_path):
#     def step(self, file_path, file_content):
#     def step(self, file_path):
#     def step(self, file_or_directory, path, should_not=None):


# Path: docs/generator.py
import sys
import os
import re
from jinja2 import Template
from cli_bdd.core.steps import (
    command,
    environment,
    file as file_steps,
)

def _prepare_docstring(value):
    if not value:
        return ''
    remove_spaces = 0
    for line in value.split('\n')[1:]:
        if line:
            for char in line:
                if char != ' ':
                    break
                else:
                    remove_spaces += 1
            break

    return re.sub(
        r'^ {%s}' % remove_spaces,
        '',
        unicode(value),
        flags=re.MULTILINE
    ).strip()


def _render_and_save_template(path, dest, context):
    template_path = os.path.join(TEMPLATES_PATH, path + '.tpl')
    destination_path = os.path.join(BASE_PATH, dest + '.md')
    with open(destination_path, 'wt') as dest_file:
        dest_file.write(
            Template(open(template_path).read()).render(context)
        )



def generate_api_reference():