This commit is contained in:
2025-08-15 07:09:40 +02:00
parent e77f923cd2
commit e030309b7f
27 changed files with 167 additions and 285 deletions

View File

@@ -208,11 +208,7 @@ fn cmd_git_execute(cmd Command) ! {
coderoot = os.environ()['CODEROOT']
}
mut gs := gittools.get(coderoot: coderoot)!
if coderoot.len > 0 {
// is a hack for now
gs = gittools.new(coderoot: coderoot)!
}
mut gs := gittools.new(coderoot: coderoot)!
// create the filter for doing group actions, or action on 1 repo
mut filter := cmd.flags.get_string('filter') or { '' }

View File

@@ -125,7 +125,7 @@ pub fn plbook_code_get(cmd Command) !string {
pull := cmd.flags.get_bool('gitpull') or { false }
// interactive := !cmd.flags.get_bool('script') or { false }
mut gs := gittools.get(coderoot: coderoot)!
mut gs := gittools.new(coderoot: coderoot)!
if url.len > 0 {
mut repo := gs.get_repo(
pull: pull

View File

@@ -48,8 +48,8 @@ play_docusaurus.play(mut plbook)! // <-- new line, optional
| Problem | What to do |
|---|---|
| **Wrong API name** the code uses **`gittools.get(gittools.GitStructureArgGet{})`** there is no `GitStructureArgGet` struct in the gittools package. The correct type is **`gittools.GitStructureArgs`** (or the default `gittools.GitStructure` argument). | Replace `GitStructureArgGet` with the correct type (`gittools.GitStructureArgs`). |
| **Missing import alias** the file uses `gittools.get` and `gittools.new` but the import is just `import freeflowuniverse.herolib.develop.gittools`. That is fine, but for clarity rename the import to **`gittools`** (it already is) and use the same alias everywhere. |
| **Wrong API name** the code uses **`gittools.new(gittools.GitStructureArgGet{})`** there is no `GitStructureArgGet` struct in the gittools package. The correct type is **`gittools.GitStructureArgs`** (or the default `gittools.GitStructure` argument). | Replace `GitStructureArgGet` with the correct type (`gittools.GitStructureArgs`). |
| **Missing import alias** the file uses `gittools.new` and `gittools.new` but the import is just `import freeflowuniverse.herolib.develop.gittools`. That is fine, but for clarity rename the import to **`gittools`** (it already is) and use the same alias everywhere. |
| **Potential nil `gs`** after a `git.clone` we do `gs = gittools.new(coderoot: coderoot)!`. This shadows the previous `gs` and loses the original configuration (e.g. `light`, `log`). The intent is to **reinitialise** the `GitStructure` **only** when a `coderoot` is explicitly given. Keep the current flow but **document** the intention. |
| **Unused variable `action_`** the variable `action_` is used only for iteration. No problem. |
| **Missing `gittools.GitCloneArgs`** check that the struct is actually named `GitCloneArgs` in the gittools package. If not, change to the proper name. | Verify and, if needed, replace with the correct struct name (`gittools.GitCloneArgs`). |
@@ -82,7 +82,7 @@ fn play_git(mut plbook PlayBook) ! {
// ... (same as before)
} else {
// Default GitStructure (no args)
gittools.get(gittools.GitStructureArgs{})!
gittools.new(gittools.GitStructureArgs{})!
}
// -----------------------------------------------------------

View File

@@ -27,12 +27,13 @@ fn play_core(mut plbook PlayBook) ! {
mut playrunpath := action.params.get_default('path', '')!
if playrunpath.len == 0 {
action.name = 'pull'
playrunpath = gittools.get_repo_path(
mypath:=gittools.path(
path: playrunpath
git_url: action.params.get_default('git_url', '')!
git_reset: action.params.get_default_false('git_reset')
git_pull: action.params.get_default_false('git_pull')
)!
playrunpath = mypath.path
}
if playrunpath.len == 0 {
return error("can't run a heroscript didn't find url or path.")

View File

@@ -11,11 +11,11 @@ import freeflowuniverse.herolib.ui.console // For verbose error reporting
// ---------------------------------------------------------------
fn play_git(mut plbook PlayBook) ! {
// -----------------------------------------------------------
// !!git.define configure the GitStructure
// -----------------------------------------------------------
mut gs:=gittools.new()!
define_actions := plbook.find(filter: 'git.define')!
mut gs := if define_actions.len > 0 {
if define_actions.len > 0 {
mut p := define_actions[0].params
coderoot := p.get_default('coderoot', '')!
light := p.get_default_true('light')
@@ -25,19 +25,19 @@ fn play_git(mut plbook PlayBook) ! {
ssh_key_path := p.get_default('ssh_key_path', '')!
reload := p.get_default_false('reload')
gittools.new(
gs=gittools.new(
coderoot: coderoot
light: light
log: log
debug: debug
offline: offline
ssh_key_path: ssh_key_path
reload: reload
)!
} else {
// Default GitStructure (no args)
gittools.get()!
}
if light || ssh_key_path.len > 0 {
gs.config_set(light: light, ssh_key_path: ssh_key_path)!
}
}
// -----------------------------------------------------------
// !!git.clone clone repositories