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

Function encodeEnvVarsForBash

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

Source from the content-addressed store, hash-verified

97}
98
99func encodeEnvVarsForBash(env map[string]string) (string, error) {
100 var encoded string
101 for k, v := range env {
102 // validate key
103 if !IsValidEnvVarName(k) {
104 return "", fmt.Errorf("invalid env var name: %q", k)
105 }
106 encoded += fmt.Sprintf("export %s=%s\n", k, HardQuote(v))
107 }
108 return encoded, nil
109}
110
111func encodeEnvVarsForFish(env map[string]string) (string, error) {
112 var encoded string

Callers 1

EncodeEnvVarsForShellFunction · 0.85

Calls 2

IsValidEnvVarNameFunction · 0.85
HardQuoteFunction · 0.85

Tested by

no test coverage detected