Skip to content

Commit 6e9f196

Browse files
committed
♻️ Update
1 parent e887c3b commit 6e9f196

File tree

1 file changed

+28
-23
lines changed

1 file changed

+28
-23
lines changed

src/fastapi_cloud_cli/commands/deploy.py

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,8 @@ def _configure_app(toolkit: RichToolkit, path_to_deploy: Path) -> AppConfig:
294294

295295
toolkit.print_line()
296296

297+
selected_app: AppResponse | None = None
298+
297299
if not create_new_app:
298300
with toolkit.progress("Fetching apps...") as progress:
299301
with handle_http_errors(
@@ -310,37 +312,40 @@ def _configure_app(toolkit: RichToolkit, path_to_deploy: Path) -> AppConfig:
310312

311313
raise typer.Exit(1)
312314

313-
app = toolkit.ask(
315+
selected_app = toolkit.ask(
314316
"Select the app you want to deploy to:",
315317
options=[Option({"name": app.slug, "value": app}) for app in apps],
316318
)
317-
else:
318-
app_name = toolkit.input(
319-
title="What's your app name?",
320-
default=_get_app_name(path_to_deploy),
321-
)
322319

323-
toolkit.print_line()
320+
app_name = selected_app.slug if selected_app else toolkit.input(
321+
title="What's your app name?",
322+
default=_get_app_name(path_to_deploy),
323+
)
324324

325-
toolkit.print("Deployment Configuration", tag="summary")
326-
toolkit.print(f" Team: [bold]{team.name}[/bold]")
327-
toolkit.print(f" App: [bold]{app_name}[/bold]")
328-
toolkit.print_line()
325+
toolkit.print_line()
329326

330-
choice = toolkit.ask(
331-
"Does everything look right?",
332-
tag="confirm",
333-
options=[
334-
Option({"name": "Yes, start the deployment!", "value": "deploy"}),
335-
Option({"name": "No, let me start over", "value": "cancel"}),
336-
],
337-
)
338-
toolkit.print_line()
327+
toolkit.print("Deployment Configuration", tag="summary")
328+
toolkit.print(f" Team: [bold]{team.name}[/bold]")
329+
toolkit.print(f" App: [bold]{app_name}[/bold]")
330+
toolkit.print_line()
339331

340-
if choice == "cancel":
341-
toolkit.print("Deployment cancelled.")
342-
raise typer.Exit(0)
332+
choice = toolkit.ask(
333+
"Does everything look right?",
334+
tag="confirm",
335+
options=[
336+
Option({"name": "Yes, start the deployment!", "value": "deploy"}),
337+
Option({"name": "No, let me start over", "value": "cancel"}),
338+
],
339+
)
340+
toolkit.print_line()
341+
342+
if choice == "cancel":
343+
toolkit.print("Deployment cancelled.")
344+
raise typer.Exit(0)
343345

346+
if selected_app:
347+
app = selected_app
348+
else:
344349
with toolkit.progress(title="Creating app...") as progress:
345350
with handle_http_errors(progress):
346351
app = _create_app(team.id, app_name)

0 commit comments

Comments
 (0)