def register_to(cls, subparsers: _SubParsersAction, name: str | None = None, **kwargs: Any) -> None:
        """Register a subcommand to the subparsers,
        with an optional name of the subcommand.
        """
        help_text = cls.description or cls.__doc__
        name = name or cls.name or ""
        # Remove the existing subparser as it will raise an error on Python 3.11+
        subparsers._name_parser_map.pop(name, None)
        subactions = subparsers._get_subactions()
        subactions[:] = [action for action in subactions if action.dest != name]
        parser = subparsers.add_parser(
            name,
            description=help_text,
            help=help_text,
            **kwargs,
        )
        command = cls.init_parser(parser)
        command.name = name
        # Store the command instance in the parsed args. See pdm/core.py for more details
        parser.set_defaults(command=command)
Register a subcommand to the subparsers,
        with an optional name of the subcommand.
        
src/pdm/cli/commands/base.py