bisect-kit: revise argument parsing
Currently, the command line argument parser only accepts syntax like
(note the order of --session)
A) ./bisect_list.py --session id init --old foo --new bar
but not
B) ./bisect_list.py init --session id --old foo --new bar
This CL reversed the behavior: reject the former and accept the latter.
Be careful this change is not backward compatible.
BUG=None
TEST=run all scripts and their subcommands with --help
Change-Id: Ifbe6035f2d83d0f0b03e747db9f17880e45bde77
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/bisect-kit/+/2653434
Reviewed-by: Zheng-Jie Chang <zjchang@chromium.org>
Commit-Queue: Kuang-che Wu <kcwu@chromium.org>
Tested-by: Kuang-che Wu <kcwu@chromium.org>
diff --git a/runner.py b/runner.py
index 3c0d000..1ee40b7 100755
--- a/runner.py
+++ b/runner.py
@@ -60,6 +60,7 @@
Returns:
An argparse.ArgumentParser instance.
"""
+ parents = [common.common_argument_parser, common.session_optional_parser]
parser = argparse.ArgumentParser(
description=textwrap.dedent("""
Helper script to report exit code according to execution result.
@@ -67,9 +68,9 @@
If precondition specified but not meet, returns SKIP. Returns WANT
only if any conditions meet.
"""),
- formatter_class=argparse.RawDescriptionHelpFormatter)
+ formatter_class=argparse.RawDescriptionHelpFormatter,
+ parents=parents)
cli.patching_argparser_exit(parser)
- common.add_common_arguments(parser)
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument(
'--new',