From d638262665776aeff098603f6d51e652f9f9c32a Mon Sep 17 00:00:00 2001 From: shreyas-goenka <88374338+shreyas-goenka@users.noreply.github.com> Date: Thu, 8 Feb 2024 18:22:53 +0530 Subject: [PATCH] Add spinner when downloading templates for bundle init (#1188) ## Changes Templates can take a long time to download. This PR adds a spinner to give feedback to users. ## Tests Manually https://github.com/databricks/cli/assets/88374338/b453982c-3233-40f4-8d6f-f31606ff0195 --- cmd/bundle/init.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/bundle/init.go b/cmd/bundle/init.go index db8250d0..47d78f7d 100644 --- a/cmd/bundle/init.go +++ b/cmd/bundle/init.go @@ -191,12 +191,19 @@ See https://docs.databricks.com/en/dev-tools/bundles/templates.html for more inf if err != nil { return err } + + // start the spinner + promptSpinner := cmdio.Spinner(ctx) + promptSpinner <- "Downloading the template\n" + // TODO: Add automated test that the downloaded git repo is cleaned up. // Clone the repository in the temporary directory err = git.Clone(ctx, templatePath, ref, repoDir) + close(promptSpinner) if err != nil { return err } + // Clean up downloaded repository once the template is materialized. defer os.RemoveAll(repoDir) return template.Materialize(ctx, configFile, filepath.Join(repoDir, templateDir), outputDir)