Exemplo n.º 1
0
func parseCommands(yaml *simpleyaml.Yaml, commands map[interface{}]interface{}) []Service {
	commonOptions := getServiceOptions(yaml)
	services := make([]Service, 0, len(commands))

	for key, _ := range commands {
		name := toString(key)
		commandYaml := yaml.GetPath("commands", name)
		cmd, _ := commandYaml.Get("command").String()

		service := Service{
			Name:    name,
			Cmd:     cmd,
			Options: getServiceOptions(commandYaml),
		}
		mergo.Merge(&service.Options, commonOptions)

		services = append(services, service)
	}

	return services
}