mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-29 05:03:34 +08:00
afws_client: extract get_argparser() for modular arg parsing
This commit is contained in:
parent
5dbf870e68
commit
c05b109d5f
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user