Gather information that could be useful for a tool generating user-facing documentation. Use :meth:`click.Context.to_info_dict` to traverse the entire CLI structure. .. versionchanged:: 8.3.0 Returns ``None`` for the :attr:`default` if it was not set.
(self)
| 2309 | ) |
| 2310 | |
| 2311 | def to_info_dict(self) -> dict[str, t.Any]: |
| 2312 | """Gather information that could be useful for a tool generating |
| 2313 | user-facing documentation. |
| 2314 | |
| 2315 | Use :meth:`click.Context.to_info_dict` to traverse the entire |
| 2316 | CLI structure. |
| 2317 | |
| 2318 | .. versionchanged:: 8.3.0 |
| 2319 | Returns ``None`` for the :attr:`default` if it was not set. |
| 2320 | |
| 2321 | .. versionadded:: 8.0 |
| 2322 | """ |
| 2323 | return { |
| 2324 | "name": self.name, |
| 2325 | "param_type_name": self.param_type_name, |
| 2326 | "opts": self.opts, |
| 2327 | "secondary_opts": self.secondary_opts, |
| 2328 | "type": self.type.to_info_dict(), |
| 2329 | "required": self.required, |
| 2330 | "nargs": self.nargs, |
| 2331 | "multiple": self.multiple, |
| 2332 | # We explicitly hide the :attr:`UNSET` value to the user, as we choose to |
| 2333 | # make it an implementation detail. And because ``to_info_dict`` has been |
| 2334 | # designed for documentation purposes, we return ``None`` instead. |
| 2335 | "default": self.default if self.default is not UNSET else None, |
| 2336 | "envvar": self.envvar, |
| 2337 | } |
| 2338 | |
| 2339 | def __repr__(self) -> str: |
| 2340 | return f"<{self.__class__.__name__} {self.name}>" |
nothing calls this directly
no test coverage detected