addEnvIfNotPreviouslySetByDevbox adds the key-value pairs from new to existing, but only if the key was not previously set by devbox Caveat, this won't mark the values as set by devbox automatically. Instead, you need to call markEnvAsSetByDevbox when you are done setting variables. This is so you c
(existing, new map[string]string)
| 171 | // This is so you can add variables from multiple sources (e.g. plugin, devbox.json) |
| 172 | // that may build on each other (e.g. PATH=$PATH:...) |
| 173 | func addEnvIfNotPreviouslySetByDevbox(existing, new map[string]string) { |
| 174 | for k, v := range new { |
| 175 | if _, alreadySet := existing[devboxSetPrefix+k]; !alreadySet { |
| 176 | existing[k] = v |
| 177 | } |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | func markEnvsAsSetByDevbox(envs ...map[string]string) { |
| 182 | for _, env := range envs { |