MCPcopy Index your code
hub / github.com/cloudfoundry/cli / AddOrReplaceEnvironment

Function AddOrReplaceEnvironment

integration/helpers/environment.go:15–29  ·  view source on GitHub ↗

AddOrReplaceEnvironment will update environment if it already exists or will add a new environment with the given environment name and details.

(env []string, newEnvName string, newEnvVal string)

Source from the content-addressed store, hash-verified

13// AddOrReplaceEnvironment will update environment if it already exists or will add
14// a new environment with the given environment name and details.
15func AddOrReplaceEnvironment(env []string, newEnvName string, newEnvVal string) []string {
16 var found bool
17 for i, envPair := range env {
18 splitENV := strings.Split(envPair, "=")
19 if splitENV[0] == newEnvName {
20 env[i] = fmt.Sprintf("%s=%s", newEnvName, newEnvVal)
21 found = true
22 }
23 }
24
25 if !found {
26 env = append(env, fmt.Sprintf("%s=%s", newEnvName, newEnvVal))
27 }
28 return env
29}
30
31func CheckSpaceAndOrgTargetedCorrectly(command ...string) {
32 LoginCF()

Callers 1

CustomCFFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected