aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2023-12-28 20:20:20 +0100
committerJoe <rbo@gmx.us>2023-12-28 20:20:20 +0100
commit7fb69d9134866a699047350b50dea17b416d20cf (patch)
tree7aa1bc6e98759deb5589cf4df06e27f71173031e
parentits not the way (diff)
downloadhardflip-7fb69d9134866a699047350b50dea17b416d20cf.tar.gz
hardflip-7fb69d9134866a699047350b50dea17b416d20cf.tar.bz2
hardflip-7fb69d9134866a699047350b50dea17b416d20cf.tar.xz
hardflip-7fb69d9134866a699047350b50dea17b416d20cf.tar.zst
hardflip-7fb69d9134866a699047350b50dea17b416d20cf.zip
did the test and items list doesnt take much more ram so idk
-rw-r--r--c_hardflip.go3
-rw-r--r--c_init.go46
-rw-r--r--i_ui.go2
3 files changed, 32 insertions, 19 deletions
diff --git a/c_hardflip.go b/c_hardflip.go
index 356233e..6f575eb 100644
--- a/c_hardflip.go
+++ b/c_hardflip.go
@@ -70,6 +70,9 @@ func main() {
data_dir,
}
for dir := ldirs.head; dir != nil ; dir = dir.next {
+ for host := ldirs.head.lhost.head; host != nil; host = host.next {
+ fmt.Println(host.ID, host.Filename)
+ }
fmt.Println("next dir")
}
return
diff --git a/c_init.go b/c_init.go
index 25155fd..30b022c 100644
--- a/c_init.go
+++ b/c_init.go
@@ -61,32 +61,32 @@ type HardOpts struct {
// this function recurses into the specified root directory in order to load
// every yaml file into memory
func c_recurse_data_dir(dir, root string, opts HardOpts,
- litems *ItemsList, ldirs *DirsList,
+ litems *ItemsList, ldirs *DirsList, dir_node *DirsNode,
id *uint64, name string, parent *DirsNode, depth uint16) {
files, err := os.ReadDir(root + dir)
if err != nil {
c_die("could not read data directory", err)
}
- dir_node := DirsNode{
- *id,
- name,
- parent,
- depth,
- &HostList{},
- opts.FoldAll,
- nil,
- }
- item_node := ItemsNode{}
- item_node.Dirs = &dir_node
- item_node.Host = nil
+ // dir_node := DirsNode{
+ // *id,
+ // name,
+ // parent,
+ // depth,
+ // &HostList{},
+ // opts.FoldAll,
+ // nil,
+ // }
+ // item_node := ItemsNode{}
+ // item_node.Dirs = dir_node
+ // item_node.Host = nil
*id++
// ldirs.add_back(&dir_node)
// litems.add_back(&item_node)
for _, file := range files {
filename := file.Name()
if file.IsDir() == true {
- c_recurse_data_dir(dir + filename + "/", root, opts, litems, ldirs,
- id, file.Name(), &dir_node, depth + 1)
+ c_recurse_data_dir(dir + filename + "/", root, opts, litems, ldirs, dir_node,
+ id, file.Name(), dir_node, depth + 1)
} else if filepath.Ext(filename) == ".yml" {
host_node := c_read_yaml_file(root + dir + filename)
if host_node == nil {
@@ -95,10 +95,10 @@ func c_recurse_data_dir(dir, root string, opts HardOpts,
item_node := ItemsNode{}
item_node.Dirs = nil
item_node.Host = host_node
+ litems.add_back(&item_node)
host_node.Filename = filename
- host_node.Dir = &dir_node
+ host_node.Dir = dir_node
dir_node.lhost.add_back(host_node)
- // litems.add_back(&item_node)
}
}
}
@@ -108,7 +108,17 @@ func c_load_data_dir(dir string, opts HardOpts) (*ItemsList, *DirsList) {
ldirs := DirsList{}
var id uint64
+ dir_node := DirsNode{
+ 0,
+ "qwe",
+ nil,
+ 0,
+ &HostList{},
+ opts.FoldAll,
+ nil,
+ }
+ ldirs.add_back(&dir_node)
id = 0
- c_recurse_data_dir("", dir + "/", opts, &litems, &ldirs, &id, "", nil, 1)
+ c_recurse_data_dir("", dir + "/", opts, &litems, &ldirs, &dir_node, &id, "", nil, 1)
return &litems, &ldirs
}
diff --git a/i_ui.go b/i_ui.go
index c901a0f..e0546c0 100644
--- a/i_ui.go
+++ b/i_ui.go
@@ -136,7 +136,7 @@ func i_draw_box(s tcell.Screen, x1, y1, x2, y2 int, title string, fill bool) {
func i_bottom_text(ui HardUI) {
spaces := ""
text := ""
-
+
switch ui.mode {
case NORMAL_MODE:
text = NORMAL_KEYS_HINTS