frontend: upper-case positional arguments in help messages

This commit is contained in:
Sebastien Bourdeauducq 2016-04-22 16:33:44 +08:00
parent 3492ff1105
commit 3cfef4264b
7 changed files with 28 additions and 22 deletions

View File

@ -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)")

View File

@ -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

View File

@ -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")

View File

@ -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

View File

@ -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 "

View File

@ -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

View File

@ -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)