(opt)
return ', '.join(rv), '\n'.join(out)
Re-implementation of click.Opt.get_help_record.

    The variant of 'get_help_record' found in Click makes uses of slashes to
    separate multiple opts, and formats option arguments using upper case. This
    is not compatible with Sphinx's 'option' directive, which expects
    comma-separated opts and option arguments surrounded by angle brackets [1].

    [1] http://www.sphinx-doc.org/en/stable/domains.html#directive-option
Re-implementation of click.Opt.get_help_record.
Re - implementation of click . Opt . get_help_record .
def _get_help_record(opt):
    """Re-implementation of click.Opt.get_help_record.

    The variant of 'get_help_record' found in Click makes uses of slashes to
    separate multiple opts, and formats option arguments using upper case. This
    is not compatible with Sphinx's 'option' directive, which expects
    comma-separated opts and option arguments surrounded by angle brackets [1].

    [1] http://www.sphinx-doc.org/en/stable/domains.html#directive-option
    """

    def _write_opts(opts):
        rv, _ = click.formatting.join_options(opts)
        if not opt.is_flag and not opt.count:
            name = opt.name
            if opt.metavar:
                name = opt.metavar.lstrip('<[{($').rstrip('>]})$')
            rv += ' <{}>'.format(name)
        return rv

    rv = [_write_opts(opt.opts)]
    if opt.secondary_opts:
        rv.append(_write_opts(opt.secondary_opts))

    out = []
    if opt.help:
        if opt.required:
            out.append('**Required** %s' % opt.help)
        else:
            out.append(opt.help)
    else:
        if opt.required:
            out.append('**Required**')

    extras = []

    if opt.default is not None and opt.show_default:
        if isinstance(opt.show_default, str):
            # Starting from Click 7.0 this can be a string as well. This is
            # mostly useful when the default is not a constant and
            # documentation thus needs a manually written string.
            extras.append(':default: %s' % opt.show_default)
        else:
            extras.append(
                ':default: %s'
                % (
                    ', '.join('%s' % d for d in opt.default)
                    if isinstance(opt.default, (list, tuple))
                    else opt.default,
                )
            )

    if isinstance(opt.type, click.Choice):
        extras.append(':options: %s' % ' | '.join(str(x) for x in opt.type.choices))

    if extras:
        if out:
            out.append('')

        out.extend(extras)

    return ', '.join(rv), '\n'.join(out)
def _get_help_record ( opt ) : def _write_opts ( opts ) : rv , _ = click . formatting . join_options ( opts ) if not opt . is_flag and not opt . count : name = opt . name if opt . metavar : name = opt . metavar . lstrip ( '<[{($' ) . rstrip ( '>]})$' ) rv += ' <{}>' . format ( name ) return rv rv = [ _write_opts ( opt . opts ) ] if opt . secondary_opts : rv . append ( _write_opts ( opt . secondary_opts ) ) out = [ ] if opt . help : if opt . required : out . append ( '**Required** %s' % opt . help ) else : out . append ( opt . help ) else : if opt . required : out . append ( '**Required**' ) extras = [ ] if opt . default is not None and opt . show_default : if isinstance ( opt . show_default , str ) : # Starting from Click 7.0 this can be a string as well. This is # mostly useful when the default is not a constant and # documentation thus needs a manually written string. extras . append ( ':default: %s' % opt . show_default ) else : extras . append ( ':default: %s' % ( ', ' . join ( '%s' % d for d in opt . default ) if isinstance ( opt . default , ( list , tuple ) ) else opt . default , ) ) if isinstance ( opt . type , click . Choice ) : extras . append ( ':options: %s' % ' | ' . join ( str ( x ) for x in opt . type . choices ) ) if extras : if out : out . append ( '' ) out . extend ( extras ) return ', ' . join ( rv ) , '\n' . join ( out )