fix mailclient compilation

This commit is contained in:
timurgordon
2025-01-22 23:56:13 +00:00
parent b3509611a2
commit 915951d84f
2 changed files with 16 additions and 19 deletions

View File

@@ -1,6 +1,6 @@
module mailclient module mailclient
// import freeflowuniverse.herolib.core.base import freeflowuniverse.herolib.core.base
// import freeflowuniverse.herolib.core.playbook // import freeflowuniverse.herolib.core.playbook
// __global ( // __global (
@@ -45,11 +45,11 @@ module mailclient
// mailclient_default = name // mailclient_default = name
// } // }
// fn config_exists(args_ ArgsGet) bool { fn config_exists(args_ ArgsGet) bool {
// mut args := args_get(args_) mut args := args_get(args_)
// mut context := base.context() or { panic('bug') } mut context := base.context() or { panic('bug') }
// return context.hero_config_exists('mailclient', args.name) return context.hero_config_exists('mailclient', args.name)
// } }
// fn config_load(args_ ArgsGet) ! { // fn config_load(args_ ArgsGet) ! {
// mut args := args_get(args_) // mut args := args_get(args_)

View File

@@ -36,7 +36,7 @@ pub fn get(args_ ArgsGet) !&MailClient {
if !config_exists(args) { if !config_exists(args) {
if default { if default {
mut context := base.context() or { panic('bug') } mut context := base.context() or { panic('bug') }
context.hero_config_set('mailclient', model.name, heroscript_default()!)! context.hero_config_set('mailclient', args.name, heroscript_default())!
} }
} }
load(args)! load(args)!
@@ -44,7 +44,7 @@ pub fn get(args_ ArgsGet) !&MailClient {
} }
return mailclient_global[args.name] or { return mailclient_global[args.name] or {
println(mailclient_global) println(mailclient_global)
panic('could not get config for ${args.name} with name:${model.name}') panic('could not get config for ${args.name} with name:${args.name}')
} }
} }
@@ -70,12 +70,12 @@ pub fn load(args_ ArgsGet) ! {
play(heroscript: heroscript)! play(heroscript: heroscript)!
} }
// save the config to the filesystem in the context // // save the config to the filesystem in the context
pub fn save(o MailClient) ! { // pub fn save(o MailClient) ! {
mut context := base.context()! // mut context := base.context()!
heroscript := encoderhero.encode[MailClient](o)! // heroscript := encoderhero.encode[MailClient](o)!
context.hero_config_set('mailclient', model.name, heroscript)! // context.hero_config_set('mailclient', model.name, heroscript)!
} // }
@[params] @[params]
pub struct PlayArgs { pub struct PlayArgs {
@@ -89,7 +89,7 @@ pub fn play(args_ PlayArgs) ! {
mut model := args_ mut model := args_
if model.heroscript == '' { if model.heroscript == '' {
model.heroscript = heroscript_default()! model.heroscript = heroscript_default()
} }
mut plbook := model.plbook or { playbook.new(text: model.heroscript)! } mut plbook := model.plbook or { playbook.new(text: model.heroscript)! }
@@ -97,10 +97,7 @@ pub fn play(args_ PlayArgs) ! {
if configure_actions.len > 0 { if configure_actions.len > 0 {
for config_action in configure_actions { for config_action in configure_actions {
mut p := config_action.params mut p := config_action.params
mycfg := cfg_play(p)! cfg_play(p)!
console.print_debug('install action mailclient.configure\n${mycfg}')
set(mycfg)!
save(mycfg)!
} }
} }
} }