Skip to content

Commit cf0c0f9

Browse files
committed
Implement #238
1 parent 8f5fbb8 commit cf0c0f9

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

cmd/init.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package cmd
33
import (
44
"io/ioutil"
55
"os"
6+
"os/exec"
67
"path/filepath"
78
"regexp"
89
"strconv"
@@ -542,11 +543,19 @@ func (cmd *InitCmd) configureRegistry() {
542543

543544
if isGoogleRegistry {
544545
if len(defaultImageNameParts) < 2 {
546+
project, err := exec.Command("gcloud", "config", "get-value", "project").Output()
547+
gcloudProject := ""
548+
549+
if err == nil {
550+
gcloudProject = strings.TrimSpace(string(project))
551+
}
552+
545553
gcloudProjectName := stdinutil.GetFromStdin(&stdinutil.GetFromStdinParams{
546-
Question: "What is the name of your Google Cloud Project? (run 'gcloud config get-value project' to get the project name)",
547-
DefaultValue: "",
554+
Question: "What Google Cloud Project should be used?",
555+
DefaultValue: gcloudProject,
548556
ValidationRegexPattern: "^.*$",
549557
})
558+
550559
cmd.defaultImage.Name = configutil.String(*gcloudProjectName + "/" + strings.TrimPrefix(defaultImageName, *gcloudProjectName))
551560
}
552561
}

0 commit comments

Comments
 (0)