|
7 | 7 | import asyncio
|
8 | 8 | import logging
|
9 | 9 | import sys
|
| 10 | +from typing import Any |
10 | 11 |
|
11 | 12 | from .main import async_run
|
12 | 13 |
|
|
15 | 16 |
|
16 | 17 | class CustomHelpFormatter(argparse.HelpFormatter):
|
17 | 18 | def __init__(
|
18 |
| - self, prog: str, indent_increment: int = 2, |
19 |
| - max_help_position: int = 24, width: int | None = None, |
| 19 | + self, |
| 20 | + prog: str, |
| 21 | + indent_increment: int = 2, |
| 22 | + max_help_position: int = 24, |
| 23 | + width: int | None = None, |
| 24 | + **kwargs: Any, |
20 | 25 | ) -> None:
|
21 | 26 | max_help_position = 40
|
22 | 27 | super().__init__(
|
23 |
| - prog, indent_increment=indent_increment, |
24 |
| - max_help_position=max_help_position, width=width) |
| 28 | + prog, |
| 29 | + indent_increment=indent_increment, |
| 30 | + max_help_position=max_help_position, |
| 31 | + width=width, |
| 32 | + **kwargs, |
| 33 | + ) |
25 | 34 |
|
26 | 35 |
|
27 | 36 | async def async_main(argv: list[str] | None = None) -> int:
|
| 37 | + parser_kwargs: dict[str, Any] = {} |
| 38 | + if sys.version_info >= (3, 14): |
| 39 | + parser_kwargs["color"] = True |
| 40 | + |
28 | 41 | parser = argparse.ArgumentParser(
|
29 | 42 | description="Tool to update Python typing syntax.",
|
30 | 43 | formatter_class=CustomHelpFormatter,
|
| 44 | + **parser_kwargs, |
31 | 45 | )
|
32 | 46 | formatter_options = parser.add_argument_group("select optional formatter")
|
33 | 47 | mode_options = parser.add_argument_group("select different mode")
|
|
0 commit comments