add virt
This commit is contained in:
@@ -39,7 +39,7 @@ pub fn ask(path string) ! {
|
||||
if model.hasconfig {
|
||||
model.singleton = !myconsole.ask_yesno(
|
||||
description: 'Can there be multiple instances (normally yes)?'
|
||||
default: model.singleton
|
||||
default: !model.singleton
|
||||
)!
|
||||
if model.cat == .installer {
|
||||
model.templates = myconsole.ask_yesno(
|
||||
@@ -64,6 +64,12 @@ pub fn ask(path string) ! {
|
||||
)!
|
||||
}
|
||||
|
||||
// if true{
|
||||
// println(model)
|
||||
// panic("Sdsd")
|
||||
// }
|
||||
|
||||
|
||||
gen_model_set(GenerateArgs{model: model, path: path})!
|
||||
|
||||
}
|
||||
|
||||
@@ -37,6 +37,11 @@ pub fn do(args_ GenerateArgs) ! {
|
||||
m
|
||||
}
|
||||
|
||||
if model.classname == "" {
|
||||
args.interactive = true
|
||||
|
||||
}
|
||||
|
||||
if create{
|
||||
if args.path == '' {
|
||||
return error("need to specify path fo ${args_} because we asked to create .heroscript ")
|
||||
@@ -57,6 +62,8 @@ pub fn do(args_ GenerateArgs) ! {
|
||||
if args.interactive{
|
||||
ask(args.path)!
|
||||
args.model = gen_model_get(args.path, false)!
|
||||
}else{
|
||||
args.model = model
|
||||
}
|
||||
|
||||
console.print_debug(args)
|
||||
|
||||
@@ -9,7 +9,7 @@ fn generate(args GenerateArgs) ! {
|
||||
console.print_debug('generate code for path: ${args.path}')
|
||||
|
||||
//as used in the templates
|
||||
model := args.model or { panic('bug') }
|
||||
model := args.model or { panic('bug no model specified in generate') }
|
||||
|
||||
mut path_actions := pathlib.get(args.path + '/${model.name}_actions.v')
|
||||
if args.reset {
|
||||
|
||||
@@ -18,9 +18,9 @@ pub mut:
|
||||
templates bool // means we will use templates in the installer, client doesn't do this'
|
||||
reset bool // regenerate all, dangerous !!!
|
||||
interactive bool //if we want to ask
|
||||
startupmanager bool = true
|
||||
startupmanager bool
|
||||
build bool
|
||||
hasconfig bool
|
||||
hasconfig bool
|
||||
cat Cat = .client
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ pub enum Cat {
|
||||
|
||||
|
||||
pub fn gen_model_set(args GenerateArgs) ! {
|
||||
console.print_debug("Code generator set: ${args}")
|
||||
model := args.model or { return error('model is none') }
|
||||
heroscript_templ := match model.cat {
|
||||
.client { $tmpl('templates/heroscript_client') }
|
||||
@@ -111,6 +112,8 @@ pub fn gen_model_get(path string, create bool) !GenModel {
|
||||
model.name = os.base(path).to_lower()
|
||||
}
|
||||
|
||||
console.print_debug("Code generator get: ${model}")
|
||||
|
||||
return model
|
||||
// return GenModel{}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@ pub mut:
|
||||
// scan over a set of directories call the play where
|
||||
pub fn scan(args ScannerArgs) ! {
|
||||
|
||||
console.print_debug("Code generator scan: ${args.path}")
|
||||
|
||||
if args.path == "" {
|
||||
scan(path:"${os.home_dir()}/code/github/freeflowuniverse/herolib/lib/installers")!
|
||||
scan(path:"${os.home_dir()}/code/github/freeflowuniverse/herolib/lib/clients")!
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
!!hero_code.generate_client
|
||||
name: "${model.name}"
|
||||
classname: "${model.classname}"
|
||||
config: ${model.hasconfig}
|
||||
hasconfig: ${model.hasconfig}
|
||||
singleton: ${model.singleton}
|
||||
default: ${model.default}
|
||||
title: "${model.title}|
|
||||
title: "${model.title}"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
!!hero_code.generate_installer
|
||||
name: "${model.name}"
|
||||
classname: "${model.classname}"
|
||||
config: ${model.hasconfig}
|
||||
hasconfig: ${model.hasconfig}
|
||||
singleton: ${model.singleton}
|
||||
default: ${model.default}
|
||||
title: "${model.title}"
|
||||
|
||||
@@ -2,7 +2,7 @@ module ${model.name}
|
||||
import freeflowuniverse.herolib.data.paramsparser
|
||||
import os
|
||||
|
||||
pub const version = '1.14.3'
|
||||
pub const version = '0.0.0'
|
||||
const singleton = ${model.singleton}
|
||||
const default = ${model.default}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user