|
1 | 1 | """Core cloud commands for Basic Memory CLI.""" |
2 | 2 |
|
3 | | -import asyncio |
4 | | - |
5 | 3 | import typer |
6 | 4 | from rich.console import Console |
7 | 5 |
|
8 | 6 | from basic_memory.cli.app import cloud_app |
| 7 | +from basic_memory.cli.commands.command_utils import run_with_cleanup |
9 | 8 | from basic_memory.cli.auth import CLIAuth |
10 | 9 | from basic_memory.config import ConfigManager |
11 | 10 | from basic_memory.cli.commands.cloud.api_client import ( |
@@ -64,7 +63,7 @@ async def _login(): |
64 | 63 | ) |
65 | 64 | raise typer.Exit(1) |
66 | 65 |
|
67 | | - asyncio.run(_login()) |
| 66 | + run_with_cleanup(_login()) |
68 | 67 |
|
69 | 68 |
|
70 | 69 | @cloud_app.command() |
@@ -110,7 +109,7 @@ def status() -> None: |
110 | 109 | console.print("\n[blue]Checking cloud instance health...[/blue]") |
111 | 110 |
|
112 | 111 | # Make API request to check health |
113 | | - response = asyncio.run( |
| 112 | + response = run_with_cleanup( |
114 | 113 | make_api_request(method="GET", url=f"{host_url}/proxy/health", headers=headers) |
115 | 114 | ) |
116 | 115 |
|
@@ -156,12 +155,12 @@ def setup() -> None: |
156 | 155 |
|
157 | 156 | # Step 2: Get tenant info |
158 | 157 | console.print("\n[blue]Step 2: Getting tenant information...[/blue]") |
159 | | - tenant_info = asyncio.run(get_mount_info()) |
| 158 | + tenant_info = run_with_cleanup(get_mount_info()) |
160 | 159 | console.print(f"[green]Found tenant: {tenant_info.tenant_id}[/green]") |
161 | 160 |
|
162 | 161 | # Step 3: Generate credentials |
163 | 162 | console.print("\n[blue]Step 3: Generating sync credentials...[/blue]") |
164 | | - creds = asyncio.run(generate_mount_credentials(tenant_info.tenant_id)) |
| 163 | + creds = run_with_cleanup(generate_mount_credentials(tenant_info.tenant_id)) |
165 | 164 | console.print("[green]Generated secure credentials[/green]") |
166 | 165 |
|
167 | 166 | # Step 4: Configure rclone remote |
|
0 commit comments