aboutsummaryrefslogtreecommitdiffstats
path: root/c_init.go
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2023-12-15 20:20:20 +0100
committerJoe <rbo@gmx.us>2023-12-15 20:20:20 +0100
commit8945d49e7ae4b96b2919fd074c03623a7c65b8f8 (patch)
treea538134f49219d34aee0b762e8d7b40a42598e20 /c_init.go
parentnew stuff (diff)
downloadhardflip-8945d49e7ae4b96b2919fd074c03623a7c65b8f8.tar.gz
hardflip-8945d49e7ae4b96b2919fd074c03623a7c65b8f8.tar.bz2
hardflip-8945d49e7ae4b96b2919fd074c03623a7c65b8f8.tar.xz
hardflip-8945d49e7ae4b96b2919fd074c03623a7c65b8f8.tar.zst
hardflip-8945d49e7ae4b96b2919fd074c03623a7c65b8f8.zip
good parsing
Diffstat (limited to '')
-rw-r--r--c_init.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/c_init.go b/c_init.go
index c3710c6..d5af2e8 100644
--- a/c_init.go
+++ b/c_init.go
@@ -84,21 +84,24 @@ func c_get_data_dir() string {
// this function recurses into the specified root directory in order to load
// every yaml file into memory
-func c_recurse_data_dir(dir string, root string) {
+func c_recurse_data_dir(dir string, root string, lhost *HostList) {
files, err := ioutil.ReadDir(root + dir)
if err != nil {
c_die("could not read data directory", err)
}
for _, file := range files {
if file.IsDir() == true {
- c_recurse_data_dir(dir + file.Name() + "/", root)
+ c_recurse_data_dir(dir + file.Name() + "/", root, lhost)
} else if filepath.Ext(file.Name()) == ".yml" {
- fmt.Println(root + dir + file.Name())
- c_read_yaml_file(root + dir + file.Name())
+ fmt.Println(dir + file.Name())
+ host := c_read_yaml_file(root + dir + file.Name())
+ lhost.add_back(host)
}
}
}
-func c_load_data_dir(dir string) {
- c_recurse_data_dir("", dir + "/")
+func c_load_data_dir(dir string) *HostList {
+ lhost := HostList{}
+ c_recurse_data_dir("", dir + "/", &lhost)
+ return &lhost
}