MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / encodeEnvVarsForPowerShell

Function encodeEnvVarsForPowerShell

pkg/util/shellutil/tokenswap.go:123–133  ·  view source on GitHub ↗
(env map[string]string)

Source from the content-addressed store, hash-verified

121}
122
123func encodeEnvVarsForPowerShell(env map[string]string) (string, error) {
124 var encoded string
125 for k, v := range env {
126 // validate key
127 if !IsValidEnvVarName(k) {
128 return "", fmt.Errorf("invalid env var name: %q", k)
129 }
130 encoded += fmt.Sprintf("$env:%s = %s\n", k, HardQuotePowerShell(v))
131 }
132 return encoded, nil
133}
134
135func EncodeEnvVarsForShell(shellType string, env map[string]string) (string, error) {
136 switch shellType {

Callers 1

EncodeEnvVarsForShellFunction · 0.85

Calls 2

IsValidEnvVarNameFunction · 0.85
HardQuotePowerShellFunction · 0.85

Tested by

no test coverage detected