@@ -226,30 +226,38 @@ def _run_app(
226
226
else :
227
227
run_app (import_name , args , environment )
228
228
229
+
229
230
@run .command ("serve" )
230
231
@click .argument ("command" )
231
232
@click .option ("-h" , "--host" , type = str , default = "localhost" , help = "Host to serve on" )
232
233
@click .option ("-p" , "--port" , type = int , default = 8000 , help = "Port of server" )
233
- @click .option ("-t" , "--title" , type = str , default = "Textual App" , help = "Name of the app being served" )
234
+ @click .option (
235
+ "-t" ,
236
+ "--title" ,
237
+ type = str ,
238
+ default = "Textual App" ,
239
+ help = "Name of the app being served" ,
240
+ )
234
241
@click .option ("-u" , "--url" , type = str , default = None , help = "Public URL" )
235
242
@click .option ("--dev" , type = bool , default = False , is_flag = True , help = "Enable debug mode" )
236
-
237
- def serve (command :str , host :str , port :int , title :str , url :str | None , dev :bool ) -> None :
243
+ def serve (
244
+ command : str , host : str , port : int , title : str , url : str | None , dev : bool
245
+ ) -> None :
238
246
"""Run a local web server to serve the application.
239
-
247
+
240
248
The command to run should be appended to "textual serve", and should include any python invocation.
241
249
242
250
textual serve "python -m textual"
243
251
244
252
You may also want to add the `--dev` switch, which will enable textual devtools.
245
253
246
254
textual serve --dev "python -m textual"
247
-
248
-
255
+
256
+
249
257
"""
250
258
from textual_serve .server import Server
251
-
252
- server = Server (command , host , port , title = title , public_url = url )
259
+
260
+ server = Server (command , host , port , title = title , public_url = url )
253
261
server .serve (debug = dev )
254
262
255
263
0 commit comments