Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Aug 29, 2024
1 parent ab09bb8 commit fab6b65
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/textual_dev/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,30 +226,38 @@ def _run_app(
else:
run_app(import_name, args, environment)


@run.command("serve")
@click.argument("command")
@click.option("-h", "--host", type=str, default="localhost", help="Host to serve on")
@click.option("-p", "--port", type=int, default=8000, help="Port of server")
@click.option("-t", "--title", type=str, default="Textual App", help="Name of the app being served")
@click.option(
"-t",
"--title",
type=str,
default="Textual App",
help="Name of the app being served",
)
@click.option("-u", "--url", type=str, default=None, help="Public URL")
@click.option("--dev", type=bool, default=False, is_flag=True, help="Enable debug mode")

def serve(command:str, host:str, port:int, title:str, url:str | None, dev:bool) -> None:
def serve(
command: str, host: str, port: int, title: str, url: str | None, dev: bool
) -> None:
"""Run a local web server to serve the application.
The command to run should be appended to "textual serve", and should include any python invocation.
textual serve "python -m textual"
You may also want to add the `--dev` switch, which will enable textual devtools.
textual serve --dev "python -m textual"
"""
from textual_serve.server import Server
server = Server(command, host, port, title=title, public_url=url)

server = Server(command, host, port, title=title, public_url=url)
server.serve(debug=dev)


Expand Down

0 comments on commit fab6b65

Please sign in to comment.