Added --version option

This commit is contained in:
Ivan Golikov 2025-01-08 23:50:59 +01:00
parent fc77407379
commit 7f36eafc11
2 changed files with 4 additions and 0 deletions

View file

@ -51,6 +51,7 @@ Available configuration options:
--uds TEXT Bind to a UNIX domain socket. --uds TEXT Bind to a UNIX domain socket.
--workers INTEGER Number of worker processes. Defaults to the --workers INTEGER Number of worker processes. Defaults to the
$WEB_CONCURRENCY environment variable if available, or 1. $WEB_CONCURRENCY environment variable if available, or 1.
--version Show the version and exit.
--help Show this message and exit. --help Show this message and exit.
``` ```

View file

@ -1,3 +1,5 @@
from importlib.metadata import version
import click import click
import uvicorn import uvicorn
@ -21,5 +23,6 @@ import uvicorn
), ),
type=int, type=int,
) )
@click.version_option(version("pssecret_server"))
def cli(**kwargs) -> None: def cli(**kwargs) -> None:
uvicorn.run("pssecret_server.main:app", **kwargs) uvicorn.run("pssecret_server.main:app", **kwargs)