From 199f4b8ff5475b079fd2c6ccadf21788fdbb74ee Mon Sep 17 00:00:00 2001 From: monalisa Date: Mon, 23 Oct 2023 17:17:14 +0200 Subject: [PATCH] Add welcome message to bundle templates --- libs/jsonschema/extension.go | 3 +++ libs/template/materialize.go | 6 ++++++ .../default-python/databricks_template_schema.json | 1 + 3 files changed, 10 insertions(+) diff --git a/libs/jsonschema/extension.go b/libs/jsonschema/extension.go index 8503ab2d1a4..ffb77bd834f 100644 --- a/libs/jsonschema/extension.go +++ b/libs/jsonschema/extension.go @@ -12,6 +12,9 @@ type Extension struct { // that do have an order defined. Order *int `json:"order,omitempty"` + // Welcome message to print before prompting the user for input + WelcomeMessage string `json:"welcome_message,omitempty"` + // The message to print after the template is successfully initalized SuccessMessage string `json:"success_message,omitempty"` diff --git a/libs/template/materialize.go b/libs/template/materialize.go index ec62e41f3a5..7c9105b7323 100644 --- a/libs/template/materialize.go +++ b/libs/template/materialize.go @@ -48,6 +48,12 @@ func Materialize(ctx context.Context, configFilePath, templateRoot, outputDir st return err } + // Print welcome message + welcome := config.schema.WelcomeMessage + if welcome != "" { + cmdio.LogString(ctx, welcome) + } + // Read and assign config values from file if configFilePath != "" { err = config.assignValuesFromFile(configFilePath) diff --git a/libs/template/templates/default-python/databricks_template_schema.json b/libs/template/templates/default-python/databricks_template_schema.json index 8b26ee70e6c..8d5afb57d61 100644 --- a/libs/template/templates/default-python/databricks_template_schema.json +++ b/libs/template/templates/default-python/databricks_template_schema.json @@ -1,4 +1,5 @@ { + "welcome_message": "\nWelcome to the sample Databricks Asset Bundle template! Please enter the following information to initialize your sample DAB.\n", "properties": { "project_name": { "type": "string",