In commit 78628572 the argument parser for piglit run and piglit-run.py were split into two parsers to allow piglit.conf to be loaded before any additional parsing was done. This had the unintended side effect of breaking the -h/--help option since the first very limited parser took that option.
This commit fixes this by having the first parser not generate a help message. This means that when it parses the command line for arguments it knows it skips help, and passes it on to the main parser. The main parser has been augmented with a dummy version of the config file option so that option will show up in the help message. Signed-off-by: Dylan Baker <[email protected]> --- framework/programs/run.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/framework/programs/run.py b/framework/programs/run.py index 9a6276f..021443a 100644 --- a/framework/programs/run.py +++ b/framework/programs/run.py @@ -94,12 +94,11 @@ def _run_parser(input_): """ Parser for piglit run command """ # Parse the config file before any other options, this allows the config # file to be used to sete default values for the parser. - parser = argparse.ArgumentParser() + parser = argparse.ArgumentParser(add_help=False) parser.add_argument("-f", "--config", dest="config_file", type=argparse.FileType("r"), - help="Optionally specify a piglit config file to use. " - "Default is piglit.conf") + help="override piglit.conf search path") known, unparsed = parser.parse_known_args(input_) # Read the config file @@ -163,6 +162,12 @@ def _run_parser(input_): parser.add_argument("-s", "--sync", action="store_true", help="Sync results to disk after every test") + # -f/--config is a duplicate that cannot be hit, but is needed for help + # generation + parser.add_argument("-f", "--config", + metavar="config_file", + dest="__unused", + help="override piglit.conf search path") parser.add_argument("test_profile", metavar="<Path to one or more test profile(s)>", nargs='+', -- 2.1.0 _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
