-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from nicholasyager/nicholasyager-update_owner_…
…entry_ui Feature: Update CLI for group creation to use explicit option names for group owner properties
- Loading branch information
Showing
6 changed files
with
102 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,66 @@ | ||
# TODO add the logic for each meshify command to independent tasks here to make cli thinner | ||
import functools | ||
|
||
import click | ||
|
||
# define common parameters | ||
project_path = click.option( | ||
"--project-path", | ||
type=click.Path(exists=True), | ||
default=".", | ||
help="The path to the dbt project to operate on. Defaults to the current directory.", | ||
) | ||
|
||
exclude = click.option( | ||
"--exclude", | ||
"-e", | ||
default=None, | ||
help="The dbt selection syntax specifying the resources to exclude in the operation", | ||
) | ||
|
||
group_yml_path = click.option( | ||
"--group-yml-path", | ||
type=click.Path(exists=False), | ||
help="An optional path to store the new group YAML definition.", | ||
) | ||
|
||
select = click.option( | ||
"--select", | ||
"-s", | ||
default=None, | ||
help="The dbt selection syntax specifying the resources to include in the operation", | ||
) | ||
|
||
selector = click.option( | ||
"--selector", | ||
default=None, | ||
help="The name of the YML selector specifying the resources to include in the operation", | ||
) | ||
|
||
owner_name = click.option( | ||
"--owner-name", | ||
help="The group Owner's name.", | ||
) | ||
|
||
owner_email = click.option( | ||
"--owner-email", | ||
help="The group Owner's email address.", | ||
) | ||
|
||
owner_properties = click.option( | ||
"--owner-properties", | ||
help="Additional properties to assign to a group Owner.", | ||
) | ||
|
||
|
||
def owner(func): | ||
"""Add click options and argument validation for creating Owner objects.""" | ||
|
||
@functools.wraps(func) | ||
def wrapper_decorator(*args, **kwargs): | ||
if kwargs.get('owner_name') is None and kwargs.get('owner_email') is None: | ||
raise click.UsageError( | ||
"Groups require an Owner to be defined using --owner-name and/or --owner-email." | ||
) | ||
return func(*args, **kwargs) | ||
|
||
return wrapper_decorator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters