-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
click working with list #6641
click working with list #6641
Conversation
Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide. |
|
||
output = click.option( | ||
"--output", | ||
envvar=None, | ||
help="TODO: No current help text", | ||
type=click.Choice(["json", "name", "path", "selector"], case_sensitive=False), | ||
default="name", | ||
default="selector", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Matching default value of "selector"
with what's in main.py on the main branch
2a9e72f
to
d4a423b
Compare
core/dbt/cli/options.py
Outdated
|
||
# Implementation from: https://stackoverflow.com/a/48394004 | ||
# Note OptionEatAll options must be specified with type=tuple (https://github.com/pallets/click/issues/2012) | ||
class OptionEatAll(click.Option): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding this to support backwards compatability for --select
, --model
, --exclude
, and --resource-type
options. click supports a multiple=True
setting for options that expect multiple values to be set through multiple instances of the option, ie:
--select a --select b --select c
, as opposed to our existing --select a b c
There is an option for setting nargs=-1
in click but this is limited to a single option, that is specified last in the command.
confirmed with @jtcohen6 that not supporting the --select a b c
syntax would represent too large of a breaking change for a minor release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the name OptionEatAll
, but otherwise LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! The new parse is great!
6516e5c
to
8bed1bc
Compare
resolves #5549
Description
Checklist
Sanity tophatting 🎩
❯ python3 core/dbt/cli/main.py ls --project-dir ~/src/jaffle_shop 02:20:31 Found 5 models, 20 tests, 0 snapshots, 0 analyses, 303 macros, 0 operations, 3 seed files, 0 sources, 1 exposure, 0 metrics exposure:jaffle_shop.weekly_jaffle_metrics jaffle_shop.customers jaffle_shop.orders ...
Using multiple multi-value options together:
ls
command:tests/functional/list/test_list.py
✅tests/functional/selectors/test_default_selectors.py::TestDefaultSelectors::test_model__list
✅tests/functional/graph_selection/test_graph_selection.py::TestGraphSelection::test_exposure_parents
. Fails onObject of type SpawnContext is not JSON serializable
tests/functional/metrics/test_metric_deferral.py::TestMetricDeferral::test_metric_deferral
. Fails onObject of type SpawnContext is not JSON serializable
changie new
to create a changelog entry