def _wrap_usage_section(source, width):
    # type: (str, int) -> str
    """Wrap the given usage section string to the current terminal size.

    Note:
        Commands arguments are wrapped to the column that the arguments began
        on the first line of the command.

    Args:
        source: The section string to wrap.

    Returns:
        The wrapped section string.
    """
    if not any(len(line) > width for line in source.splitlines()):
        return source
    section_header = source[:source.index(':') + 1].strip()
    lines = [section_header]
    for commands, args in parse_commands(source):
        command = '  {} '.format(' '.join(commands))
        max_len = width - len(command)
        sep = '\n' + ' ' * len(command)
        wrapped_args = sep.join(textwrap.wrap(' '.join(args), max_len))
        full_command = command + wrapped_args
        lines += full_command.splitlines()
    return '\n'.join(lines)
def _wrap_usage_section ( source , width ) : if not any ( len ( line ) > width for line in source . splitlines ( ) ) : return source section_header = source [ : source . index ( ':' ) + 1 ] . strip ( ) lines = [ section_header ] for commands , args in parse_commands ( source ) : command = '  {} ' . format ( ' ' . join ( commands ) ) max_len = width - len ( command ) sep = '\n' + ' ' * len ( command ) wrapped_args = sep . join ( textwrap . wrap ( ' ' . join ( args ) , max_len ) ) full_command = command + wrapped_args lines += full_command . splitlines ( ) return '\n' . join ( lines )
Wrap the given usage section string to the current terminal size.

    Note:
        Commands arguments are wrapped to the column that the arguments began
        on the first line of the command.

    Args:
        source: The section string to wrap.

    Returns:
        The wrapped section string.