|
37 | 37 | from os import get_terminal_size, makedirs |
38 | 38 | from pathlib import Path |
39 | 39 | from shutil import rmtree |
40 | | -from typing import NoReturn, Optional |
| 40 | +from typing import Annotated, NoReturn, Optional |
41 | 41 |
|
42 | 42 | import typer |
43 | 43 | from httpx import AsyncClient, HTTPStatusError, RequestError, Response |
|
67 | 67 | __version__ = "1.1.0 Io" |
68 | 68 |
|
69 | 69 | app = typer.Typer( |
70 | | - name="pacup", |
71 | | - context_settings={"help_option_names": ["-h", "--help"]} |
| 70 | + name="pacup", context_settings={"help_option_names": ["-h", "--help"]} |
72 | 71 | ) |
73 | 72 |
|
74 | 73 |
|
@@ -273,35 +272,46 @@ def version_callback(value: bool) -> None: |
273 | 272 | # HACK: This uses `Optional` due to a typer bug: https://github.com/tiangolo/typer/issues/533 |
274 | 273 | @app.command() |
275 | 274 | def command( |
276 | | - show_repology: Optional[bool] = typer.Option( |
277 | | - None, |
278 | | - "-r", |
279 | | - "--show-repology", |
280 | | - help="Show the parsed repology data and exit.", |
281 | | - ), |
282 | | - debug: Optional[bool] = typer.Option( |
283 | | - None, "-d", "--debug", help="Turn on debugging mode." |
284 | | - ), |
285 | | - _: Optional[bool] = typer.Option( |
286 | | - None, |
287 | | - "-v", |
288 | | - "--version", |
289 | | - help="Show the version and exit.", |
290 | | - callback=version_callback, |
291 | | - is_eager=True, |
292 | | - ), |
293 | | - ship: Optional[bool] = typer.Option( |
294 | | - None, "-s", "--ship", help="Prepare the pacscript for shipping to upstream." |
295 | | - ), |
296 | | - pacscripts: list[Path] = typer.Argument( |
297 | | - ..., |
298 | | - help="The pacscripts to update.", |
299 | | - exists=True, |
300 | | - writable=True, |
301 | | - dir_okay=False, |
302 | | - callback=validate_parameters, |
303 | | - autocompletion=autocomplete_command, |
304 | | - ), |
| 275 | + pacscripts: Annotated[ |
| 276 | + list[Path], |
| 277 | + typer.Argument( |
| 278 | + show_default=False, |
| 279 | + exists=True, |
| 280 | + writable=True, |
| 281 | + dir_okay=False, |
| 282 | + callback=validate_parameters, |
| 283 | + autocompletion=autocomplete_command, |
| 284 | + help="The pacscripts to update.", |
| 285 | + ), |
| 286 | + ], |
| 287 | + show_repology: Annotated[ |
| 288 | + Optional[bool], |
| 289 | + typer.Option( |
| 290 | + "-r", |
| 291 | + "--show-repology", |
| 292 | + help="Show the parsed repology data and exit.", |
| 293 | + ), |
| 294 | + ] = None, |
| 295 | + debug: Annotated[ |
| 296 | + Optional[bool], |
| 297 | + typer.Option("-d", "--debug", help="Turn on debugging mode."), |
| 298 | + ] = None, |
| 299 | + _: Annotated[ |
| 300 | + Optional[bool], |
| 301 | + typer.Option( |
| 302 | + "-v", |
| 303 | + "--version", |
| 304 | + help="Show the version and exit.", |
| 305 | + callback=version_callback, |
| 306 | + is_eager=True, |
| 307 | + ), |
| 308 | + ] = None, |
| 309 | + ship: Annotated[ |
| 310 | + Optional[bool], |
| 311 | + typer.Option( |
| 312 | + "-s", "--ship", help="Prepare the pacscript for shipping to upstream." |
| 313 | + ), |
| 314 | + ] = None, |
305 | 315 | ) -> NoReturn: |
306 | 316 | """ |
307 | 317 | Updates specified pacscripts. |
|
0 commit comments