diff --git a/lib/develop/reprompt/.heroscript b/lib/develop/heroprompt/.heroscript similarity index 51% rename from lib/develop/reprompt/.heroscript rename to lib/develop/heroprompt/.heroscript index d1c37d8b..312e07b9 100644 --- a/lib/develop/reprompt/.heroscript +++ b/lib/develop/heroprompt/.heroscript @@ -1,7 +1,7 @@ !!hero_code.generate_client - name:'reprompt' - classname:'RepromptWorkspace' + name:'heroprompt' + classname:'HeropromptWorkspace' singleton:0 default:1 hasconfig:1 diff --git a/lib/develop/reprompt/readme.md b/lib/develop/heroprompt/readme.md similarity index 54% rename from lib/develop/reprompt/readme.md rename to lib/develop/heroprompt/readme.md index 9e4d3817..8a7d70aa 100644 --- a/lib/develop/reprompt/readme.md +++ b/lib/develop/heroprompt/readme.md @@ -1,4 +1,4 @@ -# reprompt +# heroprompt @@ -7,9 +7,9 @@ To get started ```vlang -import freeflowuniverse.herolib.clients. reprompt +import freeflowuniverse.herolib.clients. heroprompt -mut client:= reprompt.get()! +mut client:= heroprompt.get()! client... @@ -21,7 +21,7 @@ client... ## example heroscript ```hero -!!reprompt.configure +!!heroprompt.configure secret: '...' host: 'localhost' port: 8888 diff --git a/lib/develop/reprompt/reprompt_do.v b/lib/develop/heroprompt/reprompt_do.v similarity index 78% rename from lib/develop/reprompt/reprompt_do.v rename to lib/develop/heroprompt/reprompt_do.v index 7968488b..323c058d 100644 --- a/lib/develop/reprompt/reprompt_do.v +++ b/lib/develop/heroprompt/reprompt_do.v @@ -1,4 +1,4 @@ -module reprompt +module heroprompt import freeflowuniverse.herolib.data.paramsparser import freeflowuniverse.herolib.data.encoderhero @@ -6,7 +6,7 @@ import freeflowuniverse.herolib.core.pathlib import os // your checking & initialization code if needed -fn (mut ws RepromptWorkspace) reprompt() !string { +fn (mut ws HeropromptWorkspace) heroprompt() !string { // TODO: fill in template based on selection return '' } diff --git a/lib/develop/reprompt/reprompt_factory_.v b/lib/develop/heroprompt/reprompt_factory_.v similarity index 58% rename from lib/develop/reprompt/reprompt_factory_.v rename to lib/develop/heroprompt/reprompt_factory_.v index 82dd36ec..2df23ef1 100644 --- a/lib/develop/reprompt/reprompt_factory_.v +++ b/lib/develop/heroprompt/reprompt_factory_.v @@ -1,12 +1,12 @@ -module reprompt +module heroprompt import freeflowuniverse.herolib.core.base import freeflowuniverse.herolib.core.playbook { PlayBook } import freeflowuniverse.herolib.ui.console __global ( - reprompt_global map[string]&RepromptWorkspace - reprompt_default string + heroprompt_global map[string]&HeropromptWorkspace + heroprompt_default string ) /////////FACTORY @@ -25,61 +25,61 @@ fn args_get(args_ ArgsGet) ArgsGet { return args } -pub fn get(args_ ArgsGet) !&RepromptWorkspace { +pub fn get(args_ ArgsGet) !&HeropromptWorkspace { mut context := base.context()! mut args := args_get(args_) - mut obj := RepromptWorkspace{ + mut obj := HeropromptWorkspace{ name: args.name } - if args.name !in reprompt_global { + if args.name !in heroprompt_global { if !exists(args)! { set(obj)! } else { - heroscript := context.hero_config_get('reprompt', args.name)! + heroscript := context.hero_config_get('heroprompt', args.name)! mut obj_ := heroscript_loads(heroscript)! set_in_mem(obj_)! } } - return reprompt_global[args.name] or { - println(reprompt_global) + return heroprompt_global[args.name] or { + println(heroprompt_global) // bug if we get here because should be in globals - panic('could not get config for reprompt with name, is bug:${args.name}') + panic('could not get config for heroprompt with name, is bug:${args.name}') } } // register the config for the future -pub fn set(o RepromptWorkspace) ! { +pub fn set(o HeropromptWorkspace) ! { set_in_mem(o)! mut context := base.context()! heroscript := heroscript_dumps(o)! - context.hero_config_set('reprompt', o.name, heroscript)! + context.hero_config_set('heroprompt', o.name, heroscript)! } // does the config exists? pub fn exists(args_ ArgsGet) !bool { mut context := base.context()! mut args := args_get(args_) - return context.hero_config_exists('reprompt', args.name) + return context.hero_config_exists('heroprompt', args.name) } pub fn delete(args_ ArgsGet) ! { mut args := args_get(args_) mut context := base.context()! - context.hero_config_delete('reprompt', args.name)! - if args.name in reprompt_global { - // del reprompt_global[args.name] + context.hero_config_delete('heroprompt', args.name)! + if args.name in heroprompt_global { + // del heroprompt_global[args.name] } } // only sets in mem, does not set as config -fn set_in_mem(o RepromptWorkspace) ! { +fn set_in_mem(o HeropromptWorkspace) ! { mut o2 := obj_init(o)! - reprompt_global[o.name] = &o2 - reprompt_default = o.name + heroprompt_global[o.name] = &o2 + heroprompt_default = o.name } pub fn play(mut plbook PlayBook) ! { - mut install_actions := plbook.find(filter: 'reprompt.configure')! + mut install_actions := plbook.find(filter: 'heroprompt.configure')! if install_actions.len > 0 { for install_action in install_actions { heroscript := install_action.heroscript() @@ -89,9 +89,9 @@ pub fn play(mut plbook PlayBook) ! { } } -// switch instance to be used for reprompt +// switch instance to be used for heroprompt pub fn switch(name string) { - reprompt_default = name + heroprompt_default = name } // helpers diff --git a/lib/develop/reprompt/reprompt_model.v b/lib/develop/heroprompt/reprompt_model.v similarity index 61% rename from lib/develop/reprompt/reprompt_model.v rename to lib/develop/heroprompt/reprompt_model.v index 90a39a4e..8556a2b3 100644 --- a/lib/develop/reprompt/reprompt_model.v +++ b/lib/develop/heroprompt/reprompt_model.v @@ -1,4 +1,4 @@ -module reprompt +module heroprompt import freeflowuniverse.herolib.data.paramsparser import freeflowuniverse.herolib.data.encoderhero @@ -12,20 +12,20 @@ const default = true // THIS THE THE SOURCE OF THE INFORMATION OF THIS FILE, HERE WE HAVE THE CONFIG OBJECT CONFIGURED AND MODELLED @[heap] -pub struct RepromptWorkspace { +pub struct HeropromptWorkspace { pub mut: name string = 'default' - dirs []RepromptDir + dirs []HeropromptDir } -pub struct RepromptDir { +pub struct HeropromptDir { pub mut: path pathlib.Path - selections []string // paths selected in the RepromptDir + selections []string // paths selected in the HeropromptDir } // your checking & initialization code if needed -fn obj_init(mycfg_ RepromptWorkspace) !RepromptWorkspace { +fn obj_init(mycfg_ HeropromptWorkspace) !HeropromptWorkspace { mut mycfg := mycfg_ if mycfg.password == '' && mycfg.secret == '' { return error('password or secret needs to be filled in for ${mycfg.name}') @@ -35,14 +35,14 @@ fn obj_init(mycfg_ RepromptWorkspace) !RepromptWorkspace { /////////////NORMALLY NO NEED TO TOUCH -pub fn heroscript_dumps(obj RepromptWorkspace) !string { +pub fn heroscript_dumps(obj HeropromptWorkspace) !string { // create heroscript following template // check for our homedir on our machine and replace in the heroscript to @HOME in path - return encoderhero.encode[RepromptWorkspace](obj)! + return encoderhero.encode[HeropromptWorkspace](obj)! } -pub fn heroscript_loads(heroscript string) !RepromptWorkspace { - // TODO: parse heroscript populate RepromptWorkspace - mut obj := encoderhero.decode[RepromptWorkspace](heroscript)! +pub fn heroscript_loads(heroscript string) !HeropromptWorkspace { + // TODO: parse heroscript populate HeropromptWorkspace + mut obj := encoderhero.decode[HeropromptWorkspace](heroscript)! return obj } diff --git a/lib/develop/reprompt/templates/heroscript_template.hero b/lib/develop/heroprompt/templates/heroscript_template.hero similarity index 70% rename from lib/develop/reprompt/templates/heroscript_template.hero rename to lib/develop/heroprompt/templates/heroscript_template.hero index 2490f3ba..6707d82c 100644 --- a/lib/develop/reprompt/templates/heroscript_template.hero +++ b/lib/develop/heroprompt/templates/heroscript_template.hero @@ -1,7 +1,7 @@ -!!reprompt.configure name:"default" +!!heroprompt.configure name:"default" -!!reprompt.workspace_dir name:"default" +!!heroprompt.workspace_dir name:"default" path:"@HOME/code/github/freeflowuniverse/herolib/lib/builder" selection:"path1,path2" //paths are relative in the path of workspace filter_exclude:"," diff --git a/lib/develop/reprompt/templates/prompt.md b/lib/develop/heroprompt/templates/prompt.md similarity index 100% rename from lib/develop/reprompt/templates/prompt.md rename to lib/develop/heroprompt/templates/prompt.md diff --git a/lib/develop/reprompt/templates/prompt_example.md b/lib/develop/heroprompt/templates/prompt_example.md similarity index 100% rename from lib/develop/reprompt/templates/prompt_example.md rename to lib/develop/heroprompt/templates/prompt_example.md