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)
| 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 |