diff --git a/malformer/__main__.py b/malformer/__main__.py index 7e606d91..477d9c53 100644 --- a/malformer/__main__.py +++ b/malformer/__main__.py @@ -1,5 +1,6 @@ from utils.downloader import Downloader from utils.ui import UI +from utils.args import get_cli_args from verify import Verifier from corrupter import Corrupter @@ -7,10 +8,10 @@ def main(): ui = UI() - account = ui.get_account() - device = ui.get_device() - route = ui.get_route(device) - if not account or not device or not route: quit() + account, device, route = get_cli_args() + account = account if account else ui.get_account() + device = device if device else ui.get_device() + route = route if route else ui.get_route(device) print(f'\n-------- Downloading raw driving files of {route} -----------') downloader = Downloader(account=account, dongleId=device, route=route) diff --git a/malformer/utils/args.py b/malformer/utils/args.py new file mode 100644 index 00000000..de1a324f --- /dev/null +++ b/malformer/utils/args.py @@ -0,0 +1,12 @@ +import argparse + +def get_cli_args(): + parser = argparse.ArgumentParser(description="A script to corrupt openpilot routes for comma connect") + + parser.add_argument('-a', '--account', type=str, help="JWT access token for comma account") + parser.add_argument('-d', '--device', type=str, help="dongleId of the device from which route was uploaded") + parser.add_argument('-r', '--route', type=str, help="Unique ID of the route to be corrupted") + + args = parser.parse_args() + + return args.account, args.device, args.route \ No newline at end of file