2023-05-19 13:39:55 +00:00
|
|
|
package bundle
|
2023-05-15 09:25:01 +00:00
|
|
|
|
|
|
|
import (
|
2023-05-17 12:07:57 +00:00
|
|
|
"github.com/databricks/cli/libs/template"
|
2023-05-15 09:25:01 +00:00
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
var initCmd = &cobra.Command{
|
2023-06-21 16:40:15 +00:00
|
|
|
Use: "init TEMPLATE_PATH INSTANCE_PATH",
|
2023-05-15 09:25:01 +00:00
|
|
|
Short: "Initialize Template",
|
2023-05-17 00:43:41 +00:00
|
|
|
Long: `Initialize template`,
|
2023-06-21 16:40:15 +00:00
|
|
|
Args: cobra.ExactArgs(2),
|
2023-05-15 09:25:01 +00:00
|
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
2023-06-21 16:40:15 +00:00
|
|
|
return template.Materialize(args[0], args[1], configFile)
|
2023-05-15 09:25:01 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2023-05-21 20:48:38 +00:00
|
|
|
var configFile string
|
2023-05-17 11:41:15 +00:00
|
|
|
|
2023-05-15 09:25:01 +00:00
|
|
|
func init() {
|
2023-05-21 20:48:38 +00:00
|
|
|
initCmd.Flags().StringVar(&configFile, "config-file", "", "path to config to use for template initialization")
|
2023-05-23 16:49:15 +00:00
|
|
|
initCmd.MarkFlagRequired("config-file")
|
2023-05-19 13:39:55 +00:00
|
|
|
AddCommand(initCmd)
|
2023-05-15 09:25:01 +00:00
|
|
|
}
|