// findConfigFiles searches for all yaml files in the path the command is executed from.
//
// TODO: It can currently not determine if a file is meant to be for this app or is placed there in another context.
findConfigFiles searches for all yaml files in the path the command is executed from.

It can currently not determine if a file is meant to be for this app or is placed there in another context.
// findConfigFiles searches for all yaml files in the path the command is executed from . // // TODO : It can currently not determine if a file is meant to be for this app or is placed there in another context .
func findConfigFiles() (files []string, err error) {
	log.Println("Start searching for config files in execution path")
	dir, err := os.Getwd()
	if err != nil {
		log.Fatal(err)
		return files, err
	}
	log.Printf("Execution path: %s", dir)
	err = filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
		if path != dir && info.IsDir() {
			return filepath.SkipDir
		}
		if (filepath.Ext(path) != ".yaml" && filepath.Ext(path) != ".yml") || !strings.HasPrefix(info.Name(), "reapy") {
			return nil
		}
		files = append(files, path)
		return nil
	})
	if err != nil {
		return files, err
	}
	log.Printf("Found %d file(s)\n", len(files))
	return files, nil
}
func findConfigFiles ( ) ( files [ ] string , err error ) { log . Println ( " " ) dir , err := os . Getwd ( ) if err != nil { log . Fatal ( err ) return files , err } log . Printf ( " " , dir ) err = filepath . Walk ( dir , func ( path string , info os . FileInfo , err error ) error { if path != dir && info . IsDir ( ) { return filepath . SkipDir } if ( filepath . Ext ( path ) != " " && filepath . Ext ( path ) != " " ) || ! strings . HasPrefix ( info . Name ( ) , " " ) { return nil } files = append ( files , path ) return nil } ) if err != nil { return files , err } log . Printf ( " \n " , len ( files ) ) return files , nil }
findConfigFiles searches for all yaml files in the path the command is executed from.
findConfigFiles searches for all yaml files in the path the command is executed from .
// Get the current directory // "Walk" over all files (including content of subfolders) in the search for yaml files // Skip all folders except the execution path