Skip to content

Commit e178da6

Browse files
authored
✨ Add fastapi cloud sub-command (#104)
1 parent 46598eb commit e178da6

File tree

8 files changed

+23
-11
lines changed

8 files changed

+23
-11
lines changed

src/fastapi_cloud_cli/cli.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,29 @@
1313

1414
app = typer.Typer(rich_markup_mode="rich")
1515

16+
cloud_app = typer.Typer(
17+
rich_markup_mode="rich",
18+
help="Manage [bold]FastAPI[/bold] Cloud deployments. 🚀",
19+
)
1620

1721
# TODO: use the app structure
1822

1923
# Additional commands
24+
25+
# fastapi cloud [command]
26+
cloud_app.command()(deploy)
27+
cloud_app.command()(login)
28+
cloud_app.command()(logout)
29+
cloud_app.command()(whoami)
30+
cloud_app.command()(unlink)
31+
32+
cloud_app.add_typer(env_app, name="env")
33+
34+
# fastapi [command]
2035
app.command()(deploy)
2136
app.command()(login)
22-
app.command()(logout)
23-
app.command()(whoami)
24-
app.command()(unlink)
2537

26-
app.add_typer(env_app, name="env")
38+
app.add_typer(cloud_app, name="cloud")
2739

2840

2941
def main() -> None:

src/fastapi_cloud_cli/commands/deploy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ def deploy(
575575
if not app:
576576
toolkit.print_line()
577577
toolkit.print(
578-
"If you deleted this app, you can run [bold]fastapi unlink[/] to unlink the local configuration.",
578+
"If you deleted this app, you can run [bold]fastapi cloud unlink[/] to unlink the local configuration.",
579579
tag="tip",
580580
)
581581
raise typer.Exit(1)

tests/test_cli_logout.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from typer.testing import CliRunner
44

5-
from fastapi_cloud_cli.cli import app
5+
from fastapi_cloud_cli.cli import cloud_app as app
66

77
runner = CliRunner()
88

tests/test_cli_unlink.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from typer.testing import CliRunner
55

6-
from fastapi_cloud_cli.cli import app
6+
from fastapi_cloud_cli.cli import cloud_app as app
77

88
runner = CliRunner()
99

tests/test_cli_whoami.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from httpx import ReadTimeout, Response
66
from typer.testing import CliRunner
77

8-
from fastapi_cloud_cli.cli import app
8+
from fastapi_cloud_cli.cli import cloud_app as app
99
from fastapi_cloud_cli.config import Settings
1010

1111
runner = CliRunner()

tests/test_env_delete.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from httpx import Response
77
from typer.testing import CliRunner
88

9-
from fastapi_cloud_cli.cli import app
9+
from fastapi_cloud_cli.cli import cloud_app as app
1010
from fastapi_cloud_cli.config import Settings
1111
from tests.utils import Keys, changing_dir
1212

tests/test_env_list.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from httpx import Response
66
from typer.testing import CliRunner
77

8-
from fastapi_cloud_cli.cli import app
8+
from fastapi_cloud_cli.cli import cloud_app as app
99
from fastapi_cloud_cli.config import Settings
1010
from tests.conftest import ConfiguredApp
1111
from tests.utils import changing_dir

tests/test_env_set.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from httpx import Response
77
from typer.testing import CliRunner
88

9-
from fastapi_cloud_cli.cli import app
9+
from fastapi_cloud_cli.cli import cloud_app as app
1010
from fastapi_cloud_cli.config import Settings
1111
from tests.utils import Keys, changing_dir
1212

0 commit comments

Comments
 (0)