This commit is contained in:
2025-07-30 17:43:39 +02:00
parent bc163eb61d
commit 1cb6c486df
6 changed files with 17 additions and 21 deletions

View File

@@ -1,6 +1,6 @@
module herocmds
import freeflowuniverse.herolib.web.mdbook
// import freeflowuniverse.herolib.web.mdbook
import freeflowuniverse.herolib.core.pathlib
import cli { Command, Flag }
import os
@@ -88,7 +88,7 @@ fn cmd_mdbook_execute(cmd Command) ! {
mut plbook, _ := plbook_run(cmd)!
// get name from the book.generate action
if name == '' {
mut a := plbook.action_get(actor: 'book', name: 'define')!
mut a := plbook.get(filter: 'book.define')!
name = a.params.get('name') or { '' }
}
} else {
@@ -104,11 +104,11 @@ fn cmd_mdbook_execute(cmd Command) ! {
edit := cmd.flags.get_bool('edit') or { false }
open := cmd.flags.get_bool('open') or { false }
if edit || open {
mdbook.book_open(name)!
// mdbook.book_open(name)!
}
if edit {
mdbook.book_edit(name)!
// mdbook.book_edit(name)!
}
}

View File

@@ -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.action_get(id: id)!
mut a := plbook.actions[id-1] or { panic("bug in actions sorted") }
res << a
}
}
@@ -168,16 +168,12 @@ pub fn (mut plbook PlayBook) names() ![]string {
// }
// }
// @[deprecated: "Use plbook.get(filter: 'actor.name') or plbook.get(id: id) instead."]
// pub fn (mut plbook PlayBook) action_get(args ActionGetArgs) !&Action {
// // Use actions_find to get the filtered actions
// actions := plbook.actions_find(args)!
// if actions.len == 1 {
// return actions[0]
// } else if actions.len == 0 {
// return error("couldn't find action with args: ${args}")
// } else {
// return error('multiple actions found with args: ${args}, expected only one')
// if args.id != 0 {
// return plbook.actions[args.id-1] or { panic("bug in action get") }
// }
// return plbook.get(filter: '${args.actor}.${args.name}')!
// }
pub fn (plbook PlayBook) hashkey() string {

View File

@@ -10,7 +10,7 @@ fn play(mut plbook PlayBook) ! {
mut ds := docusaurus.new()!
mut action0 := plbook.action_get(actor: 'docusaurus', name: 'define')!
mut action0 := plbook.get(filter: 'docusaurus.define')!
mut p0 := action0.params
path_publish := p0.get_default('path_publish', '')!

View File

@@ -8,7 +8,7 @@ import os
pub fn play(mut plbook playbook.PlayBook) ! {
// first lets configure are publisher
if mut action := plbook.action_get(actor: 'publisher', name: 'configure') {
if mut action := plbook.get(filter: 'publisher.configure') {
play_configure(mut action)!
}

View File

@@ -61,7 +61,7 @@ pub fn play(mut plbook PlayBook)! {
}
fn play_config(mut plbook PlayBook, mut config SiteConfig) ! {
mut action := plbook.action_get(actor: 'site', name: 'config')!
mut action := plbook.get(filter: 'site.config')!
mut context := base.context()!
@@ -89,7 +89,7 @@ fn play_config(mut plbook PlayBook, mut config SiteConfig) ! {
config.url_home = p.get_default('url_home', '')!
// Process !!site.config_meta for specific metadata overrides
mut meta_action := plbook.action_get(actor: 'site', name: 'config_meta')!
mut meta_action := plbook.get(filter: 'site.config_meta')!
mut p_meta := meta_action.params
// If 'title' is present in site.config_meta, it overrides. Otherwise, meta_title remains empty or uses site.config.title logic in docusaurus model.

View File

@@ -8,13 +8,13 @@ import os
pub fn play(mut plbook PlayBook) ! {
defaultdest = '${os.home_dir()}/hero/var/sitegen'
defaultdest := '${os.home_dir()}/hero/var/sitegen'
//if only 1 doctree is specified, then we use that as the default doctree name
mut doctreename := 'main'
if plbook.exists(filter: 'site.doctree') {
if plbook.exists_once(filter: 'site.doctree') {
mut action := plbook.action_get(actor: 'site', name: 'doctree')!
mut action := plbook.get(filter: 'site.doctree')!
mut p := action.params
doctreename = p.get('name') or { return error('need to specify name in site.doctree') }
} else {
@@ -36,7 +36,7 @@ pub fn play(mut plbook PlayBook) ! {
for action in category_actions {
// println(action)
mut p := action.params
sitename := p.get_default('sitename', args.sitename)!
sitename := p.get_default('sitename', '')!
section.position = p.get_int_default('position', 20)!
section.label = p.get('label') or {
return error('need to specify label in site.page_category')
@@ -59,7 +59,7 @@ pub fn play(mut plbook PlayBook) ! {
for action in page_actions {
// println(action)
mut p := action.params
sitename := p.get_default('sitename', args.sitename)!
sitename := p.get_default('sitename', '')!
pathnew := p.get_default('path', '')!
if pathnew != '' {
mypage.path = path