create infinite
This commit is contained in:
parent
54b3c4bc9b
commit
7bff037b78
14 changed files with 419 additions and 4 deletions
44
htmx_patterns/cli/api.py
Normal file
44
htmx_patterns/cli/api.py
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
import typer
|
||||
import uvicorn
|
||||
from rich.console import Console
|
||||
|
||||
from htmx_patterns.config import get_config
|
||||
|
||||
api_app = typer.Typer()
|
||||
|
||||
|
||||
|
||||
@api_app.callback()
|
||||
def api():
|
||||
"model cli"
|
||||
|
||||
|
||||
@api_app.command()
|
||||
def config(
|
||||
env: str = typer.Option(
|
||||
"local",
|
||||
help="the environment to use",
|
||||
),
|
||||
):
|
||||
config = get_config(env)
|
||||
Console().print(config)
|
||||
|
||||
|
||||
@api_app.command()
|
||||
def run(
|
||||
env: str = typer.Option(
|
||||
"local",
|
||||
help="the environment to use",
|
||||
),
|
||||
alembic_revision: str = typer.Option(
|
||||
"head",
|
||||
help="the alembic revision to use",
|
||||
),
|
||||
):
|
||||
config = get_config(env)
|
||||
Console().print(config.api_server)
|
||||
uvicorn.run(**config.api_server.dict())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
api_app()
|
||||
7
htmx_patterns/cli/cli.py
Normal file
7
htmx_patterns/cli/cli.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import typer
|
||||
|
||||
from htmx_patterns.cli.api import api_app
|
||||
|
||||
app = typer.Typer()
|
||||
|
||||
app.add_typer(api_app, name="api")
|
||||
Loading…
Add table
Add a link
Reference in a new issue