mirror of https://github.com/databricks/cli.git
Make instance path a required arg
This commit is contained in:
parent
aabb574749
commit
63df93c1a1
|
@ -6,20 +6,18 @@ import (
|
|||
)
|
||||
|
||||
var initCmd = &cobra.Command{
|
||||
Use: "init",
|
||||
Use: "init TEMPLATE_PATH INSTANCE_PATH",
|
||||
Short: "Initialize Template",
|
||||
Long: `Initialize template`,
|
||||
Args: cobra.ExactArgs(1),
|
||||
Args: cobra.ExactArgs(2),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return template.Materialize(args[0], targetDir, configFile)
|
||||
return template.Materialize(args[0], args[1], configFile)
|
||||
},
|
||||
}
|
||||
|
||||
var targetDir string
|
||||
var configFile string
|
||||
|
||||
func init() {
|
||||
initCmd.Flags().StringVar(&targetDir, "target-dir", ".", "path to directory template will be initialized in")
|
||||
initCmd.Flags().StringVar(&configFile, "config-file", "", "path to config to use for template initialization")
|
||||
initCmd.MarkFlagRequired("config-file")
|
||||
AddCommand(initCmd)
|
||||
|
|
|
@ -36,7 +36,7 @@ func TestTemplateInitializationForDevConfig(t *testing.T) {
|
|||
|
||||
// materialize the template
|
||||
cmd := root.RootCmd
|
||||
cmd.SetArgs([]string{"bundle", "init", filepath.FromSlash("testdata/init/templateDefinition"), "--target-dir", tmp, "--config-file", filepath.Join(tmp, "config.json")})
|
||||
cmd.SetArgs([]string{"bundle", "init", filepath.FromSlash("testdata/init/templateDefinition"), tmp, "--config-file", filepath.Join(tmp, "config.json")})
|
||||
err = cmd.Execute()
|
||||
require.NoError(t, err)
|
||||
|
||||
|
@ -78,7 +78,7 @@ func TestTemplateInitializationForProdConfig(t *testing.T) {
|
|||
cmd := root.RootCmd
|
||||
childCommands := cmd.Commands()
|
||||
fmt.Println(childCommands)
|
||||
cmd.SetArgs([]string{"bundle", "init", filepath.FromSlash("testdata/init/templateDefinition"), "--target-dir", instanceDir, "--config-file", filepath.Join(configDir, "my_config.json")})
|
||||
cmd.SetArgs([]string{"bundle", "init", filepath.FromSlash("testdata/init/templateDefinition"), instanceDir, "--config-file", filepath.Join(configDir, "my_config.json")})
|
||||
err = cmd.Execute()
|
||||
require.NoError(t, err)
|
||||
|
||||
|
|
Loading…
Reference in New Issue