This commit is contained in:
2025-07-19 17:08:33 +02:00
parent 555272eeb3
commit e8d4d0afe6
12 changed files with 81 additions and 64 deletions

View File

@@ -20,7 +20,7 @@ pub fn play(args_ PlayArgs) ! {
mut doctrees := map[string]&Tree{}
collection_actions := plbook.find(filter: 'doctree.collection')!
collection_actions := plbook.find(filter: 'doctree.scan')!
for action in collection_actions {
mut p := action.params
name := p.get_default('name', 'main')!
@@ -34,6 +34,9 @@ pub fn play(args_ PlayArgs) ! {
git_reset := p.get_default_false('git_reset')
git_pull := p.get_default_false('git_pull')
doctree.scan(path: path, git_url: git_url, git_reset: git_reset, git_pull: git_pull)!
tree_set(doctree)
}
export_actions := plbook.find(filter: 'doctree.export')!
@@ -62,4 +65,10 @@ pub fn play(args_ PlayArgs) ! {
exclude_errors: exclude_errors
)!
}
// println(tree_list())
// println(tree_get("main")!)
// panic("sd")
}

View File

@@ -6,6 +6,7 @@ import freeflowuniverse.herolib.data.doctree.collection { Collection }
import freeflowuniverse.herolib.develop.gittools
import os
import freeflowuniverse.herolib.core.texttools
import freeflowuniverse.herolib.ui.console
@[params]
pub struct TreeScannerArgs {
@@ -37,6 +38,9 @@ pub fn (mut tree Tree) scan(args TreeScannerArgs) ! {
git_root: args.git_root
git_pull: args.git_pull
)!
console.print_header('doctree.scan: ${path.path}')
if !path.is_dir() {
return error('path is not a directory')
}

View File

@@ -61,7 +61,7 @@ pub fn tree_get(name string) !&Tree {
return doctrees[name] or { return error('Doctree ${name} not found') }
}
}
return error("cann't doctree:'${name}'")
return error("can't get doctree:'${name}'")
}
pub fn tree_exist(name string) bool {
@@ -73,6 +73,12 @@ pub fn tree_exist(name string) bool {
return false
}
pub fn tree_list() []string {
rlock doctrees {
return doctrees.keys()
}
}
// tree_set stores tree in global map
pub fn tree_set(tree Tree) {