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/bisect_kit/common_test.py b/bisect_kit/common_test.py
index a05c628..3f118eb 100644
--- a/bisect_kit/common_test.py
+++ b/bisect_kit/common_test.py
@@ -30,8 +30,8 @@
def test_logging(self):
common.init()
- parser = argparse.ArgumentParser()
- common.add_common_arguments(parser)
+ parents = [common.common_argument_parser]
+ parser = argparse.ArgumentParser(parents=parents)
opts = parser.parse_args(['--log_file', self.log_file])
common.config_logging(opts)