MCPcopy
hub / github.com/spacecloud-io/space-cloud / GetProjectID

Function GetProjectID

space-cli/cmd/utils/projects.go:45–55  ·  view source on GitHub ↗

GetProjectID checks if project is specified in flags

()

Source from the content-addressed store, hash-verified

43
44// GetProjectID checks if project is specified in flags
45func GetProjectID() (string, bool) {
46 projectID := viper.GetString("project")
47 if projectID == "" {
48 creds, err := getSelectedAccount()
49 if err != nil || creds.DefaultProject == "" {
50 return "", false
51 }
52 return creds.DefaultProject, true
53 }
54 return projectID, true
55}
56
57// SetDefaultProject sets the default project for the selected account in accounts.yaml file
58// if empty value provided it will try to project from server & prompts user to select project from server response

Callers 1

TestGetProjectIDFunction · 0.85

Calls 1

getSelectedAccountFunction · 0.85

Tested by 1

TestGetProjectIDFunction · 0.68