...
This commit is contained in:
@@ -92,7 +92,6 @@ pub fn (mut plbook PlayBook) find(args FindArgs) ![]&Action {
|
||||
return res
|
||||
}
|
||||
|
||||
|
||||
pub fn (mut plbook PlayBook) exists_once(args FindArgs) bool {
|
||||
mut res := plbook.find(args) or { [] }
|
||||
return res.len == 1
|
||||
|
||||
@@ -73,7 +73,7 @@ pub fn (mut plbook PlayBook) actions_sorted(args SortArgs) ![]&Action {
|
||||
}
|
||||
action_ids := plbook.priorities[nr] or { panic('bug') }
|
||||
for id in action_ids {
|
||||
mut a := plbook.actions[id-1] or { panic("bug in actions sorted") }
|
||||
mut a := plbook.actions[id - 1] or { panic('bug in actions sorted') }
|
||||
res << a
|
||||
}
|
||||
}
|
||||
@@ -99,7 +99,7 @@ pub fn (mut plbook PlayBook) heroscript(args HeroScriptArgs) !string {
|
||||
// out += '${plbook.othertext}'
|
||||
// }
|
||||
out = texttools.remove_empty_js_blocks(out)
|
||||
out +="\n\n"
|
||||
out += '\n\n'
|
||||
return out
|
||||
}
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@ pub fn (mut plbook PlayBook) add(args_ PlayBookNewArgs) ! {
|
||||
|
||||
if args.git_url.len > 0 {
|
||||
mut git_path_args := gittools.GitPathGetArgs{
|
||||
git_url: args.git_url
|
||||
git_pull: args.git_pull
|
||||
git_url: args.git_url
|
||||
git_pull: args.git_pull
|
||||
git_reset: args.git_reset
|
||||
}
|
||||
args.path = gittools.path(git_path_args)!.path
|
||||
|
||||
@@ -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