-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathcli.py
More file actions
76 lines (57 loc) · 1.59 KB
/
cli.py
File metadata and controls
76 lines (57 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
from typing import Annotated
import typer
from rich import print
from . import __version__
from .commands.deploy import deploy
from .commands.env import env_app
from .commands.link import link
from .commands.login import login
from .commands.logout import logout
from .commands.logs import logs
from .commands.setup_ci import setup_ci
from .commands.unlink import unlink
from .commands.whoami import whoami
from .logging import setup_logging
from .utils.sentry import init_sentry
setup_logging()
app = typer.Typer(rich_markup_mode="rich")
def version_callback(value: bool) -> None:
if value:
print(f"FastAPI Cloud CLI version: [green]{__version__}[/green]")
raise typer.Exit()
cloud_app = typer.Typer(
rich_markup_mode="rich",
help="Manage [bold]FastAPI[/bold] Cloud deployments. 🚀",
no_args_is_help=True,
)
@cloud_app.callback()
def cloud_main(
version: Annotated[
bool,
typer.Option(
"--version",
callback=version_callback,
is_eager=True,
help="Show the version and exit.",
),
] = False,
) -> None: ...
# TODO: use the app structure
# Additional commands
# fastapi cloud [command]
cloud_app.command()(deploy)
cloud_app.command()(link)
cloud_app.command()(login)
cloud_app.command()(logs)
cloud_app.command()(logout)
cloud_app.command()(whoami)
cloud_app.command()(unlink)
cloud_app.command()(setup_ci)
cloud_app.add_typer(env_app, name="env")
# fastapi [command]
app.command()(deploy)
app.command()(login)
app.add_typer(cloud_app, name="cloud")
def main() -> None:
init_sentry()
app()