Clean cli
This commit is contained in:
parent
64d564f519
commit
5c490f5127
1 changed files with 4 additions and 7 deletions
|
@ -1,6 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
from importlib.metadata import version as importlib_version
|
||||
from sqlalchemy.engine import create
|
||||
from typing_extensions import Annotated
|
||||
import typer
|
||||
|
||||
|
@ -11,7 +9,6 @@ cli = typer.Typer(no_args_is_help=True, help="Gisaf GIS backend")
|
|||
@cli.command()
|
||||
def create_db():
|
||||
"""Populate the database with a functional empty structure"""
|
||||
from gisaf.application import app
|
||||
from gisaf.database import create_db
|
||||
from asyncio import run
|
||||
|
||||
|
@ -36,15 +33,15 @@ def serve(host: str = "localhost", port: int = 8000):
|
|||
|
||||
def version_callback(show_version: bool):
|
||||
if show_version:
|
||||
print(importlib_version("gisaf-backend"))
|
||||
from gisaf import __version__
|
||||
|
||||
typer.echo(__version__)
|
||||
raise typer.Exit()
|
||||
|
||||
|
||||
@cli.callback()
|
||||
def main(
|
||||
version: Annotated[
|
||||
bool | None, typer.Option("--version", callback=version_callback)
|
||||
] = None
|
||||
version: Annotated[bool | None, typer.Option("--version", callback=version_callback)] = None,
|
||||
):
|
||||
pass
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue