about summary refs log tree commit diff stats
path: root/apworld/context.py
diff options
context:
space:
mode:
Diffstat (limited to 'apworld/context.py')
-rw-r--r--apworld/context.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/apworld/context.py b/apworld/context.py index 848efb8..2294491 100644 --- a/apworld/context.py +++ b/apworld/context.py
@@ -8,7 +8,7 @@ import websockets
8 8
9import Utils 9import Utils
10import settings 10import settings
11from CommonClient import CommonContext, server_loop, gui_enabled, logger 11from CommonClient import CommonContext, server_loop, gui_enabled, logger, get_base_parser, handle_url_arg
12from NetUtils import Endpoint, decode, encode 12from NetUtils import Endpoint, decode, encode
13from Utils import async_start 13from Utils import async_start
14 14
@@ -272,10 +272,10 @@ async def run_game():
272 272
273 273
274def client_main(*launch_args: str) -> None: 274def client_main(*launch_args: str) -> None:
275 async def main(): 275 async def main(args):
276 async_start(run_game()) 276 async_start(run_game())
277 277
278 client_ctx = Lingo2ClientContext() 278 client_ctx = Lingo2ClientContext(args.connect, args.password)
279 game_ctx = Lingo2GameContext() 279 game_ctx = Lingo2GameContext()
280 280
281 client_ctx.game_ctx = game_ctx 281 client_ctx.game_ctx = game_ctx
@@ -299,6 +299,14 @@ def client_main(*launch_args: str) -> None:
299 299
300 Utils.init_logging("Lingo2Client", exception_logger="Client") 300 Utils.init_logging("Lingo2Client", exception_logger="Client")
301 import colorama 301 import colorama
302
303 parser = get_base_parser(description="Lingo 2 Archipelago Client")
304 parser.add_argument('--name', default=None, help="Slot Name to connect as.")
305 parser.add_argument("url", nargs="?", help="Archipelago connection url")
306 args = parser.parse_args(launch_args)
307
308 args = handle_url_arg(args, parser=parser)
309
302 colorama.just_fix_windows_console() 310 colorama.just_fix_windows_console()
303 asyncio.run(main()) 311 asyncio.run(main(args))
304 colorama.deinit() 312 colorama.deinit()