Skip to content

Commit 02e8763

Browse files
simplify printing
1 parent 285ebe1 commit 02e8763

3 files changed

Lines changed: 6 additions & 43 deletions

File tree

nbs/00_core.ipynb

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -563,21 +563,11 @@
563563
"#|export\n",
564564
"@call_parse\n",
565565
"def apps():\n",
566-
" \"List all your deployed apps\"\n",
566+
" \"List your deployed apps (1=running, 0=stopped)\"\n",
567567
" r = mk_auth_req(endpoint(rt=\"/user_apps\")).raise_for_status()\n",
568568
" apps = r.json()\n",
569569
" if not apps: return \"You don't have any deployed Plash apps.\"\n",
570-
" \n",
571-
" print(\"\\nYour Plash Apps:\")\n",
572-
" print(\"=\" * 40)\n",
573-
" print(f\"{'APP NAME':<30} {'STATUS':<10}\")\n",
574-
" print(\"-\" * 40)\n",
575-
" \n",
576-
" for a in apps:\n",
577-
" status = \"RUNNING\" if a['running'] else \"stopped\"\n",
578-
" print(f\"{a['name']:<30} {status:<10}\")\n",
579-
" \n",
580-
" print(\"=\" * 40)"
570+
" for a in apps: print(f'{a['running']} {a['name']}')"
581571
]
582572
},
583573
{

nbs/reference/00_cli.ipynb

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"text": [
7575
"usage: plash_apps [-h]\r\n",
7676
"\r\n",
77-
"List all your deployed apps\r\n",
77+
"List your deployed apps (1=running, 0=stopped)\r\n",
7878
"\r\n",
7979
"options:\r\n",
8080
" -h, --help show this help message and exit\r\n",
@@ -315,24 +315,7 @@
315315
"execution_count": null,
316316
"id": "0c3663fa",
317317
"metadata": {},
318-
"outputs": [
319-
{
320-
"name": "stdout",
321-
"output_type": "stream",
322-
"text": [
323-
"usage: plash_delete [-h] [--path PATH] [--app_id APP_ID] [--force]\r\n",
324-
"\r\n",
325-
"Delete your deployed app\r\n",
326-
"\r\n",
327-
"options:\r\n",
328-
" -h, --help show this help message and exit\r\n",
329-
" --path PATH Path to project (default: .)\r\n",
330-
" --app_id APP_ID Overrides the .plash file in project root if provided\r\n",
331-
" --force Skip confirmation prompt (default: False)\r\n",
332-
"\n"
333-
]
334-
}
335-
],
318+
"outputs": [],
336319
"source": [
337320
"%%bash\n",
338321
"plash_delete --help"

plash_cli/core.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -246,18 +246,8 @@ def download(
246246
# %% ../nbs/00_core.ipynb 37
247247
@call_parse
248248
def apps():
249-
"List all your deployed apps"
249+
"List your deployed apps (1=running, 0=stopped)"
250250
r = mk_auth_req(endpoint(rt="/user_apps")).raise_for_status()
251251
apps = r.json()
252252
if not apps: return "You don't have any deployed Plash apps."
253-
254-
print("\nYour Plash Apps:")
255-
print("=" * 40)
256-
print(f"{'APP NAME':<30} {'STATUS':<10}")
257-
print("-" * 40)
258-
259-
for a in apps:
260-
status = "RUNNING" if a['running'] else "stopped"
261-
print(f"{a['name']:<30} {status:<10}")
262-
263-
print("=" * 40)
253+
for a in apps: print(f'{a['running']} {a['name']}')

0 commit comments

Comments
 (0)