mirror of https://github.com/databricks/cli.git
24 lines
689 B
Go
24 lines
689 B
Go
package bundle
|
|
|
|
import (
|
|
"github.com/databricks/bricks/bundle"
|
|
"github.com/databricks/bricks/cmd/root"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func ConfigureBundleWithVariables(cmd *cobra.Command, args []string) error {
|
|
// Load bundle config and apply environment
|
|
err := root.MustConfigureBundle(cmd, args)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
// Initialize variables by assigning them values passed as command line flags
|
|
b := bundle.Get(cmd.Context())
|
|
return b.Config.InitializeVariables(variables)
|
|
}
|
|
|
|
func AddVariableFlag(cmd *cobra.Command) {
|
|
cmd.PersistentFlags().StringSliceVar(&variables, "var", []string{}, `set values for variables defined in bundle config. Example: --var="foo=bar"`)
|
|
}
|