| 178 | var whitespace = regexp.MustCompile(`\s`) |
| 179 | |
| 180 | func validateScripts(cfg *ConfigFile) error { |
| 181 | scripts := cfg.Scripts() |
| 182 | for k := range scripts { |
| 183 | if strings.TrimSpace(k) == "" { |
| 184 | return errors.New("cannot have script with empty name in devbox.json") |
| 185 | } |
| 186 | if whitespace.MatchString(k) { |
| 187 | return errors.Errorf( |
| 188 | "cannot have script name with whitespace in devbox.json: %s", k) |
| 189 | } |
| 190 | if strings.TrimSpace(scripts[k].String()) == "" { |
| 191 | return errors.Errorf( |
| 192 | "cannot have an empty script body in devbox.json: %s", k) |
| 193 | } |
| 194 | } |
| 195 | return nil |
| 196 | } |
| 197 | |
| 198 | func validateAliases(cfg *ConfigFile) error { |
| 199 | for name, command := range cfg.Aliases { |