Skip to content
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

Add --yes option to mf tutorial #1630

Open
wants to merge 1 commit into
base: p--release-0.207.1-updates--04
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions dbt-metricflow/dbt_metricflow/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,11 @@ def exit_signal_handler(signal_type: int, frame) -> None: # type: ignore
@click.option("-m", "--message", is_flag=True, help="Output the final steps dialogue")
# @click.option("--skip-dw", is_flag=True, help="Skip the data warehouse health checks") # TODO: re-enable this
@click.option("--clean", is_flag=True, help="Remove sample model files.")
@click.option("--yes", is_flag=True, help="Respond yes to all questions (for scripting).")
@pass_config
@click.pass_context
@log_call(module_name=__name__, telemetry_reporter=_telemetry_reporter)
def tutorial(ctx: click.core.Context, cfg: CLIConfiguration, message: bool, clean: bool) -> None:
def tutorial(ctx: click.core.Context, cfg: CLIConfiguration, message: bool, clean: bool, yes: bool) -> None:
"""Run user through a tutorial."""
# Needed to handle the backslash outside f-string
complex_query = (
Expand Down Expand Up @@ -166,7 +167,7 @@ def tutorial(ctx: click.core.Context, cfg: CLIConfiguration, message: bool, clea
"Unable to detect a dbt project. Please run this command from the root directory of your dbt project.",
fg="yellow",
)
click.confirm(
yes or click.confirm(
textwrap.dedent(
f"""\

Expand All @@ -186,7 +187,7 @@ def tutorial(ctx: click.core.Context, cfg: CLIConfiguration, message: bool, clea
abort=True,
)
if dbtMetricFlowTutorialHelper.check_if_path_exists([sample_dbt_project_path]):
click.confirm(
yes or click.confirm(
click.style(
textwrap.dedent(
f"""\
Expand Down Expand Up @@ -234,7 +235,7 @@ def tutorial(ctx: click.core.Context, cfg: CLIConfiguration, message: bool, clea

# Remove sample files from dbt project
if clean:
click.confirm("Would you like to remove all the sample files?", abort=True)
yes or click.confirm("Would you like to remove all the sample files?", abort=True)
spinner = Halo(text="Removing sample files...", spinner="dots")
spinner.start()
try:
Expand Down Expand Up @@ -263,11 +264,11 @@ def tutorial(ctx: click.core.Context, cfg: CLIConfiguration, message: bool, clea
"""
)
)
click.confirm("Continue and generate the files?", abort=True)
yes or click.confirm("Continue and generate the files?", abort=True)

# Generate sample files into dbt project
if dbtMetricFlowTutorialHelper.check_if_path_exists([model_path, seed_path]):
click.confirm(
yes or click.confirm(
click.style("There are existing files in the paths above, would you like to overwrite them?", fg="yellow"),
abort=True,
)
Expand Down
Loading