Add welcome message to bundle templates (#907)

## Changes
Adds a welcome_message field to templates and the default python
template.

## Tests
Manually.

Here's the output logs during template init now:
```
shreyas.goenka@THW32HFW6T bricks % cli bundle init                              
Template to use [default-python]: 

Welcome to the sample Databricks Asset Bundle template! Please enter the following information to initialize your sample DAB.

Unique name for this project [my_project]: abcde
Include a stub (sample) notebook in 'abcde/src': no
Include a stub (sample) Delta Live Tables pipeline in 'abcde/src': yes
Include a stub (sample) Python package in 'abcde/src': no

 Your new project has been created in the 'abcde' directory!

Please refer to the README.md of your project for further instructions on getting started.
Or read the documentation on Databricks Asset Bundles at https://docs.databricks.com/dev-tools/bundles/index.html.
```
This commit is contained in:
shreyas-goenka 2023-10-25 14:27:25 +02:00 committed by GitHub
parent a60c40e71e
commit a5815a0b47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 0 deletions

View File

@ -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"`

View File

@ -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)

View File

@ -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",