diff --git a/run_controller_cli.py b/run_controller_cli.py index be745eb..22bd2c5 100755 --- a/run_controller_cli.py +++ b/run_controller_cli.py @@ -136,19 +136,6 @@ async def test_controller_buttons(controller_state: ControllerState): await button_push(controller_state, 'home') -async def set_nfc(controller_state, file_path): - """ - Sets nfc content of the controller state to contents of the given file. - :param controller_state: Emulated controller state - :param file_path: Path to nfc dump file - """ - loop = asyncio.get_event_loop() - - with open(file_path, 'rb') as nfc_file: - content = await loop.run_in_executor(None, nfc_file.read) - controller_state.set_nfc(content) - - def ensure_valid_button(controller_state, *buttons): """ Raise ValueError if any of the given buttons os not part of the controller state. @@ -177,6 +164,106 @@ async def mash_button(controller_state, button, interval): await user_input +def _register_commands_with_controller_state(controller_state, cli): + """ + Commands registered here can use the given controller state. + The doc string of commands will be printed by the CLI when calling "help" + :param cli: + :param controller_state: + """ + async def test_buttons(): + """ + test_buttons - Navigates to the "Test Controller Buttons" menu and presses all buttons. + """ + await test_controller_buttons(controller_state) + + cli.add_command(test_buttons.__name__, test_buttons) + + # Mash a button command + async def mash(*args): + """ + mash - Mash a specified button at a set interval + + Usage: + mash