...
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
# heroscript
|
||||
|
||||
is our small language which allows us to run parser
|
||||
|
||||
Our heroscript is a simple way to execute commands in a playbook. It allows you to define a series of actions that can be executed in sequence, making it easy to automate tasks and workflows.
|
||||
|
||||
## execute a playbook
|
||||
|
||||
@@ -25,7 +24,6 @@ playcmds.run(mut plbook)!
|
||||
|
||||
|
||||
```
|
||||
|
||||
## execute a heroscript and make executable
|
||||
|
||||
```bash
|
||||
@@ -39,54 +37,8 @@ playcmds.run(mut plbook)!
|
||||
you can now just execute this script and hero will interprete the content
|
||||
|
||||
|
||||
## parser
|
||||
|
||||
are text based representatsions of parser which need to be executed
|
||||
|
||||
example
|
||||
|
||||
```js
|
||||
!!tflibrary.circlesmanager.circle_add
|
||||
gitsource:'books'
|
||||
path:'technology/src'
|
||||
name:technology
|
||||
```
|
||||
|
||||
the first one is the action, the rest are the params
|
||||
|
||||
```v
|
||||
import freeflowuniverse.herolib.core.playbook
|
||||
|
||||
mut plbook := playbook.new(text: "....")!
|
||||
|
||||
```
|
||||
## way how to use for a module
|
||||
|
||||
|
||||
```v
|
||||
import freeflowuniverse.herolib.core.playbook
|
||||
|
||||
// !!hr.employee_define
|
||||
// descr:'Junior Engineer'
|
||||
// growth:'1:5,60:30' cost:'4000USD' indexation:'5%'
|
||||
// department:'engineering'
|
||||
|
||||
|
||||
// populate the params for hr
|
||||
fn (mut m BizModel) hr_actions(actions playbook.PlayBook) ! {
|
||||
mut actions2 := actions.find('hr.*,vm.start')!
|
||||
for action in actions2 {
|
||||
if action.name == 'employee_define' {
|
||||
mut name := action.params.get_default('name', '')!
|
||||
mut descr := action.params.get_default('descr', '')!
|
||||
//...
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## we can also use the filtersort
|
||||
## filtersort
|
||||
|
||||
```v
|
||||
|
||||
|
||||
Reference in New Issue
Block a user