forked from mirror/Archipelago
TWW: Support launcher command line arguments (#5806)
* Support launcher command line arguments * Use `launch` instead of `launch_subprocess` * Remove old runner code
This commit is contained in:
@@ -696,12 +696,11 @@ async def dolphin_sync_task(ctx: TWWContext) -> None:
|
||||
continue
|
||||
|
||||
|
||||
def main(connect: Optional[str] = None, password: Optional[str] = None) -> None:
|
||||
def main(*args: str) -> None:
|
||||
"""
|
||||
Run the main async loop for the Wind Waker client.
|
||||
|
||||
:param connect: Address of the Archipelago server.
|
||||
:param password: Password for server authentication.
|
||||
:param *args: Command line arguments passed to the client.
|
||||
"""
|
||||
Utils.init_logging("The Wind Waker Client")
|
||||
|
||||
@@ -726,14 +725,11 @@ def main(connect: Optional[str] = None, password: Optional[str] = None) -> None:
|
||||
if ctx.dolphin_sync_task:
|
||||
await ctx.dolphin_sync_task
|
||||
|
||||
parser = get_base_parser()
|
||||
parsed_args = parser.parse_args(args)
|
||||
|
||||
import colorama
|
||||
|
||||
colorama.init()
|
||||
asyncio.run(_main(connect, password))
|
||||
asyncio.run(_main(parsed_args.connect, parsed_args.password))
|
||||
colorama.deinit()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = get_base_parser()
|
||||
args = parser.parse_args()
|
||||
main(args.connect, args.password)
|
||||
|
||||
@@ -13,7 +13,7 @@ from Options import Toggle
|
||||
from worlds.AutoWorld import WebWorld, World
|
||||
from worlds.Files import APPlayerContainer
|
||||
from worlds.generic.Rules import add_item_rule
|
||||
from worlds.LauncherComponents import Component, SuffixIdentifier, Type, components, icon_paths, launch_subprocess
|
||||
from worlds.LauncherComponents import Component, SuffixIdentifier, Type, components, icon_paths, launch
|
||||
|
||||
from .Items import ISLAND_NUMBER_TO_CHART_NAME, ITEM_TABLE, TWWItem, item_name_groups
|
||||
from .Locations import LOCATION_TABLE, TWWFlag, TWWLocation
|
||||
@@ -29,14 +29,16 @@ from .Rules import set_rules
|
||||
VERSION: tuple[int, int, int] = (3, 0, 0)
|
||||
|
||||
|
||||
def run_client() -> None:
|
||||
def run_client(*args: str) -> None:
|
||||
"""
|
||||
Launch the The Wind Waker client.
|
||||
|
||||
:param *args: Variable length argument list passed to the client.
|
||||
"""
|
||||
print("Running The Wind Waker Client")
|
||||
from .TWWClient import main
|
||||
|
||||
launch_subprocess(main, name="TheWindWakerClient")
|
||||
launch(main, name="TheWindWakerClient", args=args)
|
||||
|
||||
|
||||
components.append(
|
||||
|
||||
Reference in New Issue
Block a user