This commit is contained in:
2025-07-21 06:18:46 +02:00
parent 62932976dd
commit ddf5fcbbcc
268 changed files with 1614 additions and 2271 deletions

View File

@@ -1,204 +0,0 @@
# instructions how to work with heroscript in vlang
## heroscript
Heroscript is our small scripting language which has following structure
an example of a heroscript is
```heroscript
!!mailclient.configure
name: 'myname'
host: 'localhost'
port: 25
secure: 1
reset: 1
description: '
a description can be multiline
like this
'
```
Notice how:
- every action starts with !!
- the first part is the actor, mailclient in this case
- the 2e part is the action name, configure in this case
- multilines are supported see the description field
## how to process heroscript in Vlang
- heroscript can be converted to a struct,
- the methods available to get the params are in 'params' section further in this doc
```vlang
//the object which will be configured
pub struct mailclient {
pub mut:
name string
host string
port int
secure bool
description string
}
mut plbook := playbook.new(text: $the_heroscript_from_above)!
play_mailclient(mut plbook)! //see below in vlang block there it all happens
pub fn play_mailclient(mut plbook playbook.PlayBook) ! {
//find all actions are !!$actor.$actionname. in this case above the actor is !!mailclient, we check with the fitler if it exists, if not we return
mailclient_actions := plbook.find(filter: 'mailclient.')!
for action in mailclient_actions {
if action.name == "configure"{
mut p := action.params
mut obj := mailclientScript{
//INFO: all details about the get methods can be found in 'params get methods' section
name : p.get('name')! //will give error if not exist
homedir : p.get('homedir')!
title : p.get_default('title', 'My Hero DAG')! //uses a default if not set
reset : p.get_default_false('reset')
start : p.get_default_true('start')
colors : p.get_list('colors')
description : p.get_default('description','')!
}
}
}
}
}
## params get methods (param getters)
above in the p.get...
below you can find the methods which can be used on the params
```vlang
exists(key_ string) bool
//check if arg exist (arg is just a value in the string e.g. red, not value:something)
exists_arg(key_ string) bool
//see if the kwarg with the key exists if yes return as string trimmed
get(key_ string) !string
//return the arg with nr, 0 is the first
get_arg(nr int) !string
//return arg, if the nr is larger than amount of args, will return the defval
get_arg_default(nr int, defval string) !string
get_default(key string, defval string) !string
get_default_false(key string) bool
get_default_true(key string) bool
get_float(key string) !f64
get_float_default(key string, defval f64) !f64
get_from_hashmap(key_ string, defval string, hashmap map[string]string) !string
get_int(key string) !int
get_int_default(key string, defval int) !int
//Looks for a list of strings in the parameters. ',' are used as deliminator to list
get_list(key string) ![]string
get_list_default(key string, def []string) ![]string
get_list_f32(key string) ![]f32
get_list_f32_default(key string, def []f32) []f32
get_list_f64(key string) ![]f64
get_list_f64_default(key string, def []f64) []f64
get_list_i16(key string) ![]i16
get_list_i16_default(key string, def []i16) []i16
get_list_i64(key string) ![]i64
get_list_i64_default(key string, def []i64) []i64
get_list_i8(key string) ![]i8
get_list_i8_default(key string, def []i8) []i8
get_list_int(key string) ![]int
get_list_int_default(key string, def []int) []int
get_list_namefix(key string) ![]string
get_list_namefix_default(key string, def []string) ![]string
get_list_u16(key string) ![]u16
get_list_u16_default(key string, def []u16) []u16
get_list_u32(key string) ![]u32
get_list_u32_default(key string, def []u32) []u32
get_list_u64(key string) ![]u64
get_list_u64_default(key string, def []u64) []u64
get_list_u8(key string) ![]u8
get_list_u8_default(key string, def []u8) []u8
get_map() map[string]string
get_path(key string) !string
get_path_create(key string) !string
get_percentage(key string) !f64
get_percentage_default(key string, defval string) !f64
//convert GB, MB, KB to bytes e.g. 10 GB becomes bytes in u64
get_storagecapacity_in_bytes(key string) !u64
get_storagecapacity_in_bytes_default(key string, defval u64) !u64
get_storagecapacity_in_gigabytes(key string) !u64
//Get Expiration object from time string input input can be either relative or absolute## Relative time
get_time(key string) !ourtime.OurTime
get_time_default(key string, defval ourtime.OurTime) !ourtime.OurTime
get_time_interval(key string) !Duration
get_timestamp(key string) !Duration
get_timestamp_default(key string, defval Duration) !Duration
get_u32(key string) !u32
get_u32_default(key string, defval u32) !u32
get_u64(key string) !u64
get_u64_default(key string, defval u64) !u64
get_u8(key string) !u8
get_u8_default(key string, defval u8) !u8
```

View File

@@ -1,142 +0,0 @@
# how to use params
works very well in combination with heroscript
## How to get the paramsparser
```v
import freeflowuniverse.herolib.data.paramsparser
// Create new params from text
params := paramsparser.new("color:red size:'large' priority:1 enable:true")!
// Or create empty params and add later
mut params := paramsparser.new_params()
params.set("color", "red")
```
## Parameter Format
The parser supports several formats:
1. Key-value pairs: `key:value`
2. Quoted values: `key:'value with spaces'`
3. Arguments without keys: `arg1 arg2`
4. Comments: `// this is a comment`
Example:
```v
text := "name:'John Doe' age:30 active:true // user details"
params := paramsparser.new(text)!
```
## Getting Values
The module provides various methods to retrieve values:
```v
// Get string value
name := params.get("name")! // returns "John Doe"
// Get with default value
color := params.get_default("color", "blue")! // returns "blue" if color not set
// Get as integer
age := params.get_int("age")! // returns 30
// Get as boolean (true if value is "1", "true", "y", "yes")
is_active := params.get_default_true("active")
// Get as float
score := params.get_float("score")!
// Get as percentage (converts "80%" to 0.8)
progress := params.get_percentage("progress")!
```
## Type Conversion Methods
The module supports various type conversions:
### Basic Types
- `get_int()`: Convert to int32
- `get_u32()`: Convert to unsigned 32-bit integer
- `get_u64()`: Convert to unsigned 64-bit integer
- `get_u8()`: Convert to unsigned 8-bit integer
- `get_float()`: Convert to 64-bit float
- `get_percentage()`: Convert percentage string to float (e.g., "80%" → 0.8)
### Boolean Values
- `get_default_true()`: Returns true if value is empty, "1", "true", "y", or "yes"
- `get_default_false()`: Returns false if value is empty, "0", "false", "n", or "no"
### Lists
The module provides robust support for parsing and converting lists:
```v
// Basic list parsing
names := params.get_list("users")! // parses ["user1", "user2", "user3"]
// With default value
tags := params.get_list_default("tags", ["default"])!
// Lists with type conversion
numbers := params.get_list_int("ids")! // converts each item to int
amounts := params.get_list_f64("prices")! // converts each item to f64
// Name-fixed lists (normalizes each item)
clean_names := params.get_list_namefix("categories")!
```
Supported list types:
- `get_list()`: String list
- `get_list_u8()`, `get_list_u16()`, `get_list_u32()`, `get_list_u64()`: Unsigned integers
- `get_list_i8()`, `get_list_i16()`, `get_list_int()`, `get_list_i64()`: Signed integers
- `get_list_f32()`, `get_list_f64()`: Floating point numbers
Each list method has a corresponding `_default` version that accepts a default value.
Valid list formats:
```v
users: "john, jane,bob"
ids: "1,2,3,4,5"
```
### Advanced
```v
get_map() map[string]string
get_path(key string) !string
get_path_create(key string) !string //will create path if it doesnt exist yet
get_percentage(key string) !f64
get_percentage_default(key string, defval string) !f64
//convert GB, MB, KB to bytes e.g. 10 GB becomes bytes in u64
get_storagecapacity_in_bytes(key string) !u64
get_storagecapacity_in_bytes_default(key string, defval u64) !u64
get_storagecapacity_in_gigabytes(key string) !u64
//Get Expiration object from time string input input can be either relative or absolute## Relative time
get_time(key string) !ourtime.OurTime
get_time_default(key string, defval ourtime.OurTime) !ourtime.OurTime
get_time_interval(key string) !Duration
get_timestamp(key string) !Duration
get_timestamp_default(key string, defval Duration) !Duration
```

View File

@@ -1,309 +0,0 @@
# how to work with heroscript in vlang
## heroscript
Heroscript is our small scripting language which has following structure
an example of a heroscript is
```heroscript
!!dagu.script_define
name: 'test_dag'
homedir:''
title:'a title'
reset:1
start:true //trie or 1 is same
colors: 'green,red,purple' //lists are comma separated
description: '
a description can be multiline
like this
'
!!dagu.add_step
dag: 'test_dag'
name: 'hello_world'
command: 'echo hello world'
!!dagu.add_step
dag: 'test_dag'
name: 'last_step'
command: 'echo last step'
```
Notice how:
- every action starts with !!
- the first part is the actor e.g. dagu in this case
- the 2e part is the action name
- multilines are supported see the description field
## how to process heroscript in Vlang
- heroscript can be converted to a struct,
- the methods available to get the params are in 'params' section further in this doc
```vlang
fn test_play_dagu() ! {
mut plbook := playbook.new(text: thetext_from_above)!
play_dagu(mut plbook)! //see below in vlang block there it all happens
}
pub fn play_dagu(mut plbook playbook.PlayBook) ! {
//find all actions are !!$actor.$actionname. in this case above the actor is !!dagu, we check with the fitler if it exists, if not we return
dagu_actions := plbook.find(filter: 'dagu.')!
if dagu_actions.len == 0 {
return
}
play_dagu_basic(mut plbook)!
}
pub struct DaguScript {
pub mut:
name string
homedir string
title string
reset bool
start bool
colors []string
}
// play_dagu plays the dagu play commands
pub fn play_dagu_basic(mut plbook playbook.PlayBook) ! {
//now find the specific ones for dagu.script_define
mut actions := plbook.find(filter: 'dagu.script_define')!
if actions.len > 0 {
for myaction in actions {
mut p := myaction.params //get the params object from the action object, this can then be processed using the param getters
mut obj := DaguScript{
//INFO: all details about the get methods can be found in 'params get methods' section
name : p.get('name')! //will give error if not exist
homedir : p.get('homedir')!
title : p.get_default('title', 'My Hero DAG')! //uses a default if not set
reset : p.get_default_false('reset')
start : p.get_default_true('start')
colors : p.get_list('colors')
description : p.get_default('description','')!
}
...
}
}
//there can be more actions which will have other filter
}
```
## params get methods (param getters)
```vlang
fn (params &Params) exists(key_ string) bool
//check if arg exist (arg is just a value in the string e.g. red, not value:something)
fn (params &Params) exists_arg(key_ string) bool
//see if the kwarg with the key exists if yes return as string trimmed
fn (params &Params) get(key_ string) !string
//return the arg with nr, 0 is the first
fn (params &Params) get_arg(nr int) !string
//return arg, if the nr is larger than amount of args, will return the defval
fn (params &Params) get_arg_default(nr int, defval string) !string
fn (params &Params) get_default(key string, defval string) !string
fn (params &Params) get_default_false(key string) bool
fn (params &Params) get_default_true(key string) bool
fn (params &Params) get_float(key string) !f64
fn (params &Params) get_float_default(key string, defval f64) !f64
fn (params &Params) get_from_hashmap(key_ string, defval string, hashmap map[string]string) !string
fn (params &Params) get_int(key string) !int
fn (params &Params) get_int_default(key string, defval int) !int
//Looks for a list of strings in the parameters. ',' are used as deliminator to list
fn (params &Params) get_list(key string) ![]string
fn (params &Params) get_list_default(key string, def []string) ![]string
fn (params &Params) get_list_f32(key string) ![]f32
fn (params &Params) get_list_f32_default(key string, def []f32) []f32
fn (params &Params) get_list_f64(key string) ![]f64
fn (params &Params) get_list_f64_default(key string, def []f64) []f64
fn (params &Params) get_list_i16(key string) ![]i16
fn (params &Params) get_list_i16_default(key string, def []i16) []i16
fn (params &Params) get_list_i64(key string) ![]i64
fn (params &Params) get_list_i64_default(key string, def []i64) []i64
fn (params &Params) get_list_i8(key string) ![]i8
fn (params &Params) get_list_i8_default(key string, def []i8) []i8
fn (params &Params) get_list_int(key string) ![]int
fn (params &Params) get_list_int_default(key string, def []int) []int
fn (params &Params) get_list_namefix(key string) ![]string
fn (params &Params) get_list_namefix_default(key string, def []string) ![]string
fn (params &Params) get_list_u16(key string) ![]u16
fn (params &Params) get_list_u16_default(key string, def []u16) []u16
fn (params &Params) get_list_u32(key string) ![]u32
fn (params &Params) get_list_u32_default(key string, def []u32) []u32
fn (params &Params) get_list_u64(key string) ![]u64
fn (params &Params) get_list_u64_default(key string, def []u64) []u64
fn (params &Params) get_list_u8(key string) ![]u8
fn (params &Params) get_list_u8_default(key string, def []u8) []u8
fn (params &Params) get_map() map[string]string
fn (params &Params) get_path(key string) !string
fn (params &Params) get_path_create(key string) !string
fn (params &Params) get_percentage(key string) !f64
fn (params &Params) get_percentage_default(key string, defval string) !f64
//convert GB, MB, KB to bytes e.g. 10 GB becomes bytes in u64
fn (params &Params) get_storagecapacity_in_bytes(key string) !u64
fn (params &Params) get_storagecapacity_in_bytes_default(key string, defval u64) !u64
fn (params &Params) get_storagecapacity_in_gigabytes(key string) !u64
//Get Expiration object from time string input input can be either relative or absolute## Relative time
fn (params &Params) get_time(key string) !ourtime.OurTime
fn (params &Params) get_time_default(key string, defval ourtime.OurTime) !ourtime.OurTime
fn (params &Params) get_time_interval(key string) !Duration
fn (params &Params) get_timestamp(key string) !Duration
fn (params &Params) get_timestamp_default(key string, defval Duration) !Duration
fn (params &Params) get_u32(key string) !u32
fn (params &Params) get_u32_default(key string, defval u32) !u32
fn (params &Params) get_u64(key string) !u64
fn (params &Params) get_u64_default(key string, defval u64) !u64
fn (params &Params) get_u8(key string) !u8
fn (params &Params) get_u8_default(key string, defval u8) !u8
```
## how internally a heroscript gets parsed for params
- example to show how a heroscript gets parsed in action with params
- params are part of action object
```heroscript
example text to parse (heroscript)
id:a1 name6:aaaaa
name:'need to do something 1'
description:
'
## markdown works in it
description can be multiline
lets see what happens
- a
- something else
### subtitle
'
name2: test
name3: hi
name10:'this is with space' name11:aaa11
name4: 'aaa'
//somecomment
name5: 'aab'
```
the params are part of the action and are represented as follow for the above:
```vlang
Params{
params: [Param{
key: 'id'
value: 'a1'
}, Param{
key: 'name6'
value: 'aaaaa'
}, Param{
key: 'name'
value: 'need to do something 1'
}, Param{
key: 'description'
value: '## markdown works in it
description can be multiline
lets see what happens
- a
- something else
### subtitle
'
}, Param{
key: 'name2'
value: 'test'
}, Param{
key: 'name3'
value: 'hi'
}, Param{
key: 'name10'
value: 'this is with space'
}, Param{
key: 'name11'
value: 'aaa11'
}, Param{
key: 'name4'
value: 'aaa'
}, Param{
key: 'name5'
value: 'aab'
}]
}
```

View File

@@ -1,441 +0,0 @@
# module osal
import as
```vlang
import freeflowuniverse.osal
osal.ping...
```
## ping
```go
assert ping(address:"338.8.8.8")==.unknownhost
assert ping(address:"8.8.8.8")==.ok
assert ping(address:"18.8.8.8")==.timeout
```
will do a panic if its not one of them, an unknown error
## platform
```go
if platform()==.osx{
//do something
}
pub enum PlatformType {
unknown
osx
ubuntu
alpine
}
pub enum CPUType {
unknown
intel
arm
intel32
arm32
}
```
## process
### execute jobs
```v
mut job2:=osal.exec(cmd:"ls /")?
println(job2)
//wont die, the result can be found in /tmp/execscripts
mut job:=osal.exec(cmd:"ls dsds",ignore_error:true)?
//this one has an error
println(job)
```
All scripts are executed from a file from /tmp/execscripts
If the script executes well then its removed, so no leftovers, if it fails the script stays in the dir
### check process logs
```
mut pm:=process.processmap_get()?
```
info returns like:
```json
}, freeflowuniverse.process.ProcessInfo{
cpu_perc: 0
mem_perc: 0
cmd: 'mc'
pid: 84455
ppid: 84467
rss: 3168
}, freeflowuniverse.process.ProcessInfo{
cpu_perc: 0
mem_perc: 0
cmd: 'zsh -Z -g'
pid: 84467
ppid: 84469
rss: 1360
}]
```
## other commands
fn bin*path() !string
fn cmd_add(args* CmdAddArgs) !
copy a binary to the right location on the local computer . e.g. is /usr/local/bin on linux . e.g. is ~/hero/bin on osx . will also add the bin location to the path of .zprofile and .zshrc (different per platform)
fn cmd*exists(cmd string) bool
fn cmd_exists_profile(cmd string) bool
fn cmd_path(cmd string) !string
is same as executing which in OS returns path or error
fn cmd_to_script_path(cmd Command) !string
will return temporary path which then can be executed, is a helper function for making script out of command
fn cputype() CPUType
fn cputype_enum_from_string(cpytype string) CPUType
Returns the enum value that matches the provided string for CPUType
fn dir_delete(path string) !
remove all if it exists
fn dir_ensure(path string) !
remove all if it exists
fn dir_reset(path string) !
remove all if it exists and then (re-)create
fn done_delete(key string) !
fn done_exists(key string) bool
fn done_get(key string) ?string
fn done_get_int(key string) int
fn done_get_str(key string) string
fn done_print() !
fn done_reset() !
fn done_set(key string, val string) !
fn download(args* DownloadArgs) !pathlib.Path
if name is not specified, then will be the filename part if the last ends in an extension like .md .txt .log .text ... the file will be downloaded
fn env_get(key string) !string
Returns the requested environment variable if it exists or throws an error if it does not
fn env_get_all() map[string]string
Returns all existing environment variables
fn env_get_default(key string, def string) string
Returns the requested environment variable if it exists or returns the provided default value if it does not
fn env_set(args EnvSet)
Sets an environment if it was not set before, it overwrites the enviroment variable if it exists and if overwrite was set to true (default)
fn env_set_all(args EnvSetAll)
Allows to set multiple enviroment variables in one go, if clear_before_set is true all existing environment variables will be unset before the operation, if overwrite_if_exists is set to true it will overwrite all existing enviromnent variables
fn env_unset(key string)
Unsets an environment variable
fn env_unset_all()
Unsets all environment variables
fn exec(cmd Command) !Job
cmd is the cmd to execute can use ' ' and spaces . if \n in cmd it will write it to ext and then execute with bash . if die==false then will just return returncode,out but not return error . if stdout will show stderr and stdout . . if cmd starts with find or ls, will give to bash -c so it can execute . if cmd has no path, path will be found . . Command argument: .
````
name string // to give a name to your command, good to see logs...
cmd string
description string
timeout int = 3600 // timeout in sec
stdout bool = true
stdout_log bool = true
raise_error bool = true // if false, will not raise an error but still error report
ignore_error bool // means if error will just exit and not raise, there will be no error reporting
work_folder string // location where cmd will be executed
environment map[string]string // env variables
ignore_error_codes []int
scriptpath string // is the path where the script will be put which is executed
scriptkeep bool // means we don't remove the script
debug bool // if debug will put +ex in the script which is being executed and will make sure script stays
shell bool // means we will execute it in a shell interactive
retry int
interactive bool = true // make sure we run on non interactive way
async bool
runtime RunTime (.bash, .python)
returns Job:
start time.Time
end time.Time
cmd Command
output []string
error []string
exit_code int
status JobStatus
process os.Process
```
return Job .
fn exec_string(cmd Command) !string
cmd is the cmd to execute can use ' ' and spaces if \n in cmd it will write it to ext and then execute with bash if die==false then will just return returncode,out but not return error if stdout will show stderr and stdout
if cmd starts with find or ls, will give to bash -c so it can execute if cmd has no path, path will be found $... are remplaced by environment arguments TODO:implement
Command argument: cmd string timeout int = 600 stdout bool = true die bool = true debug bool
return what needs to be executed can give it to bash -c ...
fn execute*debug(cmd string) !string
fn execute_interactive(cmd string) !
shortcut to execute a job interactive means in shell
fn execute_ok(cmd string) bool
executes a cmd, if not error return true
fn execute_silent(cmd string) !string
shortcut to execute a job silent
fn execute_stdout(cmd string) !string
shortcut to execute a job to stdout
fn file_read(path string) !string
fn file_write(path string, text string) !
fn get_logger() log.Logger
Returns a logger object and allows you to specify via environment argument OSAL_LOG_LEVEL the debug level
fn hero_path() !string
fn hostname() !string
fn initname() !string
e.g. systemd, bash, zinit
fn ipaddr_pub_get() !string
Returns the ipaddress as known on the public side is using resolver4.opendns.com
fn is_linux()! bool
fn is_linux_arm()! bool
fn is_linux_intel()! bool
fn is_osx()! bool
fn is_osx_arm()! bool
fn is_osx_intel()! bool
fn is_ubuntu()! bool
fn load_env_file(file_path string) !
fn memdb_exists(key string) bool
fn memdb_get(key string) string
fn memdb_set(key string, val string)
fn package_install(name* string) !
install a package will use right commands per platform
fn package_refresh() !
update the package list
fn ping(args PingArgs) PingResult
if reached in timout result will be True address is e.g. 8.8.8.8 ping means we check if the destination responds
fn platform() PlatformType
fn platform_enum_from_string(platform string) PlatformType
fn process_exists(pid int) bool
fn process_exists_byname(name string) !bool
fn process_kill_recursive(args ProcessKillArgs) !
kill process and all the ones underneith
fn processinfo_children(pid int) !ProcessMap
get all children of 1 process
fn processinfo_get(pid int) !ProcessInfo
get process info from 1 specific process returns
` pub struct ProcessInfo {
pub mut:
cpu_perc f32
mem_perc f32
cmd string
pid int
ppid int
//resident memory
rss int
}
`
fn processinfo_get_byname(name string) ![]ProcessInfo
fn processinfo_with_children(pid int) !ProcessMap
return the process and its children
fn processmap_get() !ProcessMap
make sure to use new first, so that the connection has been initted then you can get it everywhere
fn profile_path() string
fn profile_path_add(args ProfilePathAddArgs) !
add the following path to a profile
fn profile_path_add_hero() !string
fn profile_path_source() string
return the source statement if the profile exists
fn profile_path_source_and() string
return source $path && . or empty if it doesn't exist
fn sleep(duration int)
sleep in seconds
fn tcp_port_test(args TcpPortTestArgs) bool
test if a tcp port answers
` address string //192.168.8.8
port int = 22
timeout u16 = 2000 // total time in milliseconds to keep on trying
`
fn user_add(args UserArgs) !int
add's a user if the user does not exist yet
fn user_exists(username string) bool
fn user_id_get(username string) !int
fn usr_local_path() !string
/usr/local on linux, ${os.home_dir()}/hero on osx
fn whoami() !string
fn write_flags[T](options T) string
enum CPUType {
unknown
intel
arm
intel32
arm32
}
enum ErrorType {
exec
timeout
args
}
enum JobStatus {
init
running
error_exec
error_timeout
error_args
done
}
enum PMState {
init
ok
old
}
enum PingResult {
ok
timeout // timeout from ping
unknownhost // means we don't know the hostname its a dns issue
}
enum PlatformType {
unknown
osx
ubuntu
alpine
arch
suse
}
enum RunTime {
bash
python
heroscript
herocmd
v
}
struct CmdAddArgs {
pub mut:
cmdname string
source string @[required] // path where the binary is
symlink bool // if rather than copy do a symlink
reset bool // if existing cmd will delete
// bin_repo_url string = 'https://github.com/freeflowuniverse/freeflow_binary' // binary where we put the results
}
struct Command {
pub mut:
name string // to give a name to your command, good to see logs...
cmd string
description string
timeout int = 3600 // timeout in sec
stdout bool = true
stdout_log bool = true
raise_error bool = true // if false, will not raise an error but still error report
ignore_error bool // means if error will just exit and not raise, there will be no error reporting
work_folder string // location where cmd will be executed
environment map[string]string // env variables
ignore_error_codes []int
scriptpath string // is the path where the script will be put which is executed
scriptkeep bool // means we don't remove the script
debug bool // if debug will put +ex in the script which is being executed and will make sure script stays
shell bool // means we will execute it in a shell interactive
retry int
interactive bool = true
async bool
runtime RunTime
}
struct DownloadArgs {
pub mut:
name string // optional (otherwise derived out of filename)
url string
reset bool // will remove
hash string // if hash is known, will verify what hash is
dest string // if specified will copy to that destination
timeout int = 180
retry int = 3
minsize_kb u32 = 10 // is always in kb
maxsize_kb u32
expand_dir string
expand_file string
}
struct EnvSet {
pub mut:
key string @[required]
value string @[required]
overwrite bool = true
}
struct EnvSetAll {
pub mut:
env map[string]string
clear_before_set bool
overwrite_if_exists bool = true
}
struct Job {
pub mut:
start time.Time
end time.Time
cmd Command
output string
error string
exit_code int
status JobStatus
process ?&os.Process @[skip; str: skip]
runnr int // nr of time it runs, is for retry
}
fn (mut job Job) execute_retry() !
execute the job and wait on result will retry as specified
fn (mut job Job) execute() !
execute the job, start process, process will not be closed . important you need to close the process later by job.close()! otherwise we get zombie processes
fn (mut job Job) wait() !
wait till the job finishes or goes in error
fn (mut job Job) process() !
process (read std.err and std.out of process)
fn (mut job Job) close() !
will wait & close
struct JobError {
Error
pub mut:
job Job
error_type ErrorType
}
struct PingArgs {
pub mut:
address string @[required]
count u8 = 1 // the ping is successful if it got count amount of replies from the other side
timeout u16 = 1 // the time in which the other side should respond in seconds
retry u8
}
struct ProcessInfo {
pub mut:
cpu_perc f32
mem_perc f32
cmd string
pid int
ppid int // parentpid
// resident memory
rss int
}
fn (mut p ProcessInfo) str() string
struct ProcessKillArgs {
pub mut:
name string
pid int
}
struct ProcessMap {
pub mut:
processes []ProcessInfo
lastscan time.Time
state PMState
pids []int
}
struct ProfilePathAddArgs {
pub mut:
path string @[required]
todelete string // see which one to remove
}
struct TcpPortTestArgs {
pub mut:
address string @[required] // 192.168.8.8
port int = 22
timeout u16 = 2000 // total time in milliseconds to keep on trying
}
struct UserArgs {
pub mut:
name string @[required]
}
-
````

View File

@@ -1 +0,0 @@
../lib/data/encoder/readme.md

View File

@@ -1 +0,0 @@
../lib/data/currency/readme.md

View File

@@ -1,340 +0,0 @@
module datatypes
# datatypes
This module provides implementations of less frequently used, but still common data types.
V's `builtin` module is imported implicitly, and has implementations for arrays, maps and strings. These are good for many applications, but there are a plethora of other useful data structures/containers, like linked lists, priority queues, trees, etc, that allow for algorithms with different time complexities, which may be more suitable for your specific application.
It is implemented using generics, that you have to specialise for the type of your actual elements. For example:
```v
import datatypes
mut stack := datatypes.Stack[int]{}
stack.push(1)
println(stack)
```
## Currently Implemented Datatypes:
- [x] Linked list
- [x] Doubly linked list
- [x] Stack (LIFO)
- [x] Queue (FIFO)
- [x] Min heap (priority queue)
- [x] Set
- [x] Quadtree
- [x] Bloom filter
- [ ] ...
fn new_bloom_filter[T](hash_func fn (T) u32, table_size int, num_functions int) !&BloomFilter[T]
new_bloom_filter creates a new bloom_filter. `table_size` should be greater than 0, and `num_functions` should be 1~16.
fn new_bloom_filter_fast[T](hash_func fn (T) u32) &BloomFilter[T]
new_bloom_filter_fast creates a new bloom_filter. `table_size` is 16384, and `num_functions` is 4.
fn new_ringbuffer[T](s int) RingBuffer[T]
new_ringbuffer creates an empty ring buffer of size `s`.
fn (mut bst BSTree[T]) insert(value T) bool
insert give the possibility to insert an element in the BST.
fn (bst &BSTree[T]) contains(value T) bool
contains checks if an element with a given `value` is inside the BST.
fn (mut bst BSTree[T]) remove(value T) bool
remove removes an element with `value` from the BST.
fn (bst &BSTree[T]) is_empty() bool
is_empty checks if the BST is empty
fn (bst &BSTree[T]) in_order_traversal() []T
in_order_traversal traverses the BST in order, and returns the result as an array.
fn (bst &BSTree[T]) post_order_traversal() []T
post_order_traversal traverses the BST in post order, and returns the result in an array.
fn (bst &BSTree[T]) pre_order_traversal() []T
pre_order_traversal traverses the BST in pre order, and returns the result as an array.
fn (bst &BSTree[T]) to_left(value T) !T
to_left returns the value of the node to the left of the node with `value` specified if it exists, otherwise the a false value is returned.
An example of usage can be the following one
```v
left_value, exist := bst.to_left(10)
```
fn (bst &BSTree[T]) to_right(value T) !T
to_right return the value of the element to the right of the node with `value` specified, if exist otherwise, the boolean value is false An example of usage can be the following one
```v
left_value, exist := bst.to_right(10)
```
fn (bst &BSTree[T]) max() !T
max return the max element inside the BST. Time complexity O(N) if the BST is not balanced
fn (bst &BSTree[T]) min() !T
min return the minimum element in the BST. Time complexity O(N) if the BST is not balanced.
fn (mut b BloomFilter[T]) add(element T)
adds the element to bloom filter.
fn (b &BloomFilter[T]) exists(element T) bool
checks the element is exists.
fn (l &BloomFilter[T]) @union(r &BloomFilter[T]) !&BloomFilter[T]
@union returns the union of the two bloom filters.
fn (l &BloomFilter[T]) intersection(r &BloomFilter[T]) !&BloomFilter[T]
intersection returns the intersection of bloom filters.
fn (list DoublyLinkedList[T]) is_empty() bool
is_empty checks if the linked list is empty
fn (list DoublyLinkedList[T]) len() int
len returns the length of the linked list
fn (list DoublyLinkedList[T]) first() !T
first returns the first element of the linked list
fn (list DoublyLinkedList[T]) last() !T
last returns the last element of the linked list
fn (mut list DoublyLinkedList[T]) push_back(item T)
push_back adds an element to the end of the linked list
fn (mut list DoublyLinkedList[T]) push_front(item T)
push_front adds an element to the beginning of the linked list
fn (mut list DoublyLinkedList[T]) push_many(elements []T, direction Direction)
push_many adds array of elements to the beginning of the linked list
fn (mut list DoublyLinkedList[T]) pop_back() !T
pop_back removes the last element of the linked list
fn (mut list DoublyLinkedList[T]) pop_front() !T
pop_front removes the last element of the linked list
fn (mut list DoublyLinkedList[T]) insert(idx int, item T) !
insert adds an element to the linked list at the given index
fn (list &DoublyLinkedList[T]) index(item T) !int
index searches the linked list for item and returns the forward index or none if not found.
fn (mut list DoublyLinkedList[T]) delete(idx int)
delete removes index idx from the linked list and is safe to call for any idx.
fn (list DoublyLinkedList[T]) str() string
str returns a string representation of the linked list
fn (list DoublyLinkedList[T]) array() []T
array returns a array representation of the linked list
fn (mut list DoublyLinkedList[T]) next() ?T
next implements the iter interface to use DoublyLinkedList with V's `for x in list {` loop syntax.
fn (mut list DoublyLinkedList[T]) iterator() DoublyListIter[T]
iterator returns a new iterator instance for the `list`.
fn (mut list DoublyLinkedList[T]) back_iterator() DoublyListIterBack[T]
back_iterator returns a new backwards iterator instance for the `list`.
fn (mut iter DoublyListIterBack[T]) next() ?T
next returns *the previous* element of the list, or `none` when the start of the list is reached. It is called by V's `for x in iter{` on each iteration.
fn (mut iter DoublyListIter[T]) next() ?T
next returns *the next* element of the list, or `none` when the end of the list is reached. It is called by V's `for x in iter{` on each iteration.
fn (list LinkedList[T]) is_empty() bool
is_empty checks if the linked list is empty
fn (list LinkedList[T]) len() int
len returns the length of the linked list
fn (list LinkedList[T]) first() !T
first returns the first element of the linked list
fn (list LinkedList[T]) last() !T
last returns the last element of the linked list
fn (list LinkedList[T]) index(idx int) !T
index returns the element at the given index of the linked list
fn (mut list LinkedList[T]) push(item T)
push adds an element to the end of the linked list
fn (mut list LinkedList[T]) push_many(elements []T)
push adds an array of elements to the end of the linked list
fn (mut list LinkedList[T]) pop() !T
pop removes the last element of the linked list
fn (mut list LinkedList[T]) shift() !T
shift removes the first element of the linked list
fn (mut list LinkedList[T]) insert(idx int, item T) !
insert adds an element to the linked list at the given index
fn (mut list LinkedList[T]) prepend(item T)
prepend adds an element to the beginning of the linked list (equivalent to insert(0, item))
fn (list LinkedList[T]) str() string
str returns a string representation of the linked list
fn (list LinkedList[T]) array() []T
array returns a array representation of the linked list
fn (mut list LinkedList[T]) next() ?T
next implements the iteration interface to use LinkedList with V's `for` loop syntax.
fn (mut list LinkedList[T]) iterator() ListIter[T]
iterator returns a new iterator instance for the `list`.
fn (mut iter ListIter[T]) next() ?T
next returns the next element of the list, or `none` when the end of the list is reached. It is called by V's `for x in iter{` on each iteration.
fn (mut heap MinHeap[T]) insert(item T)
insert adds an element to the heap.
fn (mut heap MinHeap[T]) insert_many(elements []T)
insert array of elements to the heap.
fn (mut heap MinHeap[T]) pop() !T
pop removes the top-most element from the heap.
fn (heap MinHeap[T]) peek() !T
peek gets the top-most element from the heap without removing it.
fn (heap MinHeap[T]) len() int
len returns the number of elements in the heap.
fn (queue Queue[T]) is_empty() bool
is_empty checks if the queue is empty
fn (queue Queue[T]) len() int
len returns the length of the queue
fn (queue Queue[T]) peek() !T
peek returns the head of the queue (first element added)
fn (queue Queue[T]) last() !T
last returns the tail of the queue (last element added)
fn (queue Queue[T]) index(idx int) !T
index returns the element at the given index of the queue
fn (mut queue Queue[T]) push(item T)
push adds an element to the tail of the queue
fn (mut queue Queue[T]) pop() !T
pop removes the element at the head of the queue and returns it
fn (queue Queue[T]) str() string
str returns a string representation of the queue
fn (queue Queue[T]) array() []T
array returns a array representation of the queue
fn (mut rb RingBuffer[T]) push(element T) !
push adds an element to the ring buffer.
fn (mut rb RingBuffer[T]) pop() !T
pop returns the oldest element in the buffer.
fn (mut rb RingBuffer[T]) push_many(elements []T) !
push_many pushes an array to the buffer.
fn (mut rb RingBuffer[T]) pop_many(n u64) ![]T
pop_many returns `n` elements of the buffer starting with the oldest one.
fn (rb RingBuffer[T]) is_empty() bool
is_empty returns `true` if the ring buffer is empty, `false` otherwise.
fn (rb RingBuffer[T]) is_full() bool
is_full returns `true` if the ring buffer is full, `false` otherwise.
fn (rb RingBuffer[T]) capacity() int
capacity returns the capacity of the ring buffer.
fn (mut rb RingBuffer[T]) clear()
clear empties the ring buffer and all pushed elements.
fn (rb RingBuffer[T]) occupied() int
occupied returns the occupied capacity of the buffer.
fn (rb RingBuffer[T]) remaining() int
remaining returns the remaining capacity of the buffer.
fn (set Set[T]) exists(element T) bool
checks the element is exists.
fn (mut set Set[T]) add(element T)
adds the element to set, if it is not present already.
fn (mut set Set[T]) remove(element T)
removes the element from set.
fn (set Set[T]) pick() !T
pick returns an arbitrary element of set, if set is not empty.
fn (mut set Set[T]) rest() ![]T
rest returns the set consisting of all elements except for the arbitrary element.
fn (mut set Set[T]) pop() !T
pop returns an arbitrary element and deleting it from set.
fn (mut set Set[T]) clear()
delete all elements of set.
fn (l Set[T]) == (r Set[T]) bool
== checks whether the two given sets are equal (i.e. contain all and only the same elements).
fn (set Set[T]) is_empty() bool
is_empty checks whether the set is empty or not.
fn (set Set[T]) size() int
size returns the number of elements in the set.
fn (set Set[T]) copy() Set[T]
copy returns a copy of all the elements in the set.
fn (mut set Set[T]) add_all(elements []T)
add_all adds the whole `elements` array to the set
fn (l Set[T]) @union(r Set[T]) Set[T]
@union returns the union of the two sets.
fn (l Set[T]) intersection(r Set[T]) Set[T]
intersection returns the intersection of sets.
fn (l Set[T]) - (r Set[T]) Set[T]
- returns the difference of sets.
fn (l Set[T]) subset(r Set[T]) bool
subset returns true if the set `r` is a subset of the set `l`.
fn (stack Stack[T]) is_empty() bool
is_empty checks if the stack is empty
fn (stack Stack[T]) len() int
len returns the length of the stack
fn (stack Stack[T]) peek() !T
peek returns the top of the stack
fn (mut stack Stack[T]) push(item T)
push adds an element to the top of the stack
fn (mut stack Stack[T]) pop() !T
pop removes the element at the top of the stack and returns it
fn (stack Stack[T]) str() string
str returns a string representation of the stack
fn (stack Stack[T]) array() []T
array returns a array representation of the stack
enum Direction {
front
back
}
struct AABB {
pub mut:
x f64
y f64
width f64
height f64
}
struct BSTree[T] {
mut:
root &BSTreeNode[T] = unsafe { 0 }
}
Pure Binary Seach Tree implementation
Pure V implementation of the Binary Search Tree Time complexity of main operation O(log N) Space complexity O(N)
struct DoublyLinkedList[T] {
mut:
head &DoublyListNode[T] = unsafe { 0 }
tail &DoublyListNode[T] = unsafe { 0 }
// Internal iter pointer for allowing safe modification
// of the list while iterating. TODO: use an option
// instead of a pointer to determine it is initialized.
iter &DoublyListIter[T] = unsafe { 0 }
len int
}
DoublyLinkedList[T] represents a generic doubly linked list of elements, each of type T.
struct DoublyListIter[T] {
mut:
node &DoublyListNode[T] = unsafe { 0 }
}
DoublyListIter[T] is an iterator for DoublyLinkedList. It starts from *the start* and moves forwards to *the end* of the list. It can be used with V's `for x in iter {` construct. One list can have multiple independent iterators, pointing to different positions/places in the list. A DoublyListIter iterator instance always traverses the list from *start to finish*.
struct DoublyListIterBack[T] {
mut:
node &DoublyListNode[T] = unsafe { 0 }
}
DoublyListIterBack[T] is an iterator for DoublyLinkedList. It starts from *the end* and moves backwards to *the start* of the list. It can be used with V's `for x in iter {` construct. One list can have multiple independent iterators, pointing to different positions/places in the list. A DoublyListIterBack iterator instance always traverses the list from *finish to start*.
struct LinkedList[T] {
mut:
head &ListNode[T] = unsafe { 0 }
len int
// Internal iter pointer for allowing safe modification
// of the list while iterating. TODO: use an option
// instead of a pointer to determine if it is initialized.
iter &ListIter[T] = unsafe { 0 }
}
struct ListIter[T] {
mut:
node &ListNode[T] = unsafe { 0 }
}
ListIter[T] is an iterator for LinkedList. It can be used with V's `for x in iter {` construct. One list can have multiple independent iterators, pointing to different positions/places in the list. An iterator instance always traverses the list from start to finish.
struct ListNode[T] {
mut:
data T
next &ListNode[T] = unsafe { 0 }
}
struct MinHeap[T] {
mut:
data []T
}
MinHeap is a binary minimum heap data structure.
struct Quadtree {
pub mut:
perimeter AABB
capacity int
depth int
level int
particles []AABB
nodes []Quadtree
}
fn (mut q Quadtree) create(x f64, y f64, width f64, height f64, capacity int, depth int, level int) Quadtree
create returns a new configurable root node for the tree.
fn (mut q Quadtree) insert(p AABB)
insert recursively adds a particle in the correct index of the tree.
fn (mut q Quadtree) retrieve(p AABB) []AABB
retrieve recursively checks if a particle is in a specific index of the tree.
fn (mut q Quadtree) clear()
clear flushes out nodes and particles from the tree.
fn (q Quadtree) get_nodes() []Quadtree
get_nodes recursively returns the subdivisions the tree has.
struct Queue[T] {
mut:
elements LinkedList[T]
}
struct RingBuffer[T] {
mut:
reader int // index of the tail where data is going to be read
writer int // index of the head where data is going to be written
content []T
}
RingBuffer represents a ring buffer also known as a circular buffer.
struct Set[T] {
mut:
elements map[T]u8
}
struct Stack[T] {
mut:
elements []T
}

View File

@@ -1,79 +0,0 @@
## how internally a heroscript gets parsed for params
- example to show how a heroscript gets parsed in action with params
- params are part of action object
```heroscript
example text to parse (heroscript)
id:a1 name6:aaaaa
name:'need to do something 1'
description:
'
## markdown works in it
description can be multiline
lets see what happens
- a
- something else
### subtitle
'
name2: test
name3: hi
name10:'this is with space' name11:aaa11
name4: 'aaa'
//somecomment
name5: 'aab'
```
the params are part of the action and are represented as follow for the above:
```vlang
Params{
params: [Param{
key: 'id'
value: 'a1'
}, Param{
key: 'name6'
value: 'aaaaa'
}, Param{
key: 'name'
value: 'need to do something 1'
}, Param{
key: 'description'
value: '## markdown works in it
description can be multiline
lets see what happens
- a
- something else
### subtitle
'
}, Param{
key: 'name2'
value: 'test'
}, Param{
key: 'name3'
value: 'hi'
}, Param{
key: 'name10'
value: 'this is with space'
}, Param{
key: 'name11'
value: 'aaa11'
}, Param{
key: 'name4'
value: 'aaa'
}, Param{
key: 'name5'
value: 'aab'
}]
}
```

View File

@@ -1 +0,0 @@
../crystallib/virt/docker/readme.md

View File

@@ -1,14 +0,0 @@
## Environment Variables
```v
import freeflowuniverse.herolib.osal
// Get environment variable
value := osal.env_get('PATH')!
// Set environment variable
osal.env_set('MY_VAR', 'value')!
// Check if environment variable exists
exists := osal.env_exists('MY_VAR')
```

View File

@@ -1 +0,0 @@
../lib/develop/gittools/README.md

View File

@@ -0,0 +1,420 @@
# OSAL Core Module (freeflowuniverse.herolib.osal.core)
This document describes the core functionalities of the Operating System Abstraction Layer (OSAL) module, designed for platform-independent system operations in V.
```v
//example how to get started
import freeflowuniverse.herolib.osal.core as osal
osal.exec(...)!
```
## 1. Process Management
### `osal.exec(cmd: Command) !Job`
Executes a shell command with extensive configuration.
* **Parameters**:
* `cmd` (`Command` struct):
* `cmd` (string): The command string.
* `timeout` (int, default: 3600): Max execution time in seconds.
* `retry` (int): Number of retries on failure.
* `work_folder` (string): Working directory.
* `environment` (map[string]string): Environment variables.
* `stdout` (bool, default: true): Show command output.
* `raise_error` (bool, default: true): Raise V error on failure.
* `ignore_error` (bool): Do not raise error, just report.
* `debug` (bool): Enable debug output.
* `shell` (bool): Execute in interactive shell.
* `async` (bool): Run command asynchronously.
* `runtime` (`RunTime` enum): Specify runtime (`.bash`, `.python`, etc.).
* **Returns**: `Job` struct (contains `status`, `output`, `error`, `exit_code`, `start`, `end`).
* **Error Handling**: Returns `JobError` with `error_type` (`.exec`, `.timeout`, `.args`).
### `osal.execute_silent(cmd string) !string`
Executes a command silently.
* **Parameters**: `cmd` (string): The command string.
* **Returns**: `string` (command output).
### `osal.execute_debug(cmd string) !string`
Executes a command with debug output.
* **Parameters**: `cmd` (string): The command string.
* **Returns**: `string` (command output).
### `osal.execute_stdout(cmd string) !string`
Executes a command and prints output to stdout.
* **Parameters**: `cmd` (string): The command string.
* **Returns**: `string` (command output).
### `osal.execute_interactive(cmd string) !`
Executes a command in an interactive shell.
* **Parameters**: `cmd` (string): The command string.
### `osal.cmd_exists(cmd string) bool`
Checks if a command exists in the system's PATH.
* **Parameters**: `cmd` (string): The command name.
* **Returns**: `bool`.
### `osal.processmap_get() !ProcessMap`
Scans and returns a map of all running processes.
* **Returns**: `ProcessMap` struct (contains `processes` (`[]ProcessInfo`), `lastscan`, `state`, `pids`).
### `osal.processinfo_get(pid int) !ProcessInfo`
Retrieves detailed information for a specific process by PID.
* **Parameters**: `pid` (int): Process ID.
* **Returns**: `ProcessInfo` struct (contains `cpu_perc`, `mem_perc`, `cmd`, `pid`, `ppid`, `rss`).
### `osal.processinfo_get_byname(name string) ![]ProcessInfo`
Retrieves detailed information for processes matching a given name.
* **Parameters**: `name` (string): Process name (substring match).
* **Returns**: `[]ProcessInfo`.
### `osal.process_exists(pid int) bool`
Checks if a process with a given PID exists.
* **Parameters**: `pid` (int): Process ID.
* **Returns**: `bool`.
### `osal.processinfo_with_children(pid int) !ProcessMap`
Returns a process and all its child processes.
* **Parameters**: `pid` (int): Parent Process ID.
* **Returns**: `ProcessMap`.
### `osal.processinfo_children(pid int) !ProcessMap`
Returns all child processes for a given PID.
* **Parameters**: `pid` (int): Parent Process ID.
* **Returns**: `ProcessMap`.
### `osal.process_kill_recursive(args: ProcessKillArgs) !`
Kills a process and all its children by name or PID.
* **Parameters**:
* `args` (`ProcessKillArgs` struct):
* `name` (string): Process name.
* `pid` (int): Process ID.
### `osal.whoami() !string`
Returns the current username.
* **Returns**: `string`.
## 2. Network Utilities
### `osal.ping(args: PingArgs) !PingResult`
Checks host reachability.
* **Parameters**:
* `args` (`PingArgs` struct):
* `address` (string, required): IP address or hostname.
* `count` (u8, default: 1): Number of pings.
* `timeout` (u16, default: 1): Timeout in seconds per ping.
* `retry` (u8): Number of retry attempts.
* **Returns**: `PingResult` enum (`.ok`, `.timeout`, `.unknownhost`).
### `osal.tcp_port_test(args: TcpPortTestArgs) bool`
Tests if a TCP port is open on a given address.
* **Parameters**:
* `args` (`TcpPortTestArgs` struct):
* `address` (string, required): IP address or hostname.
* `port` (int, default: 22): TCP port number.
* `timeout` (u16, default: 2000): Total timeout in milliseconds.
* **Returns**: `bool`.
### `osal.ipaddr_pub_get() !string`
Retrieves the public IP address.
* **Returns**: `string`.
### `osal.is_ip_on_local_interface(ip string) !bool`
Checks if a given IP address is bound to a local network interface.
* **Parameters**: `ip` (string): IP address to check.
* **Returns**: `bool`.
## 3. File System Operations
### `osal.file_write(path string, text string) !`
Writes text content to a file.
* **Parameters**:
* `path` (string): File path.
* `text` (string): Content to write.
### `osal.file_read(path string) !string`
Reads content from a file.
* **Parameters**: `path` (string): File path.
* **Returns**: `string` (file content).
### `osal.dir_ensure(path string) !`
Ensures a directory exists, creating it if necessary.
* **Parameters**: `path` (string): Directory path.
### `osal.dir_delete(path string) !`
Deletes a directory if it exists.
* **Parameters**: `path` (string): Directory path.
### `osal.dir_reset(path string) !`
Deletes and then recreates a directory.
* **Parameters**: `path` (string): Directory path.
### `osal.rm(todelete string) !`
Removes files or directories.
* **Parameters**: `todelete` (string): Comma or newline separated list of paths (supports `~` for home directory).
## 4. Environment Variables
### `osal.env_set(args: EnvSet)`
Sets an environment variable.
* **Parameters**:
* `args` (`EnvSet` struct):
* `key` (string, required): Environment variable name.
* `value` (string, required): Value to set.
* `overwrite` (bool, default: true): Overwrite if exists.
### `osal.env_unset(key string)`
Unsets a specific environment variable.
* **Parameters**: `key` (string): Environment variable name.
### `osal.env_unset_all()`
Unsets all environment variables.
### `osal.env_set_all(args: EnvSetAll)`
Sets multiple environment variables.
* **Parameters**:
* `args` (`EnvSetAll` struct):
* `env` (map[string]string): Map of key-value pairs.
* `clear_before_set` (bool): Clear all existing variables before setting.
* `overwrite_if_exists` (bool, default: true): Overwrite existing variables.
### `osal.env_get(key string) !string`
Retrieves the value of a specific environment variable.
* **Parameters**: `key` (string): Environment variable name.
* **Returns**: `string` (variable value).
### `osal.env_exists(key string) !bool`
Checks if an environment variable exists.
* **Parameters**: `key` (string): Environment variable name.
* **Returns**: `bool`.
### `osal.env_get_default(key string, def string) string`
Retrieves an environment variable or a default value if not found.
* **Parameters**:
* `key` (string): Environment variable name.
* `def` (string): Default value.
* **Returns**: `string`.
### `osal.load_env_file(file_path string) !`
Loads environment variables from a specified file.
* **Parameters**: `file_path` (string): Path to the environment file.
## 5. Command & Profile Management
### `osal.cmd_add(args: CmdAddArgs) !`
Adds (copies or symlinks) a binary to system paths and updates user profiles.
* **Parameters**:
* `args` (`CmdAddArgs` struct):
* `cmdname` (string): Name of the command (optional, derived from source if empty).
* `source` (string, required): Path to the binary.
* `symlink` (bool): Create a symlink instead of copying.
* `reset` (bool, default: true): Delete existing command if found.
### `osal.profile_path_add_hero() !string`
Ensures the `~/hero/bin` path is added to the user's profile.
* **Returns**: `string` (the `~/hero/bin` path).
### `osal.bin_path() !string`
Returns the preferred binary installation path (`~/hero/bin`).
* **Returns**: `string`.
### `osal.hero_path() !string`
Returns the `~/hero` directory path.
* **Returns**: `string`.
### `osal.usr_local_path() !string`
Returns `/usr/local` for Linux or `~/hero` for macOS.
* **Returns**: `string`.
### `osal.profile_path_source() !string`
Returns a source statement for the preferred profile file (e.g., `. /home/user/.zprofile`).
* **Returns**: `string`.
### `osal.profile_path_source_and() !string`
Returns a source statement followed by `&&` for command chaining, or empty if profile doesn't exist.
* **Returns**: `string`.
### `osal.profile_path_add_remove(args: ProfilePathAddRemoveArgs) !`
Adds and/or removes paths from specified or preferred user profiles.
* **Parameters**:
* `args` (`ProfilePathAddRemoveArgs` struct):
* `paths_profile` (string): Comma/newline separated list of profile file paths (optional, uses preferred if empty).
* `paths2add` (string): Comma/newline separated list of paths to add.
* `paths2delete` (string): Comma/newline separated list of paths to delete.
* `allprofiles` (bool): Apply to all known profile files.
### `osal.cmd_path(cmd string) !string`
Returns the full path of an executable command using `which`.
* **Parameters**: `cmd` (string): Command name.
* **Returns**: `string` (full path).
### `osal.cmd_delete(cmd string) !`
Deletes commands from their found locations.
* **Parameters**: `cmd` (string): Command name.
### `osal.profile_paths_all() ![]string`
Lists all possible profile file paths in the OS.
* **Returns**: `[]string`.
### `osal.profile_paths_preferred() ![]string`
Lists preferred profile file paths based on the operating system.
* **Returns**: `[]string`.
### `osal.profile_path() !string`
Returns the most preferred profile file path.
* **Returns**: `string`.
## 6. System Information & Utilities
### `osal.platform() !PlatformType`
Identifies the operating system.
* **Returns**: `PlatformType` enum (`.unknown`, `.osx`, `.ubuntu`, `.alpine`, `.arch`, `.suse`).
### `osal.cputype() !CPUType`
Identifies the CPU architecture.
* **Returns**: `CPUType` enum (`.unknown`, `.intel`, `.arm`, `.intel32`, `.arm32`).
### `osal.is_linux() !bool`
Checks if the current OS is Linux.
* **Returns**: `bool`.
### `osal.is_osx() !bool`
Checks if the current OS is macOS.
* **Returns**: `bool`.
### `osal.is_ubuntu() !bool`
Checks if the current OS is Ubuntu.
* **Returns**: `bool`.
### `osal.is_osx_arm() !bool`
Checks if the current OS is macOS ARM.
* **Returns**: `bool`.
### `osal.is_linux_arm() !bool`
Checks if the current OS is Linux ARM.
* **Returns**: `bool`.
### `osal.is_osx_intel() !bool`
Checks if the current OS is macOS Intel.
* **Returns**: `bool`.
### `osal.is_linux_intel() !bool`
Checks if the current OS is Linux Intel.
* **Returns**: `bool`.
### `osal.hostname() !string`
Returns the system hostname.
* **Returns**: `string`.
### `osal.initname() !string`
Returns the init system name (e.g., `systemd`, `bash`, `zinit`).
* **Returns**: `string`.
### `osal.sleep(duration int)`
Pauses execution for a specified duration.
* **Parameters**: `duration` (int): Sleep duration in seconds.
### `osal.download(args: DownloadArgs) !pathlib.Path`
Downloads a file from a URL.
* **Parameters**:
* `args` (`DownloadArgs` struct):
* `url` (string, required): URL of the file.
* `name` (string): Optional, derived from filename if empty.
* `reset` (bool): Force download, remove existing.
* `hash` (string): Hash for verification.
* `dest` (string): Destination path.
* `timeout` (int, default: 180): Download timeout in seconds.
* `retry` (int, default: 3): Number of retries.
* `minsize_kb` (u32, default: 10): Minimum expected size in KB.
* `maxsize_kb` (u32): Maximum expected size in KB.
* `expand_dir` (string): Directory to expand archive into.
* `expand_file` (string): File to expand archive into.
* **Returns**: `pathlib.Path` (path to the downloaded file/directory).
### `osal.user_exists(username string) bool`
Checks if a user exists on the system.
* **Parameters**: `username` (string): Username to check.
* **Returns**: `bool`.
### `osal.user_id_get(username string) !int`
Retrieves the user ID for a given username.
* **Parameters**: `username` (string): Username.
* **Returns**: `int` (User ID).
### `osal.user_add(args: UserArgs) !int`
Adds a new user to the system.
* **Parameters**:
* `args` (`UserArgs` struct):
* `name` (string, required): Username to add.
* **Returns**: `int` (User ID of the added user).
## Enums & Structs
### `enum PlatformType`
Represents the detected operating system.
* Values: `unknown`, `osx`, `ubuntu`, `alpine`, `arch`, `suse`.
### `enum CPUType`
Represents the detected CPU architecture.
* Values: `unknown`, `intel`, `arm`, `intel32`, `arm32`.
### `enum RunTime`
Specifies the runtime environment for command execution.
* Values: `bash`, `python`, `heroscript`, `herocmd`, `v`.
### `enum JobStatus`
Status of an executed command job.
* Values: `init`, `running`, `error_exec`, `error_timeout`, `error_args`, `done`.
### `enum ErrorType`
Types of errors that can occur during job execution.
* Values: `exec`, `timeout`, `args`.
### `enum PingResult`
Result of a ping operation.
* Values: `ok`, `timeout`, `unknownhost`.
### `struct Command`
Configuration for `osal.exec` function. (See `osal.exec` parameters for fields).
### `struct Job`
Result object returned by `osal.exec`. (See `osal.exec` returns for fields).
### `struct JobError`
Error details for failed jobs.
### `struct PingArgs`
Arguments for `osal.ping` function. (See `osal.ping` parameters for fields).
### `struct TcpPortTestArgs`
Arguments for `osal.tcp_port_test` function. (See `osal.tcp_port_test` parameters for fields).
### `struct EnvSet`
Arguments for `osal.env_set` function. (See `osal.env_set` parameters for fields).
### `struct EnvSetAll`
Arguments for `osal.env_set_all` function. (See `osal.env_set_all` parameters for fields).
### `struct CmdAddArgs`
Arguments for `osal.cmd_add` function. (See `osal.cmd_add` parameters for fields).
### `struct ProfilePathAddRemoveArgs`
Arguments for `osal.profile_path_add_remove` function. (See `osal.profile_path_add_remove` parameters for fields).
### `struct ProcessMap`
Contains a list of `ProcessInfo` objects.
### `struct ProcessInfo`
Detailed information about a single process. (See `osal.processinfo_get` returns for fields).
### `struct ProcessKillArgs`
Arguments for `osal.process_kill_recursive` function. (See `osal.process_kill_recursive` parameters for fields).
### `struct DownloadArgs`
Arguments for `osal.download` function. (See `osal.download` parameters for fields).
### `struct UserArgs`
Arguments for `osal.user_add` function. (See `osal.user_add` parameters for fields).

View File

@@ -0,0 +1,92 @@
# OurTime Module
The `OurTime` module in V provides flexible time handling, supporting relative and absolute time formats, Unix timestamps, and formatting utilities.
## Key Features
- Create time objects from strings or current time
- Relative time expressions (e.g., `+1h`, `-2d`)
- Absolute time formats (e.g., `YYYY-MM-DD HH:mm:ss`)
- Unix timestamp conversion
- Time formatting and warping
## Basic Usage
```v
import freeflowuniverse.herolib.data.ourtime
// Current time
mut t := ourtime.now()
// From string
t2 := ourtime.new('2022-12-05 20:14:35')!
// Get formatted string
println(t2.str()) // e.g., 2022-12-05 20:14
// Get Unix timestamp
println(t2.unix()) // e.g., 1670271275
```
## Time Formats
### Relative Time
Use `s` (seconds), `h` (hours), `d` (days), `w` (weeks), `M` (months), `Q` (quarters), `Y` (years).
```v
// Create with relative time
mut t := ourtime.new('+1w +2d -4h')!
// Warp existing time
mut t2 := ourtime.now()
t2.warp('+1h')!
```
### Absolute Time
Supports `YYYY-MM-DD HH:mm:ss`, `YYYY-MM-DD HH:mm`, `YYYY-MM-DD HH`, `YYYY-MM-DD`, `DD-MM-YYYY`.
```v
t1 := ourtime.new('2022-12-05 20:14:35')!
t2 := ourtime.new('2022-12-05')! // Time defaults to 00:00:00
```
## Methods Overview
### Creation
```v
now_time := ourtime.now()
from_string := ourtime.new('2023-01-15')!
from_epoch := ourtime.new_from_epoch(1673788800)
```
### Formatting
```v
mut t := ourtime.now()
println(t.str()) // YYYY-MM-DD HH:mm
println(t.day()) // YYYY-MM-DD
println(t.key()) // YYYY_MM_DD_HH_mm_ss
println(t.md()) // Markdown format
```
### Operations
```v
mut t := ourtime.now()
t.warp('+1h')! // Move 1 hour forward
unix_ts := t.unix()
is_empty := t.empty()
```
## Error Handling
Time parsing methods return a `Result` type and should be handled with `!` or `or` blocks.
```v
t_valid := ourtime.new('2023-01-01')!
t_invalid := ourtime.new('bad-date') or {
println('Error: ${err}')
ourtime.now() // Fallback
}

View File

@@ -0,0 +1,79 @@
# HeroScript: Vlang Integration
## HeroScript Structure
HeroScript is a concise scripting language with the following structure:
```heroscript
!!actor.action_name
param1: 'value1'
param2: 'value with spaces'
multiline_description: '
This is a multiline description.
It can span multiple lines.
'
arg1 arg2 // Arguments without keys
```
Key characteristics:
- **Actions**: Start with `!!`, followed by `actor.action_name` (e.g., `!!mailclient.configure`).
- **Parameters**: Defined as `key:value`. Values can be quoted for spaces.
- **Multiline Support**: Parameters like `description` can span multiple lines.
- **Arguments**: Values without keys (e.g., `arg1`).
## Processing HeroScript in Vlang
HeroScript can be parsed into a `playbook.PlayBook` object, allowing structured access to actions and their parameters,
a good way how to do this as part of a module in a play.v file is shown below.
```v
import freeflowuniverse.herolib.core.playbook { PlayBook }
import freeflowuniverse.herolib.ui.console
@[params]
pub struct PlayArgs {
pub mut:
heroscript string
heroscript_path string
plbook ?PlayBook
reset bool
}
pub fn play(args_ PlayArgs) ! {
mut args := args_
mut plbook := args.plbook or {
playbook.new(text: args.heroscript, path: args.heroscript_path)!
}
// Initialize Docusaurus site manager based on 'docusaurus.define' action
mut ds := new()!
if plbook.exists_once(filter: 'docusaurus.define') {
mut action := plbook.action_get(actor: 'docusaurus', name: 'define')!
mut p := action.params
ds = new(
path_publish: p.get_default('path_publish', '')!
path_build: p.get_default('path_build', '')!
production: p.get_default_false('production')
update: p.get_default_false('update')
)!
}
// Process 'docusaurus.add' actions to configure individual Docusaurus sites
actions := plbook.find(filter: 'docusaurus.add')!
for action in actions {
mut p := action.params
mut site := ds.get(
name: p.get_default('name', 'main')!
nameshort: p.get_default('nameshort', p.get_default('name', 'main')!)!
git_reset: p.get_default_false('git_reset')
//... more
)!
if plbook.exists_once(filter: 'docusaurus.dev') {
site.dev()!
}
}
}
```
For detailed information on parameter retrieval methods (e.g., `p.get()`, `p.get_int()`, `p.get_default_true()`), refer to `aiprompts/ai_core/core_params.md`.

View File

@@ -0,0 +1,107 @@
# HTTPConnection Module
The `HTTPConnection` module provides a robust HTTP client for Vlang, supporting JSON, custom headers, retries, and caching.
## Key Features
- Type-safe JSON methods
- Custom headers
- Retry mechanism
- Caching
- URL encoding
## Basic Usage
```v
import freeflowuniverse.herolib.core.httpconnection
// Create a new HTTP connection
mut conn := httpconnection.new(
name: 'my_api_client'
url: 'https://api.example.com'
retry: 3 // Number of retries for failed requests
cache: true // Enable caching
)!
```
## Integration with Management Classes
To integrate `HTTPConnection` into a management class (e.g., `HetznerManager`), use a method to lazily initialize and return the connection:
```v
// Example: HetznerManager
pub fn (mut h HetznerManager) connection() !&httpconnection.HTTPConnection {
mut c := h.conn or {
mut c2 := httpconnection.new(
name: 'hetzner_${h.name}'
url: h.baseurl
cache: true
retry: 3
)!
c2.basic_auth(h.user, h.password)
c2
}
return c
}
```
## Examples
### GET Request with JSON Response
```v
struct User {
id int
name string
email string
}
user := conn.get_json_generic[User](
prefix: 'users/1'
)!
```
### POST Request with JSON Data
```v
struct NewUserResponse {
id int
status string
}
new_user_resp := conn.post_json_generic[NewUserResponse](
prefix: 'users'
params: {
'name': 'Jane Doe'
'email': 'jane@example.com'
}
)!
```
### Custom Headers
Set default headers or add them per request:
```v
import net.http { Header }
// Set default header
conn.default_header = http.new_header(key: .authorization, value: 'Bearer your-token')
// Add custom header for a specific request
response := conn.get_json(
prefix: 'protected/resource'
header: http.new_header(key: .content_type, value: 'application/json')
)!
```
### Error Handling
Methods return a `Result` type for error handling:
```v
user := conn.get_json_generic[User](
prefix: 'users/1'
) or {
println('Error fetching user: ${err}')
return
}

View File

@@ -0,0 +1,92 @@
# OurTime Module
The `OurTime` module in V provides flexible time handling, supporting relative and absolute time formats, Unix timestamps, and formatting utilities.
## Key Features
- Create time objects from strings or current time
- Relative time expressions (e.g., `+1h`, `-2d`)
- Absolute time formats (e.g., `YYYY-MM-DD HH:mm:ss`)
- Unix timestamp conversion
- Time formatting and warping
## Basic Usage
```v
import freeflowuniverse.herolib.data.ourtime
// Current time
mut t := ourtime.now()
// From string
t2 := ourtime.new('2022-12-05 20:14:35')!
// Get formatted string
println(t2.str()) // e.g., 2022-12-05 20:14
// Get Unix timestamp
println(t2.unix()) // e.g., 1670271275
```
## Time Formats
### Relative Time
Use `s` (seconds), `h` (hours), `d` (days), `w` (weeks), `M` (months), `Q` (quarters), `Y` (years).
```v
// Create with relative time
mut t := ourtime.new('+1w +2d -4h')!
// Warp existing time
mut t2 := ourtime.now()
t2.warp('+1h')!
```
### Absolute Time
Supports `YYYY-MM-DD HH:mm:ss`, `YYYY-MM-DD HH:mm`, `YYYY-MM-DD HH`, `YYYY-MM-DD`, `DD-MM-YYYY`.
```v
t1 := ourtime.new('2022-12-05 20:14:35')!
t2 := ourtime.new('2022-12-05')! // Time defaults to 00:00:00
```
## Methods Overview
### Creation
```v
now_time := ourtime.now()
from_string := ourtime.new('2023-01-15')!
from_epoch := ourtime.new_from_epoch(1673788800)
```
### Formatting
```v
mut t := ourtime.now()
println(t.str()) // YYYY-MM-DD HH:mm
println(t.day()) // YYYY-MM-DD
println(t.key()) // YYYY_MM_DD_HH_mm_ss
println(t.md()) // Markdown format
```
### Operations
```v
mut t := ourtime.now()
t.warp('+1h')! // Move 1 hour forward
unix_ts := t.unix()
is_empty := t.empty()
```
## Error Handling
Time parsing methods return a `Result` type and should be handled with `!` or `or` blocks.
```v
t_valid := ourtime.new('2023-01-01')!
t_invalid := ourtime.new('bad-date') or {
println('Error: ${err}')
ourtime.now() // Fallback
}

View File

@@ -0,0 +1,109 @@
# Parameter Parsing in Vlang
This document details the `paramsparser` module, essential for handling parameters in HeroScript and other contexts.
## Obtaining a `paramsparser` Instance
```v
import freeflowuniverse.herolib.data.paramsparser
// Create new params from a string
params := paramsparser.new("color:red size:'large' priority:1 enable:true")!
// Or create an empty instance and add parameters programmatically
mut params := paramsparser.new_params()
params.set("color", "red")
```
## Parameter Formats
The parser supports various input formats:
1. **Key-value pairs**: `key:value`
2. **Quoted values**: `key:'value with spaces'` (single or double quotes)
3. **Arguments without keys**: `arg1 arg2` (accessed by index)
4. **Comments**: `// this is a comment` (ignored during parsing)
Example:
```vlang
text := "name:'John Doe' age:30 active:true // user details"
params := paramsparser.new(text)!
```
## Parameter Retrieval Methods
The `paramsparser` module provides a comprehensive set of methods for retrieving and converting parameter values.
### Basic Retrieval
- `get(key string) !string`: Retrieves a string value by key. Returns an error if the key does not exist.
- `get_default(key string, defval string) !string`: Retrieves a string value by key, or returns `defval` if the key is not found.
- `exists(key string) bool`: Checks if a keyword argument (`key:value`) exists.
- `exists_arg(key string) bool`: Checks if an argument (value without a key) exists.
### Argument Retrieval (Positional)
- `get_arg(nr int) !string`: Retrieves an argument by its 0-based index. Returns an error if the index is out of bounds.
- `get_arg_default(nr int, defval string) !string`: Retrieves an argument by index, or returns `defval` if the index is out of bounds.
### Type-Specific Retrieval
- `get_int(key string) !int`: Converts and retrieves an integer (int32).
- `get_int_default(key string, defval int) !int`: Retrieves an integer with a default.
- `get_u32(key string) !u32`: Converts and retrieves an unsigned 32-bit integer.
- `get_u32_default(key string, defval u32) !u32`: Retrieves a u32 with a default.
- `get_u64(key string) !u64`: Converts and retrieves an unsigned 64-bit integer.
- `get_u64_default(key string, defval u64) !u64`: Retrieves a u64 with a default.
- `get_u8(key string) !u8`: Converts and retrieves an unsigned 8-bit integer.
- `get_u8_default(key string, defval u8) !u8`: Retrieves a u8 with a default.
- `get_float(key string) !f64`: Converts and retrieves a 64-bit float.
- `get_float_default(key string, defval f64) !f64`: Retrieves a float with a default.
- `get_percentage(key string) !f64`: Converts a percentage string (e.g., "80%") to a float (0.8).
- `get_percentage_default(key string, defval string) !f64`: Retrieves a percentage with a default.
### Boolean Retrieval
- `get_default_true(key string) bool`: Returns `true` if the value is empty, "1", "true", "y", or "yes". Otherwise `false`.
- `get_default_false(key string) bool`: Returns `false` if the value is empty, "0", "false", "n", or "no". Otherwise `true`.
### List Retrieval
Lists are typically comma-separated strings (e.g., `users: "john,jane,bob"`).
- `get_list(key string) ![]string`: Retrieves a list of strings.
- `get_list_default(key string, def []string) ![]string`: Retrieves a list of strings with a default.
- `get_list_int(key string) ![]int`: Retrieves a list of integers.
- `get_list_int_default(key string, def []int) []int`: Retrieves a list of integers with a default.
- `get_list_f32(key string) ![]f32`: Retrieves a list of 32-bit floats.
- `get_list_f32_default(key string, def []f32) []f32`: Retrieves a list of f32 with a default.
- `get_list_f64(key string) ![]f64`: Retrieves a list of 64-bit floats.
- `get_list_f64_default(key string, def []f64) []f64`: Retrieves a list of f64 with a default.
- `get_list_i8(key string) ![]i8`: Retrieves a list of 8-bit signed integers.
- `get_list_i8_default(key string, def []i8) []i8`: Retrieves a list of i8 with a default.
- `get_list_i16(key string) ![]i16`: Retrieves a list of 16-bit signed integers.
- `get_list_i16_default(key string, def []i16) []i16`: Retrieves a list of i16 with a default.
- `get_list_i64(key string) ![]i64`: Retrieves a list of 64-bit signed integers.
- `get_list_i64_default(key string, def []i64) []i64`: Retrieves a list of i64 with a default.
- `get_list_u16(key string) ![]u16`: Retrieves a list of 16-bit unsigned integers.
- `get_list_u16_default(key string, def []u16) []u16`: Retrieves a list of u16 with a default.
- `get_list_u32(key string) ![]u32`: Retrieves a list of 32-bit unsigned integers.
- `get_list_u32_default(key string, def []u32) []u32`: Retrieves a list of u32 with a default.
- `get_list_u64(key string) ![]u64`: Retrieves a list of 64-bit unsigned integers.
- `get_list_u64_default(key string, def []u64) []u64`: Retrieves a list of u64 with a default.
- `get_list_namefix(key string) ![]string`: Retrieves a list of strings, normalizing each item (e.g., "My Name" -> "my_name").
- `get_list_namefix_default(key string, def []string) ![]string`: Retrieves a list of name-fixed strings with a default.
### Specialized Retrieval
- `get_map() map[string]string`: Returns all parameters as a map.
- `get_path(key string) !string`: Retrieves a path string.
- `get_path_create(key string) !string`: Retrieves a path string, creating the directory if it doesn't exist.
- `get_from_hashmap(key string, defval string, hashmap map[string]string) !string`: Retrieves a value from a provided hashmap based on the parameter's value.
- `get_storagecapacity_in_bytes(key string) !u64`: Converts storage capacity strings (e.g., "10 GB", "500 MB") to bytes (u64).
- `get_storagecapacity_in_bytes_default(key string, defval u64) !u64`: Retrieves storage capacity in bytes with a default.
- `get_storagecapacity_in_gigabytes(key string) !u64`: Converts storage capacity strings to gigabytes (u64).
- `get_time(key string) !ourtime.OurTime`: Parses a time string (relative or absolute) into an `ourtime.OurTime` object.
- `get_time_default(key string, defval ourtime.OurTime) !ourtime.OurTime`: Retrieves time with a default.
- `get_time_interval(key string) !Duration`: Parses a time interval string into a `Duration` object.
- `get_timestamp(key string) !Duration`: Parses a timestamp string into a `Duration` object.
- `get_timestamp_default(key string, defval Duration) !Duration`: Retrieves a timestamp with a default.

View File

@@ -0,0 +1,63 @@
# OSAL Core Module - Key Capabilities (freeflowuniverse.herolib.osal.core)
```v
//example how to get started
import freeflowuniverse.herolib.osal.core as osal
osal.exec(cmd:"ls /")!
```
this document has info about the most core functions, more detailed info can be found in `aiprompts/herolib_advanced/osal.md` if needed.
## Key Functions
### 1. Process Execution
* **`osal.exec(cmd: Command) !Job`**: Execute a shell command.
* **Key Parameters**: `cmd` (string), `timeout` (int), `retry` (int), `work_folder` (string), `environment` (map[string]string), `stdout` (bool), `raise_error` (bool).
* **Returns**: `Job` (status, output, error, exit code).
* **`osal.execute_silent(cmd string) !string`**: Execute silently, return output.
* **`osal.cmd_exists(cmd string) bool`**: Check if a command exists.
* **`osal.process_kill_recursive(args: ProcessKillArgs) !`**: Kill a process and its children.
### 2. Network Utilities
* **`osal.ping(args: PingArgs) !PingResult`**: Check host reachability.
* **Key Parameters**: `address` (string).
* **Returns**: `PingResult` (`.ok`, `.timeout`, `.unknownhost`).
* **`osal.tcp_port_test(args: TcpPortTestArgs) bool`**: Test if a TCP port is open.
* **Key Parameters**: `address` (string), `port` (int).
* **`osal.ipaddr_pub_get() !string`**: Get public IP address.
### 3. File System Operations
* **`osal.file_write(path string, text string) !`**: Write text to a file.
* **`osal.file_read(path string) !string`**: Read content from a file.
* **`osal.dir_ensure(path string) !`**: Ensure a directory exists.
* **`osal.rm(todelete string) !`**: Remove files/directories.
### 4. Environment Variables
* **`osal.env_set(args: EnvSet)`**: Set an environment variable.
* **Key Parameters**: `key` (string), `value` (string).
* **`osal.env_get(key string) !string`**: Get an environment variable's value.
* **`osal.load_env_file(file_path string) !`**: Load variables from a file.
### 5. Command & Profile Management
* **`osal.cmd_add(args: CmdAddArgs) !`**: Add a binary to system paths and update profiles.
* **Key Parameters**: `source` (string, required), `cmdname` (string).
* **`osal.profile_path_add_remove(args: ProfilePathAddRemoveArgs) !`**: Add/remove paths from profiles.
* **Key Parameters**: `paths2add` (string), `paths2delete` (string).
### 6. System Information
* **`osal.platform() !PlatformType`**: Identify the operating system.
* **`osal.cputype() !CPUType`**: Identify the CPU architecture.
* **`osal.hostname() !string`**: Get system hostname.
---

View File

@@ -1 +0,0 @@
../lib/data/paramsparser/readme.md

View File

@@ -1,7 +1,7 @@
module escalayer module escalayer
import freeflowuniverse.herolib.clients.openai import freeflowuniverse.herolib.clients.openai
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import os import os
// Get an OpenAI client configured for OpenRouter // Get an OpenAI client configured for OpenRouter

View File

@@ -2,7 +2,7 @@ module main
import os import os
import cli { Command, Flag } import cli { Command, Flag }
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
// import freeflowuniverse.herolib.ai.mcp.vcode // import freeflowuniverse.herolib.ai.mcp.vcode
// import freeflowuniverse.herolib.ai.mcp.mcpgen // import freeflowuniverse.herolib.ai.mcp.mcpgen
// import freeflowuniverse.herolib.ai.mcp.baobab // import freeflowuniverse.herolib.ai.mcp.baobab

View File

@@ -3,7 +3,7 @@ module builder
import os import os
import freeflowuniverse.herolib.core.texttools import freeflowuniverse.herolib.core.texttools
import freeflowuniverse.herolib.core.pathlib import freeflowuniverse.herolib.core.pathlib
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.ui import freeflowuniverse.herolib.ui
import v.embed_file import v.embed_file

View File

@@ -1,7 +1,7 @@
module builder module builder
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.osal.rsync import freeflowuniverse.herolib.osal.core as osal.rsync
// import freeflowuniverse.herolib.core.pathlib // import freeflowuniverse.herolib.core.pathlib
import os import os

View File

@@ -2,8 +2,8 @@ module builder
import os import os
import rand import rand
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.osal.rsync import freeflowuniverse.herolib.osal.core as osal.rsync
import freeflowuniverse.herolib.core.pathlib import freeflowuniverse.herolib.core.pathlib
import freeflowuniverse.herolib.data.ipaddress import freeflowuniverse.herolib.data.ipaddress
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console

View File

@@ -5,7 +5,7 @@ import crypto.md5
import time import time
import freeflowuniverse.herolib.data.ourtime import freeflowuniverse.herolib.data.ourtime
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
// import freeflowuniverse.herolib.osal // import freeflowuniverse.herolib.osal.core as osal
// check command exists on the platform, knows how to deal with different platforms // check command exists on the platform, knows how to deal with different platforms
pub fn (mut node Node) cmd_exists(cmd string) bool { pub fn (mut node Node) cmd_exists(cmd string) bool {

View File

@@ -1,6 +1,6 @@
module builder module builder
import freeflowuniverse.herolib.osal.screen import freeflowuniverse.herolib.osal.core as osal.screen
import freeflowuniverse.herolib.data.ipaddress import freeflowuniverse.herolib.data.ipaddress
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console

View File

@@ -2,7 +2,7 @@ module builder
import os import os
import freeflowuniverse.herolib.core.texttools import freeflowuniverse.herolib.core.texttools
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
@[params] @[params]

View File

@@ -1,7 +1,7 @@
module livekit module livekit
import os import os
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
const env_file = '${os.dir(@FILE)}/.env' const env_file = '${os.dir(@FILE)}/.env'

View File

@@ -1,13 +1,13 @@
module mycelium module mycelium
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.core import freeflowuniverse.herolib.core
import freeflowuniverse.herolib.installers.lang.rust import freeflowuniverse.herolib.installers.lang.rust
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.core.texttools import freeflowuniverse.herolib.core.texttools
import freeflowuniverse.herolib.osal.screen import freeflowuniverse.herolib.osal.core as osal.screen
import freeflowuniverse.herolib.ui import freeflowuniverse.herolib.ui
import freeflowuniverse.herolib.osal.startupmanager import freeflowuniverse.herolib.osal.core as osal.startupmanager
import os import os
import time import time
import json import json

View File

@@ -2,7 +2,7 @@ module postgresql_client
import db.pg import db.pg
import freeflowuniverse.herolib.core.texttools import freeflowuniverse.herolib.core.texttools
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import os import os
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console

View File

@@ -6,7 +6,7 @@ Rclone is this incredible swiss army knive to deal with S3 storage servers.
## Example ## Example
```golang ```golang
import freeflowuniverse.herolib.osal.rclone import freeflowuniverse.herolib.osal.core as osal.rclone
fn main() { fn main() {
do() or { panic(err) } do() or { panic(err) }

View File

@@ -17,7 +17,7 @@ RCloneClient must be installed on your system. Visit https://rclone.org/install/
## Usage ## Usage
```v ```v
import freeflowuniverse.herolib.osal.rclone import freeflowuniverse.herolib.osal.core as osal.rclone
fn main() { fn main() {
// Create a new RCloneClient instance // Create a new RCloneClient instance

View File

@@ -1,6 +1,6 @@
module ${model.name} module ${model.name}
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.core.texttools import freeflowuniverse.herolib.core.texttools
import freeflowuniverse.herolib.core.pathlib import freeflowuniverse.herolib.core.pathlib
@@ -9,8 +9,8 @@ import freeflowuniverse.herolib.installers.ulist
import freeflowuniverse.herolib.installers.base import freeflowuniverse.herolib.installers.base
@if model.startupmanager @if model.startupmanager
import freeflowuniverse.herolib.osal.systemd import freeflowuniverse.herolib.osal.core as osal.systemd
import freeflowuniverse.herolib.osal.zinit import freeflowuniverse.herolib.osal.core as osal.zinit
@end @end
@if model.build @if model.build

View File

@@ -10,8 +10,8 @@ import freeflowuniverse.herolib.data.encoderhero
@end @end
@if model.cat == .installer @if model.cat == .installer
import freeflowuniverse.herolib.osal.startupmanager import freeflowuniverse.herolib.osal.core as osal.startupmanager
import freeflowuniverse.herolib.osal.zinit import freeflowuniverse.herolib.osal.core as osal.zinit
import time import time
@end @end

View File

@@ -1,7 +1,7 @@
module imagemagick module imagemagick
import freeflowuniverse.herolib.core.pathlib import freeflowuniverse.herolib.core.pathlib
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import os import os

View File

@@ -1,6 +1,6 @@
module imagemagick module imagemagick
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
fn (mut image Image) identify_verbose() ! { fn (mut image Image) identify_verbose() ! {

View File

@@ -2,7 +2,7 @@ module imagemagick
import freeflowuniverse.herolib.core.pathlib import freeflowuniverse.herolib.core.pathlib
import freeflowuniverse.herolib.data.paramsparser import freeflowuniverse.herolib.data.paramsparser
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
pub struct DownsizeArgs { pub struct DownsizeArgs {

View File

@@ -2,7 +2,7 @@ module generic
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.core.pathlib import freeflowuniverse.herolib.core.pathlib
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
fn generate_exec(path string, reset bool) ! { fn generate_exec(path string, reset bool) ! {
mut args := args_get(path)! mut args := args_get(path)!

View File

@@ -1,13 +1,13 @@
module ${args.name} module ${args.name}
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.core.texttools import freeflowuniverse.herolib.core.texttools
import freeflowuniverse.herolib.core.pathlib import freeflowuniverse.herolib.core.pathlib
@if args.startupmanager @if args.startupmanager
import freeflowuniverse.herolib.osal.systemd import freeflowuniverse.herolib.osal.core as osal.systemd
import freeflowuniverse.herolib.osal.zinit import freeflowuniverse.herolib.osal.core as osal.zinit
@end @end
import freeflowuniverse.herolib.installers.ulist import freeflowuniverse.herolib.installers.ulist

View File

@@ -7,8 +7,8 @@ import freeflowuniverse.herolib.core.playbook
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
@if args.cat == .installer @if args.cat == .installer
import freeflowuniverse.herolib.osal.startupmanager import freeflowuniverse.herolib.osal.core as osal.startupmanager
import freeflowuniverse.herolib.osal.zinit import freeflowuniverse.herolib.osal.core as osal.zinit
@if args.startupmanager @if args.startupmanager
import time import time
@end @end

View File

@@ -1,6 +1,6 @@
module ${model.name} module ${model.name}
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.core.texttools import freeflowuniverse.herolib.core.texttools
import freeflowuniverse.herolib.core.pathlib import freeflowuniverse.herolib.core.pathlib
@@ -9,8 +9,8 @@ import freeflowuniverse.herolib.installers.ulist
import freeflowuniverse.herolib.installers.base import freeflowuniverse.herolib.installers.base
@if model.startupmanager @if model.startupmanager
import freeflowuniverse.herolib.osal.systemd import freeflowuniverse.herolib.osal.core as osal.systemd
import freeflowuniverse.herolib.osal.zinit import freeflowuniverse.herolib.osal.core as osal.zinit
@end @end
@if model.build @if model.build

View File

@@ -10,8 +10,8 @@ import freeflowuniverse.herolib.data.encoderhero
@end @end
@if model.cat == .installer @if model.cat == .installer
import freeflowuniverse.herolib.osal.startupmanager import freeflowuniverse.herolib.osal.core as osal.startupmanager
import freeflowuniverse.herolib.osal.zinit import freeflowuniverse.herolib.osal.core as osal.zinit
import time import time
@end @end

View File

@@ -1,6 +1,6 @@
module herocmds module herocmds
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.installers.base import freeflowuniverse.herolib.installers.base
import freeflowuniverse.herolib.installers.lang.herolib import freeflowuniverse.herolib.installers.lang.herolib
import freeflowuniverse.herolib.builder import freeflowuniverse.herolib.builder

View File

@@ -1,6 +1,6 @@
module herocmds module herocmds
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.installers.base import freeflowuniverse.herolib.installers.base
import freeflowuniverse.herolib.installers.lang.herolib import freeflowuniverse.herolib.installers.lang.herolib
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console

View File

@@ -1,6 +1,6 @@
module herocmds module herocmds
import freeflowuniverse.herolib.osal.sshagent import freeflowuniverse.herolib.osal.core as osal.sshagent
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.ui import freeflowuniverse.herolib.ui
import cli { Command, Flag } import cli { Command, Flag }

View File

@@ -1,6 +1,6 @@
module playcmds module playcmds
import freeflowuniverse.herolib.osal.sshagent import freeflowuniverse.herolib.osal.core as osal.sshagent
import freeflowuniverse.herolib.core.playbook import freeflowuniverse.herolib.core.playbook
pub fn play_ssh(mut plbook playbook.PlayBook) ! { pub fn play_ssh(mut plbook playbook.PlayBook) ! {

View File

@@ -1,7 +1,7 @@
module ipaddress module ipaddress
import os import os
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.core import freeflowuniverse.herolib.core
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console

View File

@@ -3,7 +3,7 @@ module location
import db.pg import db.pg
import os import os
import encoding.csv import encoding.csv
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.core.pathlib import freeflowuniverse.herolib.core.pathlib
import freeflowuniverse.herolib.clients.postgresql_client import freeflowuniverse.herolib.clients.postgresql_client

View File

@@ -3,7 +3,7 @@ module location
import os import os
import io import io
import time import time
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.core.texttools import freeflowuniverse.herolib.core.texttools

View File

@@ -3,7 +3,7 @@ module streamer
import time import time
import freeflowuniverse.herolib.clients.mycelium import freeflowuniverse.herolib.clients.mycelium
import freeflowuniverse.herolib.data.ourdb import freeflowuniverse.herolib.data.ourdb
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import encoding.base64 import encoding.base64
import json import json

View File

@@ -1,271 +1,218 @@
# ParamsParser Module Documentation # ParamsParser Module: Flexible Parameter Handling in V
The ParamsParser module provides a powerful way to parse and handle parameter strings in V. It's particularly useful for parsing command-line style arguments and key-value pairs from text. The `ParamsParser` module in V provides a robust and intuitive way to parse and manage parameters from various string inputs, such as command-line arguments, configuration strings, or key-value data. It simplifies the extraction and type conversion of values, making it ideal for applications requiring flexible and dynamic parameter processing.
## Basic Usage ## Key Features
* **Flexible Parsing:** Supports key-value pairs, quoted values, and positional arguments.
* **Automatic Type Conversion:** Easily retrieve values as strings, integers, floats, booleans, and various list types.
* **Error Handling:** Integrates with V's error handling for reliable operations.
* **Case-Insensitive Keys:** Provides convenience by treating keys as case-insensitive.
* **Merging Capabilities:** Combine multiple parameter sets effortlessly.
## Installation
```v ```v
import freeflowuniverse.herolib.data.paramsparser import freeflowuniverse.herolib.data.paramsparser
// Create new params from text
params := paramsparser.new("color:red size:'large' priority:1 enable:true")!
// Or create empty params and add later
mut params := paramsparser.new_params()
params.set("color", "red")
``` ```
## Parameter Format ## Basic Usage
The parser supports several formats: ### Creating Parameters
1. Key-value pairs: `key:value` You can create a new `Params` object from a string or initialize an empty one:
2. Quoted values: `key:'value with spaces'`
3. Arguments without keys: `arg1 arg2`
4. Comments: `// this is a comment`
Example:
```v ```v
text := "name:'John Doe' age:30 active:true // user details" // 1. Create from a parameter string
params := paramsparser.new(text)! params_from_string := paramsparser.new("color:red size:'large item:apple' priority:1 enable:true")!
// 2. Create an empty Params object and add values later
mut empty_params := paramsparser.new_params()
empty_params.set("product", "laptop")
empty_params.set("price", "1200")
``` ```
## Getting Values ### Parameter String Format
The module provides various methods to retrieve values: The parser understands several common parameter formats:
* **Key-Value Pairs:** `key:value` (e.g., `name:John`)
* **Quoted Values:** `key:'value with spaces'` or `key:"value with spaces"` (essential for values containing spaces or special characters)
* **Positional Arguments:** `arg1 arg2` (values without an explicit key)
* **Comments:** `// this is a comment` (lines starting with `//` are ignored)
**Example:**
```v
text := "user_name:'Alice Smith' age:28 active:true // user profile data"
parsed_params := paramsparser.new(text)!
// Accessing values
println(parsed_params.get("user_name")!) // Output: Alice Smith
println(parsed_params.get_int("age")!) // Output: 28
println(parsed_params.get_default_true("active")) // Output: true
```
## Retrieving Values
The `ParamsParser` offers a variety of methods to retrieve values, including type-specific getters and options for default values.
### Common Getters
```v ```v
// Get string value // Get string value
name := params.get("name")! // returns "John Doe" name := parsed_params.get("user_name")! // Returns "Alice Smith"
// Get with default value // Get with a default value if key is not found
color := params.get_default("color", "blue")! // returns "blue" if color not set city := parsed_params.get_default("city", "Unknown")! // Returns "Unknown" if 'city' is not set
// Get as integer // Get as integer
age := params.get_int("age")! // returns 30 age := parsed_params.get_int("age")! // Returns 28
// Get as boolean (true if value is "1", "true", "y", "yes")
is_active := params.get_default_true("active")
// Get as float // Get as float
score := params.get_float("score")! temperature := parsed_params.get_float("temp")! // Converts "25.5" to 25.5
// Get as percentage (converts "80%" to 0.8) // Get as percentage (converts "75%" to 0.75)
progress := params.get_percentage("progress")! completion := parsed_params.get_percentage("progress")!
``` ```
## Type Conversion Methods
The module supports various type conversions:
### Basic Types
- `get_int()`: Convert to int32
- `get_u32()`: Convert to unsigned 32-bit integer
- `get_u64()`: Convert to unsigned 64-bit integer
- `get_u8()`: Convert to unsigned 8-bit integer
- `get_float()`: Convert to 64-bit float
- `get_percentage()`: Convert percentage string to float (e.g., "80%" → 0.8)
### Boolean Values ### Boolean Values
- `get_default_true()`: Returns true if value is empty, "1", "true", "y", or "yes"
- `get_default_false()`: Returns false if value is empty, "0", "false", "n", or "no"
### Lists Boolean getters are flexible and interpret common truthy/falsy strings:
The module provides robust support for parsing and converting lists:
* `get_default_true(key string)`: Returns `true` if the value is empty, "1", "true", "y", or "yes". Otherwise, `false`.
* `get_default_false(key string)`: Returns `false` if the value is empty, "0", "false", "n", or "no". Otherwise, `true`.
```v ```v
// Basic list parsing is_enabled := parsed_params.get_default_true("enable_feature") // "enable_feature:yes" -> true
names := params.get_list("users")! // parses ["user1", "user2", "user3"] is_debug := parsed_params.get_default_false("debug_mode") // "debug_mode:0" -> false
// With default value
tags := params.get_list_default("tags", ["default"])!
// Lists with type conversion
numbers := params.get_list_int("ids")! // converts each item to int
amounts := params.get_list_f64("prices")! // converts each item to f64
// Name-fixed lists (normalizes each item)
clean_names := params.get_list_namefix("categories")!
``` ```
Supported list types: ### List Values
- `get_list()`: String list
- `get_list_u8()`, `get_list_u16()`, `get_list_u32()`, `get_list_u64()`: Unsigned integers
- `get_list_i8()`, `get_list_i16()`, `get_list_int()`, `get_list_i64()`: Signed integers
- `get_list_f32()`, `get_list_f64()`: Floating point numbers
Each list method has a corresponding `_default` version that accepts a default value. The module provides comprehensive support for parsing and converting lists of various types. Lists can be defined using square brackets `[]` or comma-separated values.
Valid list formats:
```v ```v
users: ["john", "jane", "bob"] // Example parameter string with lists
ids: 1,2,3,4,5 list_params := paramsparser.new("items:['apple', 'banana', 'orange'] ids:101,102,103 prices:[1.99, 2.50, 0.75]")!
names: ['John Doe', 'Jane Smith']
// Get a list of strings
fruits := list_params.get_list("items")! // Returns ["apple", "banana", "orange"]
// Get a list of integers
item_ids := list_params.get_list_int("ids")! // Returns [101, 102, 103]
// Get a list of floats
product_prices := list_params.get_list_f64("prices")! // Returns [1.99, 2.50, 0.75]
// Get a list with a default value if the key is not found
categories := list_params.get_list_default("categories", ["misc"])!
// Name-fixed lists (normalizes each item, e.g., "My Category" -> "my_category")
clean_tags := list_params.get_list_namefix("tags")!
``` ```
## Working with Arguments **Supported List Types:**
Arguments are values without keys: * `get_list()`: `[]string`
* `get_list_u8()`, `get_list_u16()`, `get_list_u32()`, `get_list_u64()`: Unsigned integer lists
* `get_list_i8()`, `get_list_i16()`, `get_list_int()`, `get_list_i64()`: Signed integer lists
* `get_list_f32()`, `get_list_f64()`: Floating-point lists
Each list method also has a `_default` version (e.g., `get_list_int_default`) for providing fallback values.
## Working with Positional Arguments
Arguments are values provided without a key.
```v ```v
// Parse text with arguments // Parse text with positional arguments
params := paramsparser.new("arg1 arg2 key:value")! arg_params := paramsparser.new("command_name --verbose file.txt")!
// Add an argument // Add a new argument
params.set_arg("arg3") arg_params.set_arg("another_arg")
// Check if argument exists // Check if an argument exists
if params.exists_arg("arg1") { if arg_params.exists_arg("file.txt") {
// do something println("File argument found!")
} }
// Get all arguments
all_args := arg_params.get_args() // Returns ["command_name", "--verbose", "file.txt", "another_arg"]
``` ```
## Additional Features ## Advanced Features
### Case-Insensitive Keys
Keys are treated as case-insensitive for retrieval, promoting flexibility.
1. Case insensitive keys:
```v ```v
params.set("Color", "red") params := paramsparser.new_params()
value := params.get("color")! // works params.set("FileName", "document.pdf")
value := params.get("filename")! // Successfully retrieves "document.pdf"
``` ```
2. Map conversion: ### Converting to Map
Easily convert the parsed parameters into a standard V map.
```v ```v
// Convert params to map params := paramsparser.new("key1:value1 key2:value2")!
map_values := params.get_map() map_representation := params.get_map()
println(map_representation["key1"]) // Output: value1
``` ```
3. Merging params: ### Merging Parameters
Combine two `Params` objects, with values from the merged object overriding existing keys.
```v ```v
mut params1 := paramsparser.new("color:red")! mut params1 := paramsparser.new("color:red size:small")!
params2 := paramsparser.new("size:large")! params2 := paramsparser.new("size:large material:wood")!
params1.merge(params2)! params1.merge(params2)!
// params1 now contains: color:red, size:large, material:wood
``` ```
4. Delete parameters: ### Deleting Parameters
Remove specific key-value pairs or positional arguments.
```v ```v
params.delete("color") // delete key-value pair params := paramsparser.new("item:book quantity:5 arg1 arg2")!
params.delete_arg("arg1") // delete argument params.delete("quantity") // Removes 'quantity:5'
params.delete_arg("arg1") // Removes 'arg1'
``` ```
## Error Handling ## Error Handling
Most methods return results that should be handled with V's error handling: Most `ParamsParser` methods that retrieve or convert values return `Result` types, requiring explicit error handling using V's `!` operator or `or {}` block.
```v ```v
// Using ! operator for methods that can fail // Using the '!' operator (panics on error)
name := params.get("name")! required_value := params.get("mandatory_key")!
// Or with or {} block for custom error handling // Using 'or {}' for graceful error handling
name := params.get("name") or { optional_value := params.get("optional_key") or {
println("Error: ${err}") eprintln("Warning: 'optional_key' not found or invalid: ${err}")
"default_name" "default_fallback_value"
} }
``` ```
## Parameter Validation ## Parameter Validation Rules
The parser enforces certain rules: The parser adheres to the following rules for input strings:
- Keys can only contain A-Z, a-z, 0-9, underscore, dot, and forward slash
- Values can contain any characters
- Spaces in values must be enclosed in quotes
- Lists are supported with comma separation
## Best Practices * **Keys:** Must consist of alphanumeric characters, underscores (`_`), dots (`.`), and forward slashes (`/`).
* **Values:** Can contain any characters.
* **Spaces in Values:** Must be enclosed within single (`'`) or double (`"`) quotes.
* **Lists:** Supported with comma separation or square bracket notation.
1. Always handle potential errors with `!` or `or {}` ## Best Practices for Usage
2. Use type-specific getters (`get_int`, `get_float`, etc.) when you know the expected type
3. Provide default values when appropriate using the `_default` methods
4. Use quotes for values containing spaces
5. Use lowercase keys for consistency (though the parser is case-insensitive)
# Params Details
```v
import freeflowuniverse.herolib.data.paramsparser
mut p:=paramsparser.new('
id:a1 name6:aaaaa
name:'need to do something 1'
)!
assert "a1"==p.get_default("id","")!
```
example text to parse
```yaml
id:a1 name6:aaaaa
name:'need to do something 1'
description:
## markdown works in it
description can be multiline
lets see what happens
- a
- something else
### subtitle
name2: test
name3: hi name10:'this is with space' name11:aaa11
#some comment
name4: 'aaa'
//somecomment
name5: 'aab'
```
results in
```go
Params{
params: [Param{
key: 'id'
value: 'a1'
}, Param{
key: 'name6'
value: 'aaaaa'
}, Param{
key: 'name'
value: 'need to do something 1'
}, Param{
key: 'description'
value: '## markdown works in it
description can be multiline
lets see what happens
- a
- something else
### subtitle
'
}, Param{
key: 'name2'
value: 'test'
}, Param{
key: 'name3'
value: 'hi'
}, Param{
key: 'name10'
value: 'this is with space'
}, Param{
key: 'name11'
value: 'aaa11'
}, Param{
key: 'name4'
value: 'aaa'
}, Param{
key: 'name5'
value: 'aab'
}]
}
```
1. **Always Handle Errors:** Use `!` or `or {}` to manage potential parsing or conversion failures.
2. **Use Type-Specific Getters:** Prefer `get_int()`, `get_float()`, etc., when you know the expected data type for clarity and safety.
3. **Provide Default Values:** Utilize `_default` methods (e.g., `get_default`, `get_list_default`) to ensure your application behaves predictably when parameters are missing.
4. **Quote Values with Spaces:** Always enclose values containing spaces or special characters in quotes to ensure correct parsing.
5. **Consistent Key Naming:** While case-insensitive, using a consistent naming convention (e.g., `snake_case` or `camelCase`) for keys improves human readability and maintainability.

View File

@@ -1,7 +1,7 @@
module gittools module gittools
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import os import os
// GitRepo holds information about a single Git repository. // GitRepo holds information about a single Git repository.

View File

@@ -1,6 +1,6 @@
module gittools module gittools
import freeflowuniverse.herolib.osal.sshagent import freeflowuniverse.herolib.osal.core as osal.sshagent
import freeflowuniverse.herolib.core.pathlib import freeflowuniverse.herolib.core.pathlib
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.develop.vscode import freeflowuniverse.herolib.develop.vscode

View File

@@ -1,7 +1,7 @@
module tests module tests
import freeflowuniverse.herolib.develop.gittools import freeflowuniverse.herolib.develop.gittools
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import os import os
import time import time

View File

@@ -1,6 +1,6 @@
module tests module tests
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import os import os
import time import time

View File

@@ -1,6 +1,6 @@
module sourcetree module sourcetree
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import os import os
// import freeflowuniverse.herolib.ui.console // import freeflowuniverse.herolib.ui.console

View File

@@ -1,6 +1,6 @@
module vscode module vscode
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import os import os
pub struct VSCodeHelper { pub struct VSCodeHelper {

View File

@@ -2,7 +2,7 @@ module bootstrap
import os import os
import time import time
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.core.pathlib import freeflowuniverse.herolib.core.pathlib
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console

View File

@@ -2,7 +2,7 @@ module publishing
import os import os
import freeflowuniverse.herolib.core.pathlib { Path } import freeflowuniverse.herolib.core.pathlib { Path }
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.data.doctree { Tree } import freeflowuniverse.herolib.data.doctree { Tree }
import freeflowuniverse.herolib.web.mdbook import freeflowuniverse.herolib.web.mdbook

View File

@@ -1,6 +1,6 @@
module base module base
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.core import freeflowuniverse.herolib.core
import os import os

View File

@@ -1,9 +1,9 @@
module base module base
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.core.pathlib import freeflowuniverse.herolib.core.pathlib
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.osal.startupmanager import freeflowuniverse.herolib.osal.core as osal.startupmanager
import freeflowuniverse.herolib.core import freeflowuniverse.herolib.core
import time import time
import os import os

View File

@@ -1,11 +1,11 @@
module cometbft module cometbft
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.core.texttools import freeflowuniverse.herolib.core.texttools
import freeflowuniverse.herolib.core.pathlib import freeflowuniverse.herolib.core.pathlib
import freeflowuniverse.herolib.osal.systemd import freeflowuniverse.herolib.osal.core as osal.systemd
import freeflowuniverse.herolib.osal.zinit import freeflowuniverse.herolib.osal.core as osal.zinit
import freeflowuniverse.herolib.installers.ulist import freeflowuniverse.herolib.installers.ulist
import freeflowuniverse.herolib.installers.lang.golang import freeflowuniverse.herolib.installers.lang.golang
import freeflowuniverse.herolib.installers.lang.rust import freeflowuniverse.herolib.installers.lang.rust

View File

@@ -3,8 +3,8 @@ module cometbft
import freeflowuniverse.herolib.core.base import freeflowuniverse.herolib.core.base
import freeflowuniverse.herolib.core.playbook import freeflowuniverse.herolib.core.playbook
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.osal.startupmanager import freeflowuniverse.herolib.osal.core as osal.startupmanager
import freeflowuniverse.herolib.osal.zinit import freeflowuniverse.herolib.osal.core as osal.zinit
import time import time
__global ( __global (

View File

@@ -1,8 +1,8 @@
module meilisearch_installer module meilisearch_installer
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.osal.zinit import freeflowuniverse.herolib.osal.core as osal.zinit
import freeflowuniverse.herolib.installers.ulist import freeflowuniverse.herolib.installers.ulist
import freeflowuniverse.herolib.core.httpconnection import freeflowuniverse.herolib.core.httpconnection
import freeflowuniverse.herolib.core.texttools import freeflowuniverse.herolib.core.texttools

View File

@@ -3,8 +3,8 @@ module meilisearch_installer
import freeflowuniverse.herolib.core.base import freeflowuniverse.herolib.core.base
import freeflowuniverse.herolib.core.playbook import freeflowuniverse.herolib.core.playbook
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.osal.startupmanager import freeflowuniverse.herolib.osal.core as osal.startupmanager
import freeflowuniverse.herolib.osal.zinit import freeflowuniverse.herolib.osal.core as osal.zinit
import time import time
__global ( __global (

View File

@@ -1,9 +1,9 @@
module postgresql module postgresql
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.installers.virt.podman as podman_installer import freeflowuniverse.herolib.installers.virt.podman as podman_installer
import freeflowuniverse.herolib.osal.zinit import freeflowuniverse.herolib.osal.core as osal.zinit
import freeflowuniverse.herolib.installers.ulist import freeflowuniverse.herolib.installers.ulist
import os import os

View File

@@ -3,8 +3,8 @@ module postgresql
import freeflowuniverse.herolib.core.base import freeflowuniverse.herolib.core.base
import freeflowuniverse.herolib.core.playbook import freeflowuniverse.herolib.core.playbook
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.osal.startupmanager import freeflowuniverse.herolib.osal.core as osal.startupmanager
import freeflowuniverse.herolib.osal.zinit import freeflowuniverse.herolib.osal.core as osal.zinit
import time import time
__global ( __global (

View File

@@ -1,7 +1,7 @@
module qdrant_installer module qdrant_installer
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.osal.zinit import freeflowuniverse.herolib.osal.core as osal.zinit
import freeflowuniverse.herolib.installers.ulist import freeflowuniverse.herolib.installers.ulist
import os import os

View File

@@ -3,8 +3,8 @@ module qdrant_installer
import freeflowuniverse.herolib.core.base import freeflowuniverse.herolib.core.base
import freeflowuniverse.herolib.core.playbook import freeflowuniverse.herolib.core.playbook
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.osal.startupmanager import freeflowuniverse.herolib.osal.core as osal.startupmanager
import freeflowuniverse.herolib.osal.zinit import freeflowuniverse.herolib.osal.core as osal.zinit
import time import time
__global ( __global (

View File

@@ -1,9 +1,9 @@
module zerodb module zerodb
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.core import freeflowuniverse.herolib.core
import freeflowuniverse.herolib.osal.zinit import freeflowuniverse.herolib.osal.core as osal.zinit
import freeflowuniverse.herolib.installers.ulist import freeflowuniverse.herolib.installers.ulist
import freeflowuniverse.herolib.develop.gittools import freeflowuniverse.herolib.develop.gittools
import freeflowuniverse.herolib.installers.base import freeflowuniverse.herolib.installers.base

View File

@@ -3,8 +3,8 @@ module zerodb
import freeflowuniverse.herolib.core.base import freeflowuniverse.herolib.core.base
import freeflowuniverse.herolib.core.playbook import freeflowuniverse.herolib.core.playbook
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.osal.startupmanager import freeflowuniverse.herolib.osal.core as osal.startupmanager
import freeflowuniverse.herolib.osal.zinit import freeflowuniverse.herolib.osal.core as osal.zinit
import time import time
__global ( __global (

View File

@@ -1,6 +1,6 @@
module rfs module rfs
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.installers.lang.rust import freeflowuniverse.herolib.installers.lang.rust
import freeflowuniverse.herolib.develop.gittools import freeflowuniverse.herolib.develop.gittools
import freeflowuniverse.herolib.installers.zinit import freeflowuniverse.herolib.installers.zinit

View File

@@ -1,11 +1,11 @@
module zerofs module zerofs
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.core.texttools import freeflowuniverse.herolib.core.texttools
import freeflowuniverse.herolib.core.pathlib import freeflowuniverse.herolib.core.pathlib
import freeflowuniverse.herolib.osal.systemd import freeflowuniverse.herolib.osal.core as osal.systemd
import freeflowuniverse.herolib.osal.zinit import freeflowuniverse.herolib.osal.core as osal.zinit
import freeflowuniverse.herolib.installers.ulist import freeflowuniverse.herolib.installers.ulist
import freeflowuniverse.herolib.installers.lang.golang import freeflowuniverse.herolib.installers.lang.golang
import freeflowuniverse.herolib.installers.lang.rust import freeflowuniverse.herolib.installers.lang.rust

View File

@@ -2,8 +2,8 @@ module zerofs
import freeflowuniverse.herolib.core.playbook import freeflowuniverse.herolib.core.playbook
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.osal.startupmanager import freeflowuniverse.herolib.osal.core as osal.startupmanager
import freeflowuniverse.herolib.osal.zinit import freeflowuniverse.herolib.osal.core as osal.zinit
import time import time
__global ( __global (

View File

@@ -1,6 +1,6 @@
module chrome module chrome
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.core import freeflowuniverse.herolib.core
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import os import os

View File

@@ -1,6 +1,6 @@
module vscode module vscode
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.core import freeflowuniverse.herolib.core
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import os import os

View File

@@ -1,12 +1,12 @@
module coredns module coredns
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.core.texttools import freeflowuniverse.herolib.core.texttools
import freeflowuniverse.herolib.core.pathlib import freeflowuniverse.herolib.core.pathlib
import freeflowuniverse.herolib.core import freeflowuniverse.herolib.core
import freeflowuniverse.herolib.develop.gittools import freeflowuniverse.herolib.develop.gittools
import freeflowuniverse.herolib.osal.zinit import freeflowuniverse.herolib.osal.core as osal.zinit
import freeflowuniverse.herolib.installers.ulist import freeflowuniverse.herolib.installers.ulist
import freeflowuniverse.herolib.core.httpconnection import freeflowuniverse.herolib.core.httpconnection
import freeflowuniverse.herolib.installers.lang.golang import freeflowuniverse.herolib.installers.lang.golang

View File

@@ -1,7 +1,7 @@
module coredns module coredns
import freeflowuniverse.herolib.core.pathlib import freeflowuniverse.herolib.core.pathlib
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.develop.gittools import freeflowuniverse.herolib.develop.gittools
import os import os

View File

@@ -3,8 +3,8 @@ module coredns
import freeflowuniverse.herolib.core.base import freeflowuniverse.herolib.core.base
import freeflowuniverse.herolib.core.playbook import freeflowuniverse.herolib.core.playbook
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.osal.startupmanager import freeflowuniverse.herolib.osal.core as osal.startupmanager
import freeflowuniverse.herolib.osal.zinit import freeflowuniverse.herolib.osal.core as osal.zinit
import time import time
__global ( __global (

View File

@@ -1,11 +1,11 @@
module dify module dify
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.core.texttools import freeflowuniverse.herolib.core.texttools
import freeflowuniverse.herolib.core.pathlib import freeflowuniverse.herolib.core.pathlib
import freeflowuniverse.herolib.osal.systemd import freeflowuniverse.herolib.osal.core as osal.systemd
import freeflowuniverse.herolib.osal.zinit import freeflowuniverse.herolib.osal.core as osal.zinit
import freeflowuniverse.herolib.installers.ulist import freeflowuniverse.herolib.installers.ulist
import freeflowuniverse.herolib.installers.lang.golang import freeflowuniverse.herolib.installers.lang.golang
import freeflowuniverse.herolib.installers.lang.rust import freeflowuniverse.herolib.installers.lang.rust

View File

@@ -3,8 +3,8 @@ module dify
import freeflowuniverse.herolib.core.base import freeflowuniverse.herolib.core.base
import freeflowuniverse.herolib.core.playbook import freeflowuniverse.herolib.core.playbook
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.osal.startupmanager import freeflowuniverse.herolib.osal.core as osal.startupmanager
import freeflowuniverse.herolib.osal.zinit import freeflowuniverse.herolib.osal.core as osal.zinit
import time import time
__global ( __global (

View File

@@ -1,11 +1,11 @@
module gitea module gitea
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.core import freeflowuniverse.herolib.core
import freeflowuniverse.herolib.core.texttools import freeflowuniverse.herolib.core.texttools
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.installers.ulist import freeflowuniverse.herolib.installers.ulist
import freeflowuniverse.herolib.osal.zinit import freeflowuniverse.herolib.osal.core as osal.zinit
import os import os
fn installed() !bool { fn installed() !bool {

View File

@@ -3,8 +3,8 @@ module gitea
import freeflowuniverse.herolib.core.base import freeflowuniverse.herolib.core.base
import freeflowuniverse.herolib.core.playbook import freeflowuniverse.herolib.core.playbook
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.osal.startupmanager import freeflowuniverse.herolib.osal.core as osal.startupmanager
import freeflowuniverse.herolib.osal.zinit import freeflowuniverse.herolib.osal.core as osal.zinit
import time import time
__global ( __global (

View File

@@ -4,7 +4,7 @@ import freeflowuniverse.herolib.data.paramsparser
import freeflowuniverse.herolib.data.encoderhero import freeflowuniverse.herolib.data.encoderhero
import freeflowuniverse.herolib.core.pathlib import freeflowuniverse.herolib.core.pathlib
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import os import os
import freeflowuniverse.herolib.clients.mailclient import freeflowuniverse.herolib.clients.mailclient
import freeflowuniverse.herolib.clients.postgresql_client import freeflowuniverse.herolib.clients.postgresql_client

View File

@@ -1,7 +1,7 @@
module livekit module livekit
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.osal.zinit import freeflowuniverse.herolib.osal.core as osal.zinit
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.core.texttools import freeflowuniverse.herolib.core.texttools
import freeflowuniverse.herolib.installers.ulist import freeflowuniverse.herolib.installers.ulist

View File

@@ -3,8 +3,8 @@ module livekit
import freeflowuniverse.herolib.core.base import freeflowuniverse.herolib.core.base
import freeflowuniverse.herolib.core.playbook import freeflowuniverse.herolib.core.playbook
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.osal.startupmanager import freeflowuniverse.herolib.osal.core as osal.startupmanager
import freeflowuniverse.herolib.osal.zinit import freeflowuniverse.herolib.osal.core as osal.zinit
import time import time
__global ( __global (

View File

@@ -2,8 +2,8 @@ module screen
import freeflowuniverse.herolib.core.playbook import freeflowuniverse.herolib.core.playbook
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.osal.startupmanager import freeflowuniverse.herolib.osal.core as osal.startupmanager
import freeflowuniverse.herolib.osal.zinit import freeflowuniverse.herolib.osal.core as osal.zinit
__global ( __global (
screen_global map[string]&Screen screen_global map[string]&Screen

View File

@@ -1,12 +1,12 @@
module zinit_installer module zinit_installer
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.core.texttools import freeflowuniverse.herolib.core.texttools
import freeflowuniverse.herolib.develop.gittools import freeflowuniverse.herolib.develop.gittools
import freeflowuniverse.herolib.core import freeflowuniverse.herolib.core
import freeflowuniverse.herolib.osal.systemd import freeflowuniverse.herolib.osal.core as osal.systemd
import freeflowuniverse.herolib.osal.zinit as zinit_module import freeflowuniverse.herolib.osal.core as osal.zinit as zinit_module
import freeflowuniverse.herolib.installers.ulist import freeflowuniverse.herolib.installers.ulist
import os import os

View File

@@ -2,8 +2,8 @@ module zinit_installer
import freeflowuniverse.herolib.core.playbook import freeflowuniverse.herolib.core.playbook
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.osal.startupmanager import freeflowuniverse.herolib.osal.core as osal.startupmanager
import freeflowuniverse.herolib.osal.zinit import freeflowuniverse.herolib.osal.core as osal.zinit
import time import time
__global ( __global (

View File

@@ -1,6 +1,6 @@
module golang module golang
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.core import freeflowuniverse.herolib.core
import freeflowuniverse.herolib.installers.base import freeflowuniverse.herolib.installers.base

View File

@@ -2,8 +2,8 @@ module golang
import freeflowuniverse.herolib.core.playbook import freeflowuniverse.herolib.core.playbook
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.osal.startupmanager import freeflowuniverse.herolib.osal.core as osal.startupmanager
import freeflowuniverse.herolib.osal.zinit import freeflowuniverse.herolib.osal.core as osal.zinit
__global ( __global (
golang_global map[string]&GolangInstaller golang_global map[string]&GolangInstaller

View File

@@ -1,6 +1,6 @@
module herolib module herolib
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.installers.base import freeflowuniverse.herolib.installers.base
import freeflowuniverse.herolib.installers.lang.vlang import freeflowuniverse.herolib.installers.lang.vlang

View File

@@ -2,8 +2,8 @@ module nodejs
import freeflowuniverse.herolib.core.playbook import freeflowuniverse.herolib.core.playbook
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.osal.startupmanager import freeflowuniverse.herolib.osal.core as osal.startupmanager
import freeflowuniverse.herolib.osal.zinit import freeflowuniverse.herolib.osal.core as osal.zinit
__global ( __global (
nodejs_global map[string]&NodeJS nodejs_global map[string]&NodeJS

View File

@@ -1,6 +1,6 @@
module python module python
import freeflowuniverse.herolib.osal import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.core import freeflowuniverse.herolib.core
import freeflowuniverse.herolib.installers.base import freeflowuniverse.herolib.installers.base

View File

@@ -2,8 +2,8 @@ module python
import freeflowuniverse.herolib.core.playbook import freeflowuniverse.herolib.core.playbook
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.osal.startupmanager import freeflowuniverse.herolib.osal.core as osal.startupmanager
import freeflowuniverse.herolib.osal.zinit import freeflowuniverse.herolib.osal.core as osal.zinit
__global ( __global (
python_global map[string]&Python python_global map[string]&Python

Some files were not shown because too many files have changed in this diff Show More