Skip to content

Commit b01438b

Browse files
authored
Better first-run experience. (#12)
1 parent 5b40994 commit b01438b

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

src/magentic_ui/backend/cli.py

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import os
22
import warnings
3-
from typing import Optional
4-
from pathlib import Path
53
import typer
64
import uvicorn
75
from typing_extensions import Annotated
6+
from typing import Optional
7+
from pathlib import Path
88

99
from .version import VERSION
1010
from .._docker import (
@@ -59,22 +59,37 @@ def ui(
5959
rebuild_docker: bool, optional: Rebuild the docker images. Defaults to False.
6060
"""
6161

62+
typer.echo(typer.style("Starting Magentic-UI", fg=typer.colors.GREEN, bold=True))
63+
6264
# Set things up for Docker
65+
typer.echo("Checking if Docker is running...", nl=False)
66+
6367
if not check_docker_running():
68+
typer.echo(typer.style("Failed\n", fg=typer.colors.RED, bold=True))
6469
typer.echo("Docker is not running. Please start Docker and try again.")
6570
raise typer.Exit(1)
71+
else:
72+
typer.echo(typer.style("OK", fg=typer.colors.GREEN, bold=True))
6673

74+
typer.echo("Checking Docker vnc browser image...", nl=False)
6775
if not check_browser_image() or rebuild_docker:
68-
typer.echo(
69-
"Docker image for vnc browser not found. Building the image (this may take a few minutes)..."
70-
)
76+
typer.echo(typer.style("Update\n", fg=typer.colors.YELLOW, bold=True))
77+
typer.echo("Building Docker vnc image (this WILL take a few minutes)")
7178
build_browser_image()
79+
typer.echo("\n")
80+
else:
81+
typer.echo(typer.style("OK", fg=typer.colors.GREEN, bold=True))
7282

83+
typer.echo("Checking Docker python image...", nl=False)
7384
if not check_python_image() or rebuild_docker:
74-
typer.echo(
75-
"Docker image for python not found. Building the image (this may take a few minutes)..."
76-
)
85+
typer.echo(typer.style("Update\n", fg=typer.colors.YELLOW, bold=True))
86+
typer.echo("Building Docker python image (this WILL take a few minutes)")
7787
build_python_image()
88+
typer.echo("\n")
89+
else:
90+
typer.echo(typer.style("OK", fg=typer.colors.GREEN, bold=True))
91+
92+
typer.echo("Launching Web Application...")
7893

7994
# Write configuration
8095
env_vars = {

0 commit comments

Comments
 (0)