Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions nbs/00_core.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,32 @@
" print(f\"Downloaded your app to: {save_path}\")"
]
},
{
"cell_type": "markdown",
"id": "7de8c8e8",
"metadata": {},
"source": [
"## List Apps"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3fca3967",
"metadata": {},
"outputs": [],
"source": [
"#|export\n",
"@call_parse\n",
"def apps(verbose:bool=False):\n",
" \"List your deployed apps (verbose shows status table: 1=running, 0=stopped)\"\n",
" r = mk_auth_req(endpoint(rt=\"/user_apps\")).raise_for_status()\n",
" apps = r.json()\n",
" if not apps: return \"You don't have any deployed Plash apps.\"\n",
" if verbose: [print(f'{a['running']} {a['name']}') for a in apps]\n",
" else: [print(a['name']) for a in apps]"
]
},
{
"cell_type": "markdown",
"id": "3748636e",
Expand Down
178 changes: 96 additions & 82 deletions nbs/reference/00_cli.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,48 +10,69 @@
"> An overview of the Plash CLI commands"
]
},
{
"cell_type": "markdown",
"id": "897236fc",
"metadata": {},
"source": [
"## plash_login"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "89996de5",
"id": "1267196a",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"usage: plash_login [-h]\n",
"\n",
"Authenticate CLI with server and save config\n",
"\n",
"options:\n",
" -h, --help show this help message and exit\n"
]
}
],
"source": [
"#| hide\n",
"from plash_cli._bash_magic import *"
"%%bash\n",
"plash_login --help"
]
},
{
"cell_type": "markdown",
"id": "897236fc",
"id": "d68f6131",
"metadata": {},
"source": [
"## plash_login"
"## plash_apps"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1267196a",
"id": "a27502f9",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"usage: plash_login [-h]\r\n",
"\r\n",
"Authenticate CLI with server and save config\r\n",
"\r\n",
"options:\r\n",
" -h, --help show this help message and exit\r\n",
"\n"
"usage: plash_apps [-h] [--verbose]\n",
"\n",
"List your deployed apps (verbose shows status table: 1=running, 0=stopped)\n",
"\n",
"options:\n",
" -h, --help show this help message and exit\n",
" --verbose (default: False)\n"
]
}
],
"source": [
"%%bash\n",
"plash_login --help"
"plash_apps --help"
]
},
{
Expand All @@ -72,15 +93,14 @@
"name": "stdout",
"output_type": "stream",
"text": [
"usage: plash_deploy [-h] [--path PATH] [--name NAME]\r\n",
"\r\n",
"Deploy app to production (ignores paths starting with '.')\r\n",
"\r\n",
"options:\r\n",
" -h, --help show this help message and exit\r\n",
" --path PATH Path to project (default: .)\r\n",
" --name NAME Overrides the .plash file in project root if provided\r\n",
"\n"
"usage: plash_deploy [-h] [--path PATH] [--name NAME]\n",
"\n",
"Deploy app to production (ignores paths starting with '.')\n",
"\n",
"options:\n",
" -h, --help show this help message and exit\n",
" --path PATH Path to project (default: .)\n",
" --name NAME Overrides the .plash file in project root if provided\n"
]
}
],
Expand All @@ -107,15 +127,14 @@
"name": "stdout",
"output_type": "stream",
"text": [
"usage: plash_view [-h] [--path PATH] [--name NAME]\r\n",
"\r\n",
"Open your app in the browser\r\n",
"\r\n",
"options:\r\n",
" -h, --help show this help message and exit\r\n",
" --path PATH Path to project directory (default: .)\r\n",
" --name NAME Overrides the .plash file in project root if provided\r\n",
"\n"
"usage: plash_view [-h] [--path PATH] [--name NAME]\n",
"\n",
"Open your app in the browser\n",
"\n",
"options:\n",
" -h, --help show this help message and exit\n",
" --path PATH Path to project directory (default: .)\n",
" --name NAME Overrides the .plash file in project root if provided\n"
]
}
],
Expand All @@ -142,15 +161,14 @@
"name": "stdout",
"output_type": "stream",
"text": [
"usage: plash_start [-h] [--path PATH] [--name NAME]\r\n",
"\r\n",
"Access the '/start' endpoint for your app\r\n",
"\r\n",
"options:\r\n",
" -h, --help show this help message and exit\r\n",
" --path PATH Path to project (default: .)\r\n",
" --name NAME Overrides the .plash file in project root if provided\r\n",
"\n"
"usage: plash_start [-h] [--path PATH] [--name NAME]\n",
"\n",
"Access the '/start' endpoint for your app\n",
"\n",
"options:\n",
" -h, --help show this help message and exit\n",
" --path PATH Path to project (default: .)\n",
" --name NAME Overrides the .plash file in project root if provided\n"
]
}
],
Expand All @@ -177,15 +195,14 @@
"name": "stdout",
"output_type": "stream",
"text": [
"usage: plash_stop [-h] [--path PATH] [--name NAME]\r\n",
"\r\n",
"Access the '/stop' endpoint for your app\r\n",
"\r\n",
"options:\r\n",
" -h, --help show this help message and exit\r\n",
" --path PATH Path to project (default: .)\r\n",
" --name NAME Overrides the .plash file in project root if provided\r\n",
"\n"
"usage: plash_stop [-h] [--path PATH] [--name NAME]\n",
"\n",
"Access the '/stop' endpoint for your app\n",
"\n",
"options:\n",
" -h, --help show this help message and exit\n",
" --path PATH Path to project (default: .)\n",
" --name NAME Overrides the .plash file in project root if provided\n"
]
}
],
Expand All @@ -212,17 +229,16 @@
"name": "stdout",
"output_type": "stream",
"text": [
"usage: plash_logs [-h] [--path PATH] [--name NAME] [--mode {build,app}] [--tail]\r\n",
"\r\n",
"Prints the logs for your deployed app\r\n",
"\r\n",
"options:\r\n",
" -h, --help show this help message and exit\r\n",
" --path PATH Path to project (default: .)\r\n",
" --name NAME Overrides the .plash file in project root if provided\r\n",
" --mode {build,app} Choose between build or app logs (default: build)\r\n",
" --tail Tail the logs (default: False)\r\n",
"\n"
"usage: plash_logs [-h] [--path PATH] [--name NAME] [--mode {build,app}] [--tail]\n",
"\n",
"Prints the logs for your deployed app\n",
"\n",
"options:\n",
" -h, --help show this help message and exit\n",
" --path PATH Path to project (default: .)\n",
" --name NAME Overrides the .plash file in project root if provided\n",
" --mode {build,app} Choose between build or app logs (default: build)\n",
" --tail Tail the logs (default: False)\n"
]
}
],
Expand All @@ -249,16 +265,15 @@
"name": "stdout",
"output_type": "stream",
"text": [
"usage: plash_download [-h] [--path PATH] [--name NAME] [--save_path SAVE_PATH]\r\n",
"\r\n",
"Download your deployed app\r\n",
"\r\n",
"options:\r\n",
" -h, --help show this help message and exit\r\n",
" --path PATH Path to project (default: .)\r\n",
" --name NAME Overrides the .plash file in project root if provided\r\n",
" --save_path SAVE_PATH Save path (optional) (default: download)\r\n",
"\n"
"usage: plash_download [-h] [--path PATH] [--name NAME] [--save_path SAVE_PATH]\n",
"\n",
"Download your deployed app\n",
"\n",
"options:\n",
" -h, --help show this help message and exit\n",
" --path PATH Path to project (default: .)\n",
" --name NAME Overrides the .plash file in project root if provided\n",
" --save_path SAVE_PATH Save path (optional) (default: download)\n"
]
}
],
Expand All @@ -285,16 +300,15 @@
"name": "stdout",
"output_type": "stream",
"text": [
"usage: plash_delete [-h] [--path PATH] [--name NAME] [--force]\r\n",
"\r\n",
"Delete your deployed app\r\n",
"\r\n",
"options:\r\n",
" -h, --help show this help message and exit\r\n",
" --path PATH Path to project (default: .)\r\n",
" --name NAME Overrides the .plash file in project root if provided\r\n",
" --force Skip confirmation prompt (default: False)\r\n",
"\n"
"usage: plash_delete [-h] [--path PATH] [--name NAME] [--force]\n",
"\n",
"Delete your deployed app\n",
"\n",
"options:\n",
" -h, --help show this help message and exit\n",
" --path PATH Path to project (default: .)\n",
" --name NAME Overrides the .plash file in project root if provided\n",
" --force Skip confirmation prompt (default: False)\n"
]
}
],
Expand Down
1 change: 1 addition & 0 deletions plash_cli/_modidx.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
'lib_path': 'plash_cli'},
'syms': { 'plash_cli.core': { 'plash_cli.core.PlashError': ('core.html#plasherror', 'plash_cli/core.py'),
'plash_cli.core._deps': ('core.html#_deps', 'plash_cli/core.py'),
'plash_cli.core.apps': ('core.html#apps', 'plash_cli/core.py'),
'plash_cli.core.create_tar_archive': ('core.html#create_tar_archive', 'plash_cli/core.py'),
'plash_cli.core.delete': ('core.html#delete', 'plash_cli/core.py'),
'plash_cli.core.deploy': ('core.html#deploy', 'plash_cli/core.py'),
Expand Down
12 changes: 11 additions & 1 deletion plash_cli/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# %% auto 0
__all__ = ['PLASH_CONFIG_HOME', 'PLASH_DOMAIN', 'pat', 'stop', 'start', 'log_modes', 'get_client', 'mk_auth_req', 'get_app_name',
'endpoint', 'is_included', 'poll_cookies', 'login', 'PlashError', 'validate_app', 'create_tar_archive',
'deploy', 'view', 'delete', 'endpoint_func', 'logs', 'download']
'deploy', 'view', 'delete', 'endpoint_func', 'logs', 'download', 'apps']

# %% ../nbs/00_core.ipynb 2
from fastcore.all import *
Expand Down Expand Up @@ -249,3 +249,13 @@ def download(
file_bytes = io.BytesIO(response.content)
with tarfile.open(fileobj=file_bytes, mode="r:gz") as tar: tar.extractall(path=save_path)
print(f"Downloaded your app to: {save_path}")

# %% ../nbs/00_core.ipynb 37
@call_parse
def apps(verbose:bool=False):
"List your deployed apps (verbose shows status table: 1=running, 0=stopped)"
r = mk_auth_req(endpoint(rt="/user_apps")).raise_for_status()
apps = r.json()
if not apps: return "You don't have any deployed Plash apps."
if verbose: [print(f'{a['running']} {a['name']}') for a in apps]
else: [print(a['name']) for a in apps]
1 change: 1 addition & 0 deletions settings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ console_scripts = plash_deploy=plash_cli.core:deploy
plash_stop=plash_cli.core:stop
plash_start=plash_cli.core:start
plash_download=plash_cli.core:download
plash_apps=plash_cli.core:apps
readme_nb = index.ipynb
allowed_metadata_keys =
allowed_cell_metadata_keys =
Expand Down
Loading