Skip to content

Commit

Permalink
/* PR_START p--release-0.207.1-updates 05 */ Add --yes option to tu…
Browse files Browse the repository at this point in the history
…torial.
  • Loading branch information
plypaul committed Jan 24, 2025
1 parent b5f378a commit ea28ce6
Showing 1 changed file with 7 additions and 6 deletions.
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

0 comments on commit ea28ce6

Please sign in to comment.