Beispiel #1
0
func AttributeFiles(path string) ([]string, error) {
	res := []string{}
	if !utils.FileExists(path) {
		return res, nil
	}

	in := attributes.NewInputs(path)
	// initialize input files list
	err := in.ListFiles()
	if err != nil {
		return nil, err
	}

	for _, file := range in.Files {
		if strings.HasSuffix(file, ".yml") || strings.HasSuffix(file, ".yaml") {
			res = append(res, in.Directory+file)
		}
	}
	return res, nil
}
Beispiel #2
0
func main() {

	// Get Option Flags
	fgs := newFlags()

	in := attributes.NewInputs(fgs.input_dir)
	// initialize input files list
	err := in.ListFiles()
	if err != nil {
		panic(err)
	}

	res := []string{}
	for _, file := range in.Files {
		res = append(res, in.Directory+file)
	}

	out := attributes.Merge(fgs.confd_env, res)
	err = ioutil.WriteFile("attributes.json", []byte(out), 0777)
	if err != nil {
		panic(err)
	}
}