From 00266cb8b372fdbdec45cd2a7df3e56d2deb978c Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Mon, 6 Jan 2025 15:54:13 +0530 Subject: [PATCH] fix another bug --- cmd/bundle/init.go | 6 +++++- libs/template/resolve.go | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/bundle/init.go b/cmd/bundle/init.go index 755a09b9f..c78ca50f2 100644 --- a/cmd/bundle/init.go +++ b/cmd/bundle/init.go @@ -38,8 +38,12 @@ See https://docs.databricks.com/en/dev-tools/bundles/templates.html for more inf cmd.PreRunE = root.MustWorkspaceClient cmd.RunE = func(cmd *cobra.Command, args []string) error { + var templatePathOrUrl string + if len(args) > 0 { + templatePathOrUrl = args[0] + } r := template.Resolver{ - TemplatePathOrUrl: args[0], + TemplatePathOrUrl: templatePathOrUrl, ConfigFile: configFile, OutputDir: outputDir, TemplateDir: templateDir, diff --git a/libs/template/resolve.go b/libs/template/resolve.go index 88299b808..6ec5963da 100644 --- a/libs/template/resolve.go +++ b/libs/template/resolve.go @@ -54,10 +54,10 @@ func (r Resolver) Resolve(ctx context.Context) (*Template, error) { if err != nil { return nil, err } + } else { + templateName = TemplateName(r.TemplatePathOrUrl) } - templateName = TemplateName(r.TemplatePathOrUrl) - // User should not directly select "custom" and instead should provide the // file path or the Git URL for the template directly. // Custom is just for internal representation purposes.