Gather information that could be useful for a tool generating user-facing documentation. This traverses the entire CLI structure. .. code-block:: python with Context(cli) as ctx: info = ctx.to_info_dict() .. versionadded:: 8.0
(self)
| 522 | return self._protected_args |
| 523 | |
| 524 | def to_info_dict(self) -> dict[str, t.Any]: |
| 525 | """Gather information that could be useful for a tool generating |
| 526 | user-facing documentation. This traverses the entire CLI |
| 527 | structure. |
| 528 | |
| 529 | .. code-block:: python |
| 530 | |
| 531 | with Context(cli) as ctx: |
| 532 | info = ctx.to_info_dict() |
| 533 | |
| 534 | .. versionadded:: 8.0 |
| 535 | """ |
| 536 | return { |
| 537 | "command": self.command.to_info_dict(self), |
| 538 | "info_name": self.info_name, |
| 539 | "allow_extra_args": self.allow_extra_args, |
| 540 | "allow_interspersed_args": self.allow_interspersed_args, |
| 541 | "ignore_unknown_options": self.ignore_unknown_options, |
| 542 | "auto_envvar_prefix": self.auto_envvar_prefix, |
| 543 | } |
| 544 | |
| 545 | def __enter__(self) -> Self: |
| 546 | self._depth += 1 |