Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Sep 3, 2022. It is now read-only.

Conversation

ojarjur
Copy link
Contributor

@ojarjur ojarjur commented Feb 8, 2018

The datalab command is meant to support a set of flags (such
as "project" and "zone") at two different levels. The first level
is right after the datalab command itself. The second level is
after one of the subcommands (e.g. create, or stop).

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

The `datalab` command is meant to support a set of flags (such
as "project" and "zone") at two different levels. The first level
is right after the `datalab` command itself. The second level is
after one of the subcommands (e.g. `create`, or `stop`).

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
@ojarjur ojarjur requested a review from chmeyers February 8, 2018 22:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Command line tool ignores --project flag if flag appears before command
2 participants