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

Function parseEnvironmentLine

pkg/util/pamparse/pamparse.go:124–130  ·  view source on GitHub ↗
(line string)

Source from the content-addressed store, hash-verified

122var envFileLineRe = regexp.MustCompile(`^(?:export\s+)?([A-Z0-9_]+[A-Za-z0-9]*)=(.*)$`)
123
124func parseEnvironmentLine(line string) (string, string) {
125 m := envFileLineRe.FindStringSubmatch(line)
126 if m == nil {
127 return "", ""
128 }
129 return m[1], sanitizeEnvVarValue(m[2])
130}
131
132// Regex to parse a line from /etc/security/pam_env.conf or ~/.pam_environment. Follows the guidance from https://wiki.archlinux.org/title/Environment_variables#Using_pam_env
133var confFileLineRe = regexp.MustCompile(`^([A-Z0-9_]+[A-Za-z0-9]*)\s+(?:(?:DEFAULT=)(\S+(?: \S+)*))\s*(?:(?:OVERRIDE=)(\S+(?: \S+)*))?\s*$`)

Callers 2

ParseEnvironmentFileFunction · 0.85
ParseEnvironmentConfFileFunction · 0.85

Calls 1

sanitizeEnvVarValueFunction · 0.85

Tested by

no test coverage detected