// AppendEnv appends and env to the command's env list.
160938
func (c *Command) AppendEnv(env string) {
	if c.cmd.Env != nil {
		c.cmd.Env = append(c.cmd.Env, env)
		return
	}
	c.cmd.Env = append(os.Environ(), env)
}
1025962
func (g *Generator) addEnv(env, key string) {
	if idx, ok := g.envMap[key]; ok {
		// The ENV exists in the cache, so change its value in g.Config.Process.Env
		g.Config.Process.Env[idx] = env
	} else {
		// else the env doesn't exist, so add it and add it's index to g.envMap
		g.Config.Process.Env = append(g.Config.Process.Env, env)
		g.envMap[key] = len(g.Config.Process.Env) - 1
	}
}
517056
func (p *Pod) EmptyEnvs() *Pod {
	p.Env = make(map[string]string)
	return p
}
68067
func Getenv(ctx context.Context, key string) string {
	return LookupEnv(ctx, key).Value
}
286940
func (t *Template) WithEnv(e map[string]string) *Template {
	t.fields[env] = e
	return t
}
347267
func Env(app *Manifest, process *Process) map[string]string {
	return merge(app.Env, process.Env)
}
701183
func mergeEnvs(appEnv *types.Environment, env []string, override bool) {
	for _, ev := range env {
		pair := strings.SplitN(ev, "=", 2)
		if _, exists := appEnv.Get(pair[0]); override || !exists {
			appEnv.Set(pair[0], pair[1])
		}
	}
}
757675
func GetEnv() string {
	env := os.Getenv(NDEnv)
	if env == "" {
		env = EnvDev
	}

	return env
}
263599
func (ec *Envcfg) Env() string {
	if env := ec.GetKey(ec.envKey); env != "" {
		return env
	}
	return DefaultEnvironment
}
1338826
func LookupEnv(ctx context.Context, key string) subcommands.EnvVar {
	e, _ := ctx.Value(&envKey).(subcommands.Env)
	return e[key]
}
932307
func setupEnv(args []string) (retArgs []string, format string, outputCurlString bool) {
	var nextArgFormat bool

	for _, arg := range args {
		if nextArgFormat {
			nextArgFormat = false
			format = arg
			continue
		}

		if arg == "--" {
			break
		}

		if len(args) == 1 && (arg == "-v" || arg == "-version" || arg == "--version") {
			args = []string{"version"}
			break
		}

		if arg == "-output-curl-string" {
			outputCurlString = true
			continue
		}

		// Parse a given flag here, which overrides the env var
		if strings.HasPrefix(arg, "--format=") {
			format = strings.TrimPrefix(arg, "--format=")
		}
		if strings.HasPrefix(arg, "-format=") {
			format = strings.TrimPrefix(arg, "-format=")
		}
		// For backwards compat, it could be specified without an equal sign
		if arg == "-format" || arg == "--format" {
			nextArgFormat = true
		}
	}

	envVaultFormat := os.Getenv(EnvVaultFormat)
	// If we did not parse a value, fetch the env var
	if format == "" && envVaultFormat != "" {
		format = envVaultFormat
	}
	// Lowercase for consistency
	format = strings.ToLower(format)
	if format == "" {
		format = "table"
	}

	return args, format, outputCurlString
}
458336
func ExecWithEnv(name string, args []string, env []string, timeout time.Duration, log Log) (Result, error) {
	return execWithFunc(name, args, env, exec.Command, timeout, log)
}
1236660
func Getenv(key string, v ...string) string {
	defaultValue := ""
	if len(v) > 0 {
		defaultValue = v[0]
	}

	value := os.Getenv(key)
	if value == "" {
		return defaultValue
	}
	return value
}
863721
func GetAndSetupAppEnv() (AppOptions, error) {
	appEnv, err := GetAppEnv()
	if err != nil {
		return AppOptions{}, err
	}
	return SetupAppEnv(appEnv)
}
787244
func (f *Function) Setenv(name, value string) {
	f.Environment[name] = value
}
1246241
func GetEnv(envName, defaultValue string) string {
	value := os.Getenv(envName)
	if value == "" {
		return defaultValue
	}
	return value
}
415840
func (m *Model) AppendEnvs(envs ...string) *Model {
	return m.SetEnvs(append(os.Environ(), envs...)...)
}