mirror of https://github.com/databricks/cli.git
29 lines
751 B
Go
29 lines
751 B
Go
package bundle
|
|
|
|
import (
|
|
"github.com/databricks/cli/bundle"
|
|
"github.com/databricks/cli/cmd/root"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func ConfigureBundleWithVariables(cmd *cobra.Command, args []string) error {
|
|
// Load bundle config and apply target
|
|
err := root.MustConfigureBundle(cmd, args)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
variables, err := cmd.Flags().GetStringSlice("var")
|
|
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 initVariableFlag(cmd *cobra.Command) {
|
|
cmd.PersistentFlags().StringSlice("var", []string{}, `set values for variables defined in bundle config. Example: --var="foo=bar"`)
|
|
}
|