Repository: pypa/pip
File: docs/pip_sphinxext.py (Python)

Code before:
            else f".. _`{option._long_opts[0]}`:"
        )
        line = ".. option:: "
        if option._short_opts:
            line += option._short_opts[0]
        if option._short_opts and option._long_opts:
            line += ", " + option._long_opts[0]
        elif option._long_opts:
            line += option._long_opts[0]
        if option.takes_value():
            metavar = option.metavar or option.dest
            assert metavar is not None
            line += f" <{metavar.lower()}>"
        # fix defaults
        assert option.help is not None
        opt_help = option.help.replace("%default", str(option.default))
        # fix paths with sys.prefix
        opt_help = opt_help.replace(sys.prefix, "<sys.prefix>")
        env_var_names = convert_cli_opt_names_to_envvars(option._long_opts)
        env_var_names_src = ", ".join(f"``{env_var}``" for env_var in env_var_names)
        return [
            bookmark_line,
            "",
            line,
            "",
            "    " + opt_help,
            "",
            f"    (environment variable: {env_var_names_src})",
            "",
        ]

    def _format_options(
        self, options: Iterable[optparse.Option], cmd_name: Optional[str] = None
    ) -> None:
        for option in options:
            if option.help == optparse.SUPPRESS_HELP:
                continue
            for line in self._format_option(option, cmd_name):
                self.view_list.append(line, "")

    def run(self) -> List[nodes.Node]:
        node = nodes.paragraph()
        node.document = self.state.document
        self.view_list = ViewList()
        self.process_options()
        self.state.nested_parse(self.view_list, 0, node)
        return [node]


class PipGeneralOptions(PipOptions):
    def process_options(self) -> None:

Review comment (suggestion):
```suggestion
            f"    {opt_help}",
```

Code after:
            else f".. _`{option._long_opts[0]}`:"
        )
        line = ".. option:: "
        if option._short_opts:
            line += option._short_opts[0]
        if option._short_opts and option._long_opts:
            line += ", " + option._long_opts[0]
        elif option._long_opts:
            line += option._long_opts[0]
        if option.takes_value():
            metavar = option.metavar or option.dest
            assert metavar is not None
            line += f" <{metavar.lower()}>"
        # fix defaults
        assert option.help is not None
        opt_help = option.help.replace("%default", str(option.default))
        # fix paths with sys.prefix
        opt_help = opt_help.replace(sys.prefix, "<sys.prefix>")
        env_var_names = convert_cli_opt_names_to_envvars(option._long_opts)
        env_var_names_src = ", ".join(f"``{env_var}``" for env_var in env_var_names)
        return [
            bookmark_line,
            "",
            line,
            "",
            f"    {opt_help}",
            "",
            f"    (environment variable: {env_var_names_src})",
            "",
        ]

    def _format_options(
        self, options: Iterable[optparse.Option], cmd_name: Optional[str] = None
    ) -> None:
        for option in options:
            if option.help == optparse.SUPPRESS_HELP:
                continue
            for line in self._format_option(option, cmd_name):
                self.view_list.append(line, "")

    def run(self) -> List[nodes.Node]:
        node = nodes.paragraph()
        node.document = self.state.document
        self.view_list = ViewList()
        self.process_options()
        self.state.nested_parse(self.view_list, 0, node)
        return [node]


class PipGeneralOptions(PipOptions):
    def process_options(self) -> None: