MCPcopy Create free account
hub / github.com/jetify-com/devbox / warnInvalidEnvNames

Function warnInvalidEnvNames

internal/devbox/envvars.go:36–52  ·  view source on GitHub ↗

warnInvalidEnvNames prints a single warning naming any environment variables that were skipped because they aren't valid shell identifiers. The most common cause is a "//" comment key in a devbox.json env block, which devbox would otherwise emit as `export //=...` and break the entire shell with a c

(w io.Writer, names []string)

Source from the content-addressed store, hash-verified

34// otherwise emit as `export //=...` and break the entire shell with a cryptic
35// error.
36func warnInvalidEnvNames(w io.Writer, names []string) {
37 if len(names) == 0 {
38 return
39 }
40 quoted := make([]string, len(names))
41 for i, name := range names {
42 quoted[i] = fmt.Sprintf("%q", name)
43 }
44 ux.Fwarningf(
45 w,
46 "Skipping %d environment variable(s) with invalid names: %s.\n"+
47 "Environment variable names must match ^[a-zA-Z_][a-zA-Z0-9_]*$. "+
48 "If these are \"//\" comments in your devbox.json env block, remove or rename them.\n",
49 len(names),
50 strings.Join(quoted, ", "),
51 )
52}
53
54// exportify formats vars as a line-separated string of shell export statements.
55// Each line is of the form `export key="value";` with any special characters in

Callers 2

exportifyFunction · 0.85
exportifyNushellFunction · 0.85

Calls 1

FwarningfFunction · 0.92

Tested by

no test coverage detected