From 9fe669c5b873ad17f83d53ecb1d02c13eb2bfc3a Mon Sep 17 00:00:00 2001 From: despiegk Date: Tue, 25 Nov 2025 18:38:21 +0100 Subject: [PATCH] ... --- examples/virt/hetzner/hetzner_example.vsh | 2 +- lib/ai/filemap/README.md | 5 +-- lib/core/pathlib/path_list.v | 2 +- lib/core/texttools/regext/readme.md | 52 +++++++++++++++++++++++ 4 files changed, 56 insertions(+), 5 deletions(-) diff --git a/examples/virt/hetzner/hetzner_example.vsh b/examples/virt/hetzner/hetzner_example.vsh index 9557f52b..d9c5096d 100755 --- a/examples/virt/hetzner/hetzner_example.vsh +++ b/examples/virt/hetzner/hetzner_example.vsh @@ -38,7 +38,7 @@ mut cl := hetznermanager.get()! // println('test cache, first time slow then fast') // } -// println(cl.servers_list()!) +println(cl.servers_list()!) // mut serverinfo := cl.server_info_get(name: 'kristof2')! diff --git a/lib/ai/filemap/README.md b/lib/ai/filemap/README.md index e49e426e..e74d2f3a 100644 --- a/lib/ai/filemap/README.md +++ b/lib/ai/filemap/README.md @@ -104,7 +104,7 @@ Parser handles variations: ``` ===FILE:name.txt=== // Standard -= = FILE : name.txt = = // Extra spaces +== FILE : name.txt == ===file:name.txt=== // Lowercase ==FILE:name.txt== // Different = count ``` @@ -125,8 +125,7 @@ if fm.errors.len > 0 { ## Ignore Patterns -- Respects `.gitignore` and `.heroignore` in any directory -- Patterns are scoped to the directory that contains them +- Respects `.gitignore` and `.heroignore` in any parent directory - Default patterns include `.git/`, `node_modules/`, `*.pyc`, etc. - Use `/` suffix for directory patterns: `dist/` - Use `*` for wildcards: `*.log` diff --git a/lib/core/pathlib/path_list.v b/lib/core/pathlib/path_list.v index faf6811c..c2c38723 100644 --- a/lib/core/pathlib/path_list.v +++ b/lib/core/pathlib/path_list.v @@ -79,7 +79,7 @@ pub fn (mut path Path) list(args_ ListArgs) !PathList { } @[params] -pub struct ListArgsInternal { +struct ListArgsInternal { mut: matcher regext.Matcher recursive bool = true diff --git a/lib/core/texttools/regext/readme.md b/lib/core/texttools/regext/readme.md index c84b8bf2..31a070fa 100644 --- a/lib/core/texttools/regext/readme.md +++ b/lib/core/texttools/regext/readme.md @@ -49,6 +49,58 @@ pattern5 := regext.wildcard_to_regex("*test*file*") // Result: ".*test.*file.*" ``` +## Regex Group Finders + +### find_sid + +Extracts unique `sid` values from a given text. A `sid` is identified by the pattern `sid:XXXXXX`, where `XXXXXX` can be alphanumeric characters. + +```v +import incubaid.herolib.core.texttools.regext + +text := ` +!!action.something sid:aa733 + +sid:aa733 + +...sid:aa733 ss + +...sid:rrrrrr ss +sid:997 + + sid:s d +sid:s_d +` + +r := regext.find_sid(text) +// Result: ['aa733', 'aa733', 'aa733', '997'] +``` + +### find_simple_vars + +Extracts simple variable names enclosed in curly braces, e.g., `{var_name}`, from a given text. Variable names can contain letters, numbers, and underscores. + +```v +import incubaid.herolib.core.texttools.regext + +text := ` +!!action.something {sid} + +sid:aa733 + +{a} + +...sid:rrrrrr ss {a_sdsdsdsd_e__f_g} +sid:997 + + sid:s d +sid:s_d +` + +r := regext.find_simple_vars(text) +// Result: ['sid', 'a', 'a_sdsdsdsd_e__f_g'] +``` + ## regex replacer Tool to flexibly replace elements in file(s) or text.