acton
acton copied to clipboard
argparse should allow same option under different sub-commands
name here should be allowed:
p = argparse.Parser()
p.add_bool("json", "Output results as JSON")
lp = p.add_cmd("list", "list tests", _list_tests)
tp = p.add_cmd("test", "Run tests", _run_tests)
tp.add_option("name", "strlist", nargs="+", default=[], help="Filter tests by name")
pp = p.add_cmd("perf", "Performance benchmark tests", _run_perf_tests)
tp.add_option("name", "strlist", nargs="+", default=[], help="Filter tests by name")
pp.add_option("iterations", "int", "?", 1, "Number of iterations to run")
pp.add_option("min_time", "int", "?", 1000, "Minimum time to run a test in milliseconds")