Merge branch 'development_fix_hero_and_ci' of https://github.com/freeflowuniverse/herolib into development_fix_hero_and_ci

This commit is contained in:
Mahmoud-Emad
2025-08-07 10:54:42 +03:00
4 changed files with 25 additions and 19 deletions

View File

@@ -97,6 +97,27 @@ pub fn (mut plbook PlayBook) exists_once(args FindArgs) bool {
return res.len == 1
}
//checks it exists once, if more than one it returns error
pub fn (mut plbook PlayBook) max_once(args FindArgs) !bool {
mut res := plbook.find(args) or { [] }
if res.len > 1 {
return error("found more than one action: '${args.filter}'")
}
return res.len == 1
}
//will give error on what is not done yet
pub fn (mut plbook PlayBook) ensure_processed(args FindArgs) ! {
mut res := plbook.find(args) or { [] }
for item in res {
if !item.done {
return error("action not done: '${item.actor}.${item.name}'")
}
}
}
pub fn (mut plbook PlayBook) exists(args FindArgs) bool {
mut res := plbook.find(args) or { [] }
return res.len > 0