|
22 | 22 | print(f"To use the {__info__.__project__} CLI you must install 'typer[all]'", file=stderr)
|
23 | 23 | raise SystemExit(42)
|
24 | 24 |
|
25 |
| -try: |
26 |
| - from click_help_colors import HelpColorsCommand, HelpColorsGroup # type: ignore[import] |
27 |
| -except ModuleNotFoundError: |
28 |
| - secho(f"To use the {__info__.__project__} CLI you must install 'click-help-colors'", fg=colors.RED, err=True) |
29 |
| - raise typer.Exit(42) |
30 |
| - |
31 | 25 |
|
32 | 26 | lookup_classes = {
|
33 | 27 | DataSource.QRZ: QrzSyncClient,
|
@@ -107,34 +101,3 @@ def run_query(source: DataSource, query: str, username: Optional[str] = None, pa
|
107 | 101 | else:
|
108 | 102 | secho("No callsign given", fg=colors.RED, err=True)
|
109 | 103 | raise typer.Exit(1)
|
110 |
| - |
111 |
| - |
112 |
| -# The following is for adding colours to command help output |
113 |
| -# See https://github.com/tiangolo/typer/issues/47 |
114 |
| - |
115 |
| -class CustomHelpColoursGroup(HelpColorsGroup): |
116 |
| - def __init__(self, *args, **kwargs) -> None: |
117 |
| - super().__init__(*args, **kwargs) |
118 |
| - self.help_headers_color = "blue" |
119 |
| - self.help_options_color = "yellow" |
120 |
| - |
121 |
| - |
122 |
| -class CustomHelpColoursCommand(HelpColorsCommand): |
123 |
| - def __init__(self, *args, **kwargs) -> None: |
124 |
| - super().__init__(*args, **kwargs) |
125 |
| - self.help_headers_color = "blue" |
126 |
| - self.help_options_color = "yellow" |
127 |
| - |
128 |
| - |
129 |
| -epilog = (f"Copyright {__info__.__copyright__} by {__info__.__author__}. " |
130 |
| - f"Released under the {__info__.__license__} License") |
131 |
| - |
132 |
| - |
133 |
| -class ColourTyper(typer.Typer): |
134 |
| - def __init__(self, *args, cls=CustomHelpColoursGroup, context_settings={"help_option_names": ["-h", "--help"]}, |
135 |
| - **kwargs) -> None: |
136 |
| - super().__init__(*args, cls=cls, context_settings=context_settings, epilog=epilog, **kwargs) |
137 |
| - |
138 |
| - def command(self, *args, cls=CustomHelpColoursCommand, context_settings={"help_option_names": ["-h", "--help"]}, |
139 |
| - **kwargs) -> Callable: |
140 |
| - return super().command(*args, cls=cls, context_settings=context_settings, epilog=epilog, **kwargs) |
0 commit comments