forked from M-Labs/artiq
1
0
Fork 0

afws_client: extract get_argparser() for modular arg parsing

This commit is contained in:
Florian Agbuya 2024-07-15 12:22:04 +08:00 committed by Sébastien Bourdeauducq
parent da5de4b537
commit 9a5ca15b80
1 changed files with 5 additions and 1 deletions

View File

@ -162,7 +162,7 @@ class Client:
return "OK", json_str
def main():
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)")
@ -184,7 +184,11 @@ def main():
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
def main():
args = get_argparser().parse_args()
client = Client(args.server, args.port, args.cert)
try:
if args.action == "build":