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/switch_git.py b/switch_git.py
index 6be2f85..7010339 100755
--- a/switch_git.py
+++ b/switch_git.py
@@ -27,9 +27,9 @@
def create_argument_parser():
- parser = argparse.ArgumentParser()
+ parents = [common.common_argument_parser, common.session_optional_parser]
+ parser = argparse.ArgumentParser(parents=parents)
cli.patching_argparser_exit(parser)
- common.add_common_arguments(parser)
parser.add_argument(
'git_rev',
nargs='?',