MCPcopy Create free account
hub / github.com/Scalingo/cli / isEnvEditValid

Function isEnvEditValid

env/edit.go:94–109  ·  view source on GitHub ↗
(edit string)

Source from the content-addressed store, hash-verified

92}
93
94func isEnvEditValid(edit string) error {
95 if !strings.Contains(edit, "=") {
96 return errSetInvalidSyntax
97 }
98 name, value := parseVariable(edit)
99
100 if name == "" || value == "" {
101 return errSetInvalidSyntax
102 }
103
104 if !nameFormat.MatchString(name) {
105 return errInvalidNameFormat
106 }
107
108 return nil
109}
110
111func parseVariable(param string) (string, string) {
112 editSplit := strings.SplitN(param, "=", 2)

Callers 2

TestIsEnvEditValidFunction · 0.85
readFromCmdLineFunction · 0.85

Calls 1

parseVariableFunction · 0.85

Tested by 1

TestIsEnvEditValidFunction · 0.68