From c05b109d5f307ee6eefc9a922b031001a72c07fd Mon Sep 17 00:00:00 2001 From: Florian Agbuya Date: Thu, 18 Jul 2024 12:45:32 +0800 Subject: [PATCH] afws_client: extract get_argparser() for modular arg parsing --- artiq/frontend/afws_client.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/artiq/frontend/afws_client.py b/artiq/frontend/afws_client.py index d8874c2c4..7778d4f66 100755 --- a/artiq/frontend/afws_client.py +++ b/artiq/frontend/afws_client.py @@ -168,7 +168,7 @@ class Client: return "OK", json_str -async def main_async(): +def get_argparser(): parser = argparse.ArgumentParser() parser.add_argument("--server", default="afws.m-labs.hk", help="server to connect to (default: %(default)s)") parser.add_argument("--port", default=80, type=int, help="port to connect to (default: %(default)d)") @@ -190,7 +190,11 @@ async def main_async(): act_get_json.add_argument("-o", "--out", default=None, help="output JSON file") act_get_json.add_argument("-f", "--force", action="store_true", help="overwrite file if it already exists") args = parser.parse_args() + return parser + +async def main_async(): + args = get_argparser().parse_args() client = Client(args.server, args.port, args.cert) await client.connect() try: