This repository was archived by the owner on Sep 3, 2022. It is now read-only.
Fix a bug in the parsing of top-level flags. #1950
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
datalab
command is meant to support a set of flags (suchas "project" and "zone") at two different levels. The first level
is right after the
datalab
command itself. The second level isafter one of the subcommands (e.g.
create
, orstop
).However, the flags defined at each level used the same destination
field in the returned argparse namespace. That seems to have caused
an issue where the default of the nested flag would override any
specified value for the top-level flag. That resulted in the top
level flags being no-ops; an value provided to them was ignored.
This fixes that issue by having two separate destinations for a
flag defined at both the top-level and in a subcommand. The tool
then resolves any provided values manually, favoring the nested
flag value if both are provided.
This fixes #1933