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

Method forward

src/click/core.py:909–926  ·  view source on GitHub ↗

Similar to :meth:`invoke` but fills in default keyword arguments from the current context if the other command expects it. This cannot invoke callbacks directly, only other commands. .. versionchanged:: 8.0 All ``kwargs`` are tracked in :attr:`params` so they wi

(self, cmd: Command, /, *args: t.Any, **kwargs: t.Any)

Source from the content-addressed store, hash-verified

907 return callback(*args, **kwargs)
908
909 def forward(self, cmd: Command, /, *args: t.Any, **kwargs: t.Any) -> t.Any:
910 """Similar to :meth:`invoke` but fills in default keyword
911 arguments from the current context if the other command expects
912 it. This cannot invoke callbacks directly, only other commands.
913
914 .. versionchanged:: 8.0
915 All ``kwargs`` are tracked in :attr:`params` so they will be
916 passed if ``forward`` is called at multiple levels.
917 """
918 # Can only forward to other commands, not direct callbacks.
919 if not isinstance(cmd, Command):
920 raise TypeError("Callback is not a command.")
921
922 for param in self.params:
923 if param not in kwargs:
924 kwargs[param] = self.params[param]
925
926 return self.invoke(cmd, *args, **kwargs)
927
928 def set_parameter_source(self, name: str, source: ParameterSource) -> None:
929 """Set the source of a parameter. This indicates the location

Callers 2

distFunction · 0.80
secondFunction · 0.80

Calls 1

invokeMethod · 0.95

Tested by 2

distFunction · 0.64
secondFunction · 0.64