(self, file: IO[Any] | None = None)
| 58 | self.cmd: Command | None = self.ctx.command if self.ctx else None |
| 59 | |
| 60 | def show(self, file: IO[Any] | None = None) -> None: |
| 61 | if file is None: |
| 62 | file = get_text_stderr() |
| 63 | color = None |
| 64 | hint = "" |
| 65 | if ( |
| 66 | self.ctx is not None |
| 67 | and self.ctx.command.get_help_option(self.ctx) is not None |
| 68 | ): |
| 69 | command = self.ctx.command_path |
| 70 | option = self.ctx.help_option_names[0] |
| 71 | hint = f"Try '{command} {option}' for help.\n" |
| 72 | if self.ctx is not None: |
| 73 | color = self.ctx.color |
| 74 | echo(f"{self.ctx.get_usage()}\n{hint}", file=file, color=color) |
| 75 | echo( |
| 76 | f"Error: {self.format_message()}", |
| 77 | file=file, |
| 78 | color=color, |
| 79 | ) |
| 80 | |
| 81 | |
| 82 | class BadParameter(UsageError): |
no test coverage detected