@@ -150,10 +150,11 @@ def pip_install(package: str):
150150@click .option ("--port" , default = 20242 , help = "port number" , show_default = True )
151151@click .option ("--host" , default = "127.0.0.1" , help = "host" , show_default = True )
152152@click .option ("--reload" , is_flag = True , default = False , help = "auto reload, dev only" )
153- @click .option ("-f" , "--force" , is_flag = True , default = False , help = "shutdown alrealy runningserver " )
153+ @click .option ("-f" , "--force" , is_flag = True , default = False , help = "shutdown already running server " )
154154@click .option ("-s" , "--no-browser" , is_flag = True , default = False , help = "silent mode, do not open browser" )
155155@click .option ("--offline" , is_flag = True , default = False , help = "offline mode, do not use internet" )
156- def server (port : int , host : str , reload : bool , force : bool , no_browser : bool , offline : bool ):
156+ @click .option ("--server-url" , default = "https://uiauto.dev" , help = "uiauto.dev server url" , show_default = True )
157+ def server (port : int , host : str , reload : bool , force : bool , no_browser : bool , offline : bool , server_url : str ):
157158 click .echo (f"uiautodev version: { __version__ } " )
158159 if force :
159160 try :
@@ -165,10 +166,13 @@ def server(port: int, host: str, reload: bool, force: bool, no_browser: bool, of
165166 if platform .system () == 'Windows' :
166167 use_color = False
167168
169+ server_url = server_url .rstrip ('/' )
170+ from uiautodev .router import proxy
171+ proxy .base_url = server_url
172+
168173 if offline :
169- from uiautodev .router .proxy import cache_dir
170- cache_dir .mkdir (parents = True , exist_ok = True )
171- logger .info ("offline mode enabled, cache dir: %s" , cache_dir )
174+ proxy .cache_dir .mkdir (parents = True , exist_ok = True )
175+ logger .info ("offline mode enabled, cache dir: %s, server url: %s" , proxy .cache_dir , proxy .base_url )
172176
173177 if not no_browser :
174178 th = threading .Thread (target = open_browser_when_server_start , args = (f"http://{ host } :{ port } " , offline ))
0 commit comments