Skip to content

Commit

Permalink
small behavior changes based on PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-mccoy committed Jun 8, 2022
1 parent 3da902b commit 06a505d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/cmd/initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var initCmd = &cobra.Command{
if utils.InvalidPath(config.DeployOptions.PackagePath) {
executablePath, err := utils.GetFinalExecutablePath()
if err != nil {
message.Error(err, "Unable to get the directory where the zarf cli executable lives")
message.Errorf(err, "Unable to get the directory where the zarf cli is located.")
}

executableDir := path.Dir(executablePath)
Expand All @@ -54,6 +54,10 @@ var initCmd = &cobra.Command{
// If the init-package doesn't exist in the executable directory, suggest trying to download
if utils.InvalidPath(config.DeployOptions.PackagePath) {

if config.DeployOptions.Confirm {
message.Fatalf(nil, "This command requires a zarf-init package, but one was not found on the local system.")
}

// If no CLI version exists (should only occur in dev or CI), try to get the latest release tag from Githhub
if _, err := semver.StrictNewVersion(config.CLIVersion); err != nil {
config.CLIVersion, err = utils.GetLatestReleaseTag(config.GithubProject)
Expand All @@ -62,12 +66,13 @@ var initCmd = &cobra.Command{
}
}

confirmDownload := config.DeployOptions.Confirm
var confirmDownload bool
url := fmt.Sprintf("https://github.com/%s/releases/download/%s/%s", config.GithubProject, config.CLIVersion, initPackageName)

// Give the user the choice to download the init-package and note that this does require an internet connection
message.Question("It seems the init package could not be found locally, Zarf can download this for you if you still have internet connectivity.")
message.Question(url)
message.Question(fmt.Sprintf("It seems the init package could not be found locally, but can be downloaded from %s", url))

message.Note("Note: This will require an internet connection.")

// Prompt the user if --confirm not specified
if !confirmDownload {
Expand Down

0 comments on commit 06a505d

Please sign in to comment.