(ctx, nested, commands=None)
Format the output of `click.Command`.
Format the output of `click.Command`.
Format the output of click . Command .
def _format_command(ctx, nested, commands=None):
    """Format the output of `click.Command`."""
    if ctx.command.hidden:
        return

    # description

    for line in _format_description(ctx):
        yield line

    yield '.. program:: {}'.format(ctx.command_path)

    # usage

    for line in _format_usage(ctx):
        yield line

    # options

    lines = list(_format_options(ctx))
    if lines:
        # we use rubric to provide some separation without exploding the table
        # of contents
        yield '.. rubric:: Options'
        yield ''

    for line in lines:
        yield line

    # arguments

    lines = list(_format_arguments(ctx))
    if lines:
        yield '.. rubric:: Arguments'
        yield ''

    for line in lines:
        yield line

    # environment variables

    lines = list(_format_envvars(ctx))
    if lines:
        yield '.. rubric:: Environment variables'
        yield ''

    for line in lines:
        yield line

    # description

    for line in _format_epilog(ctx):
        yield line

    # if we're nesting commands, we need to do this slightly differently
    if nested in (NESTED_FULL, NESTED_NONE):
        return

    commands = _filter_commands(ctx, commands)

    if commands:
        yield '.. rubric:: Commands'
        yield ''

    for command in commands:
        # Don't show hidden subcommands
        if command.hidden:
            continue

        for line in _format_subcommand(command):
            yield line
        yield ''
def _format_command ( ctx , nested , commands = None ) : if ctx . command . hidden : return # description for line in _format_description ( ctx ) : yield line yield '.. program:: {}' . format ( ctx . command_path ) # usage for line in _format_usage ( ctx ) : yield line # options lines = list ( _format_options ( ctx ) ) if lines : # we use rubric to provide some separation without exploding the table # of contents yield '.. rubric:: Options' yield '' for line in lines : yield line # arguments lines = list ( _format_arguments ( ctx ) ) if lines : yield '.. rubric:: Arguments' yield '' for line in lines : yield line # environment variables lines = list ( _format_envvars ( ctx ) ) if lines : yield '.. rubric:: Environment variables' yield '' for line in lines : yield line # description for line in _format_epilog ( ctx ) : yield line # if we're nesting commands, we need to do this slightly differently if nested in ( NESTED_FULL , NESTED_NONE ) : return commands = _filter_commands ( ctx , commands ) if commands : yield '.. rubric:: Commands' yield '' for command in commands : # Don't show hidden subcommands if command . hidden : continue for line in _format_subcommand ( command ) : yield line yield ''