MCPcopy Index your code
hub / github.com/commitdev/zero / AppendProjectEnvToCmdEnv

Function AppendProjectEnvToCmdEnv

internal/util/util.go:145–157  ·  view source on GitHub ↗

AppendProjectEnvToCmdEnv converts a key-value pair map into a slice of `key=value`s allow module definition to use an alternative env-var-name than field while apply

(envMap map[string]string, envList []string, translationMap map[string]string)

Source from the content-addressed store, hash-verified

143// AppendProjectEnvToCmdEnv converts a key-value pair map into a slice of `key=value`s
144// allow module definition to use an alternative env-var-name than field while apply
145func AppendProjectEnvToCmdEnv(envMap map[string]string, envList []string, translationMap map[string]string) []string {
146
147 for key, val := range envMap {
148 if val != "" {
149 // overwrite key if exist in translation map
150 if val, ok := translationMap[key]; ok {
151 key = val
152 }
153 envList = append(envList, fmt.Sprintf("%s=%s", key, val))
154 }
155 }
156 return envList
157}
158
159// IndentString will Add x space char padding at the beginging of each line.
160func IndentString(content string, spaces int) string {

Callers 2

executeCmdFunction · 0.92
modulesWalkCmdFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected