MCPcopy
hub / github.com/pallets/click / add_command

Method add_command

src/click/core.py:1719–1727  ·  view source on GitHub ↗

Registers another :class:`Command` with this group. If the name is not provided, the name of the command is used.

(self, cmd: Command, name: str | None = None)

Source from the content-addressed store, hash-verified

1717 return info_dict
1718
1719 def add_command(self, cmd: Command, name: str | None = None) -> None:
1720 """Registers another :class:`Command` with this group. If the name
1721 is not provided, the name of the command is used.
1722 """
1723 name = name or cmd.name
1724 if name is None:
1725 raise TypeError("Command has no name.")
1726 _check_nested_chain(self, name, cmd, register=True)
1727 self.commands[name] = cmd
1728
1729 @t.overload
1730 def command(self, __func: t.Callable[..., t.Any]) -> Command: ...

Callers 4

decoratorMethod · 0.95
test_custom_parserFunction · 0.80
completion.pyFile · 0.80

Calls 1

_check_nested_chainFunction · 0.85

Tested by 2

test_custom_parserFunction · 0.64