From 3cfef4264b98388b3aa8f3c89a25270d44a0ef3e Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Fri, 22 Apr 2016 16:33:44 +0800 Subject: [PATCH] frontend: upper-case positional arguments in help messages --- artiq/frontend/artiq_client.py | 16 +++++++++------- artiq/frontend/artiq_compile.py | 5 +++-- artiq/frontend/artiq_coreconfig.py | 4 ++-- artiq/frontend/artiq_flash.py | 4 ++-- artiq/frontend/artiq_rpctool.py | 8 ++++---- artiq/frontend/artiq_run.py | 4 ++-- artiq/frontend/bit2bin.py | 9 ++++++--- 7 files changed, 28 insertions(+), 22 deletions(-) diff --git a/artiq/frontend/artiq_client.py b/artiq/frontend/artiq_client.py index a34ea876e..6513d82c0 100755 --- a/artiq/frontend/artiq_client.py +++ b/artiq/frontend/artiq_client.py @@ -60,9 +60,9 @@ def get_argparser(): help="increase logging level of the experiment") parser_add.add_argument("-q", "--quiet", default=0, action="count", help="decrease logging level of the experiment") - parser_add.add_argument("file", + parser_add.add_argument("file", metavar="FILE", help="file containing the experiment to run") - parser_add.add_argument("arguments", nargs="*", + parser_add.add_argument("arguments", metavar="ARGUMENTS", nargs="*", help="run arguments") parser_delete = subparsers.add_parser("delete", @@ -70,13 +70,14 @@ def get_argparser(): "from the schedule") parser_delete.add_argument("-g", action="store_true", help="request graceful termination") - parser_delete.add_argument("rid", type=int, + parser_delete.add_argument("rid", metavar="RID", type=int, help="run identifier (RID)") parser_set_dataset = subparsers.add_parser( "set-dataset", help="add or modify a dataset") - parser_set_dataset.add_argument("name", help="name of the dataset") - parser_set_dataset.add_argument("value", + parser_set_dataset.add_argument("name", metavar="NAME", + help="name of the dataset") + parser_set_dataset.add_argument("value", metavar="VALUE", help="value in PYON format") parser_set_dataset.add_argument("-p", "--persist", action="store_true", help="make the dataset persistent") @@ -88,7 +89,7 @@ def get_argparser(): parser_show = subparsers.add_parser( "show", help="show schedule, log, devices or datasets") parser_show.add_argument( - "what", + "what", metavar="WHAT", help="select object to show: schedule/log/devices/datasets") subparsers.add_parser( @@ -98,7 +99,8 @@ def get_argparser(): "scan-repository", help="trigger a repository (re)scan") parser_scan_repos.add_argument("--async", action="store_true", help="trigger scan and return immediately") - parser_scan_repos.add_argument("revision", default=None, nargs="?", + parser_scan_repos.add_argument("revision", metavar="REVISION", + default=None, nargs="?", help="use a specific repository revision " "(defaults to head)") diff --git a/artiq/frontend/artiq_compile.py b/artiq/frontend/artiq_compile.py index d7d9869ff..ed106548d 100755 --- a/artiq/frontend/artiq_compile.py +++ b/artiq/frontend/artiq_compile.py @@ -25,9 +25,10 @@ def get_argparser(): parser.add_argument("-o", "--output", default=None, help="output file") - parser.add_argument("file", + parser.add_argument("file", metavar="FILE", help="file containing the experiment to compile") - parser.add_argument("arguments", nargs="*", help="run arguments") + parser.add_argument("arguments", metavar="ARGUMENTS", + nargs="*", help="run arguments") return parser diff --git a/artiq/frontend/artiq_coreconfig.py b/artiq/frontend/artiq_coreconfig.py index 2abdef3e6..d8fdaeba5 100755 --- a/artiq/frontend/artiq_coreconfig.py +++ b/artiq/frontend/artiq_coreconfig.py @@ -21,7 +21,7 @@ def get_argparser(): p_read = subparsers.add_parser("read", help="read key from core device config") - p_read.add_argument("key", type=str, + p_read.add_argument("key", metavar="KEY", type=str, help="key to be read from core device config") p_write = subparsers.add_parser("write", @@ -39,7 +39,7 @@ def get_argparser(): p_delete = subparsers.add_parser("delete", help="delete key from core device config") - p_delete.add_argument("key", nargs=argparse.REMAINDER, + p_delete.add_argument("key", metavar="KEY", nargs=argparse.REMAINDER, default=[], type=str, help="key to be deleted from core device config") diff --git a/artiq/frontend/artiq_flash.py b/artiq/frontend/artiq_flash.py index 0d6e791ad..78cd60235 100755 --- a/artiq/frontend/artiq_flash.py +++ b/artiq/frontend/artiq_flash.py @@ -40,7 +40,7 @@ Prerequisites: help="target adapter, default: %(default)s") parser.add_argument("-f", "--storage", help="write file to storage area") parser.add_argument("-d", "--dir", help="look for files in this directory") - parser.add_argument("ACTION", nargs="*", + parser.add_argument("action", metavar="ACTION", nargs="*", default="proxy gateware bios runtime start".split(), help="actions to perform, default: %(default)s") return parser @@ -80,7 +80,7 @@ def main(): prog = [] prog.append("init") - for action in opts.ACTION: + for action in opts.action: if action == "proxy": proxy_base = "bscan_spi_{}.bit".format(config["chip"]) proxy = None diff --git a/artiq/frontend/artiq_rpctool.py b/artiq/frontend/artiq_rpctool.py index 066dd9b81..44d28716d 100755 --- a/artiq/frontend/artiq_rpctool.py +++ b/artiq/frontend/artiq_rpctool.py @@ -14,9 +14,9 @@ from artiq.protocols.pc_rpc import AutoTarget, Client def get_argparser(): parser = argparse.ArgumentParser( description="ARTIQ RPC tool") - parser.add_argument("server", + parser.add_argument("server", metavar="SERVER", help="hostname or IP of the controller to connect to") - parser.add_argument("port", type=int, + parser.add_argument("port", metavar="PORT", type=int, help="TCP port to use to connect to the controller") subparsers = parser.add_subparsers(dest="action") subparsers.add_parser("list-targets", help="list existing targets") @@ -25,8 +25,8 @@ def get_argparser(): parser_list_methods.add_argument("-t", "--target", help="target name") parser_call = subparsers.add_parser("call", help="call a target's method") parser_call.add_argument("-t", "--target", help="target name") - parser_call.add_argument("method", help="method name") - parser_call.add_argument("args", nargs=argparse.REMAINDER, + parser_call.add_argument("method", metavar="METHOD", help="method name") + parser_call.add_argument("args", metavar="ARGS", nargs=argparse.REMAINDER, help="arguments") parser_interactive = subparsers.add_parser("interactive", help="enter interactive mode " diff --git a/artiq/frontend/artiq_run.py b/artiq/frontend/artiq_run.py index 5180ea986..15450b907 100755 --- a/artiq/frontend/artiq_run.py +++ b/artiq/frontend/artiq_run.py @@ -128,9 +128,9 @@ def get_argparser(with_file=True): help="write results to specified HDF5 file" " (default: print them)") if with_file: - parser.add_argument("file", + parser.add_argument("file", metavar="FILE", help="file containing the experiment to run") - parser.add_argument("arguments", nargs="*", + parser.add_argument("arguments", metavar="ARGUMENTS", nargs="*", help="run arguments") return parser diff --git a/artiq/frontend/bit2bin.py b/artiq/frontend/bit2bin.py index a537fc209..dba87159c 100755 --- a/artiq/frontend/bit2bin.py +++ b/artiq/frontend/bit2bin.py @@ -69,11 +69,14 @@ def bit2bin(bit, bin, flip=False): if __name__ == "__main__": import argparse parser = argparse.ArgumentParser( - description="Convert FPGA bit files to raw bin format suitable for flashing") + description="Convert FPGA bit files to raw bin format " + "suitable for flashing") parser.add_argument("-f", "--flip", dest="flip", action="store_true", default=False, help="Flip 32-bit endianess (needed for Zynq)") - parser.add_argument("bitfile", help="Input bit file name") - parser.add_argument("binfile", help="Output bin file name") + parser.add_argument("bitfile", metavar="BITFILE", + help="Input bit file name") + parser.add_argument("binfile", metavar="BINFILE", + help="Output bin file name") args = parser.parse_args() bit2bin(args.bitfile, args.binfile, args.flip)