...
This commit is contained in:
@@ -101,7 +101,7 @@ fn do() ! {
|
|||||||
// herocmds.cmd_juggler(mut cmd)
|
// herocmds.cmd_juggler(mut cmd)
|
||||||
herocmds.cmd_generator(mut cmd)
|
herocmds.cmd_generator(mut cmd)
|
||||||
herocmds.cmd_docusaurus(mut cmd)
|
herocmds.cmd_docusaurus(mut cmd)
|
||||||
herocmds.cmd_starlight(mut cmd)
|
// herocmds.cmd_starlight(mut cmd)
|
||||||
// herocmds.cmd_docsorter(mut cmd)
|
// herocmds.cmd_docsorter(mut cmd)
|
||||||
// cmd.add_command(publishing.cmd_publisher(pre_func))
|
// cmd.add_command(publishing.cmd_publisher(pre_func))
|
||||||
cmd.setup()
|
cmd.setup()
|
||||||
|
|||||||
@@ -1,143 +1,143 @@
|
|||||||
module herocmds
|
module herocmds
|
||||||
|
|
||||||
import freeflowuniverse.herolib.web.starlight
|
// import freeflowuniverse.herolib.web.starlight
|
||||||
import os
|
import os
|
||||||
import cli { Command, Flag }
|
import cli { Command, Flag }
|
||||||
|
|
||||||
pub fn cmd_starlight(mut cmdroot Command) {
|
// pub fn cmd_starlight(mut cmdroot Command) {
|
||||||
mut cmd_run := Command{
|
// mut cmd_run := Command{
|
||||||
name: 'starlight'
|
// name: 'starlight'
|
||||||
description: 'Generate, build, run starlight sites.'
|
// description: 'Generate, build, run starlight sites.'
|
||||||
required_args: 0
|
// required_args: 0
|
||||||
execute: cmd_starlight_execute
|
// execute: cmd_starlight_execute
|
||||||
}
|
// }
|
||||||
|
|
||||||
// cmd_run.add_flag(Flag{
|
// // cmd_run.add_flag(Flag{
|
||||||
// flag: .bool
|
// // flag: .bool
|
||||||
// required: false
|
// // required: false
|
||||||
// name: 'reset'
|
// // name: 'reset'
|
||||||
// abbrev: 'r'
|
// // abbrev: 'r'
|
||||||
// description: 'will reset.'
|
// // description: 'will reset.'
|
||||||
// })
|
// // })
|
||||||
|
|
||||||
cmd_run.add_flag(Flag{
|
// cmd_run.add_flag(Flag{
|
||||||
flag: .string
|
// flag: .string
|
||||||
required: false
|
// required: false
|
||||||
name: 'url'
|
// name: 'url'
|
||||||
abbrev: 'u'
|
// abbrev: 'u'
|
||||||
// default: ''
|
// // default: ''
|
||||||
description: 'Url where starlight source is.'
|
// description: 'Url where starlight source is.'
|
||||||
})
|
// })
|
||||||
|
|
||||||
cmd_run.add_flag(Flag{
|
// cmd_run.add_flag(Flag{
|
||||||
flag: .string
|
// flag: .string
|
||||||
required: false
|
// required: false
|
||||||
name: 'path'
|
// name: 'path'
|
||||||
abbrev: 'p'
|
// abbrev: 'p'
|
||||||
// default: ''
|
// // default: ''
|
||||||
description: 'Path where starlight source is.'
|
// description: 'Path where starlight source is.'
|
||||||
})
|
// })
|
||||||
|
|
||||||
cmd_run.add_flag(Flag{
|
// cmd_run.add_flag(Flag{
|
||||||
flag: .string
|
// flag: .string
|
||||||
required: false
|
// required: false
|
||||||
name: 'deploykey'
|
// name: 'deploykey'
|
||||||
abbrev: 'dk'
|
// abbrev: 'dk'
|
||||||
// default: ''
|
// // default: ''
|
||||||
description: 'Path of SSH Key used to deploy.'
|
// description: 'Path of SSH Key used to deploy.'
|
||||||
})
|
// })
|
||||||
|
|
||||||
cmd_run.add_flag(Flag{
|
// cmd_run.add_flag(Flag{
|
||||||
flag: .string
|
// flag: .string
|
||||||
required: false
|
// required: false
|
||||||
name: 'publish'
|
// name: 'publish'
|
||||||
// default: ''
|
// // default: ''
|
||||||
description: 'Path where to publish.'
|
// description: 'Path where to publish.'
|
||||||
})
|
// })
|
||||||
|
|
||||||
cmd_run.add_flag(Flag{
|
// cmd_run.add_flag(Flag{
|
||||||
flag: .bool
|
// flag: .bool
|
||||||
required: false
|
// required: false
|
||||||
name: 'buildpublish'
|
// name: 'buildpublish'
|
||||||
abbrev: 'bp'
|
// abbrev: 'bp'
|
||||||
description: 'build and publish.'
|
// description: 'build and publish.'
|
||||||
})
|
// })
|
||||||
|
|
||||||
cmd_run.add_flag(Flag{
|
// cmd_run.add_flag(Flag{
|
||||||
flag: .bool
|
// flag: .bool
|
||||||
required: false
|
// required: false
|
||||||
name: 'builddevpublish'
|
// name: 'builddevpublish'
|
||||||
abbrev: 'bpd'
|
// abbrev: 'bpd'
|
||||||
description: 'build dev version and publish.'
|
// description: 'build dev version and publish.'
|
||||||
})
|
// })
|
||||||
|
|
||||||
cmd_run.add_flag(Flag{
|
// cmd_run.add_flag(Flag{
|
||||||
flag: .bool
|
// flag: .bool
|
||||||
required: false
|
// required: false
|
||||||
name: 'update'
|
// name: 'update'
|
||||||
description: 'update your environment the template and the repo you are working on (git pull).'
|
// description: 'update your environment the template and the repo you are working on (git pull).'
|
||||||
})
|
// })
|
||||||
|
|
||||||
cmd_run.add_flag(Flag{
|
// cmd_run.add_flag(Flag{
|
||||||
flag: .bool
|
// flag: .bool
|
||||||
required: false
|
// required: false
|
||||||
name: 'dev'
|
// name: 'dev'
|
||||||
abbrev: 'd'
|
// abbrev: 'd'
|
||||||
description: 'Run your dev environment on local browser.'
|
// description: 'Run your dev environment on local browser.'
|
||||||
})
|
// })
|
||||||
|
|
||||||
cmd_run.add_flag(Flag{
|
// cmd_run.add_flag(Flag{
|
||||||
flag: .bool
|
// flag: .bool
|
||||||
required: false
|
// required: false
|
||||||
name: 'new'
|
// name: 'new'
|
||||||
abbrev: 'n'
|
// abbrev: 'n'
|
||||||
description: 'create a new starlight site.'
|
// description: 'create a new starlight site.'
|
||||||
})
|
// })
|
||||||
|
|
||||||
cmdroot.add_command(cmd_run)
|
// cmdroot.add_command(cmd_run)
|
||||||
}
|
// }
|
||||||
|
|
||||||
fn cmd_starlight_execute(cmd Command) ! {
|
// fn cmd_starlight_execute(cmd Command) ! {
|
||||||
mut update := cmd.flags.get_bool('update') or { false }
|
// mut update := cmd.flags.get_bool('update') or { false }
|
||||||
mut init := cmd.flags.get_bool('new') or { false }
|
// mut init := cmd.flags.get_bool('new') or { false }
|
||||||
mut url := cmd.flags.get_string('url') or { '' }
|
// mut url := cmd.flags.get_string('url') or { '' }
|
||||||
mut publish_path := cmd.flags.get_string('publish') or { '' }
|
// mut publish_path := cmd.flags.get_string('publish') or { '' }
|
||||||
mut deploykey := cmd.flags.get_string('deploykey') or { '' }
|
// mut deploykey := cmd.flags.get_string('deploykey') or { '' }
|
||||||
|
|
||||||
mut path := cmd.flags.get_string('path') or { '' }
|
// mut path := cmd.flags.get_string('path') or { '' }
|
||||||
|
|
||||||
mut buildpublish := cmd.flags.get_bool('buildpublish') or { false }
|
// mut buildpublish := cmd.flags.get_bool('buildpublish') or { false }
|
||||||
mut builddevpublish := cmd.flags.get_bool('builddevpublish') or { false }
|
// mut builddevpublish := cmd.flags.get_bool('builddevpublish') or { false }
|
||||||
mut dev := cmd.flags.get_bool('dev') or { false }
|
// mut dev := cmd.flags.get_bool('dev') or { false }
|
||||||
|
|
||||||
// if build== false && build== false && build== false {
|
// // if build== false && build== false && build== false {
|
||||||
// eprintln("specify build, builddev or dev")
|
// // eprintln("specify build, builddev or dev")
|
||||||
// exit(1)
|
// // exit(1)
|
||||||
// }
|
// // }
|
||||||
|
|
||||||
mut docs := starlight.new(update: update)!
|
// mut docs := starlight.new(update: update)!
|
||||||
mut site := docs.get(
|
// mut site := docs.get(
|
||||||
url: url
|
// url: url
|
||||||
path: path
|
// path: path
|
||||||
update: update
|
// update: update
|
||||||
publish_path: publish_path
|
// publish_path: publish_path
|
||||||
deploykey: deploykey
|
// deploykey: deploykey
|
||||||
init: init
|
// init: init
|
||||||
)!
|
// )!
|
||||||
|
|
||||||
if publish_path.len > 0 {
|
// if publish_path.len > 0 {
|
||||||
site.build()!
|
// site.build()!
|
||||||
}
|
// }
|
||||||
|
|
||||||
if buildpublish {
|
// if buildpublish {
|
||||||
site.build_publish()!
|
// site.build_publish()!
|
||||||
}
|
// }
|
||||||
|
|
||||||
if builddevpublish {
|
// if builddevpublish {
|
||||||
site.build_dev_publish()!
|
// site.build_dev_publish()!
|
||||||
}
|
// }
|
||||||
|
|
||||||
if dev {
|
// if dev {
|
||||||
site.dev(host: 'localhost', port: 3000)!
|
// site.dev(host: 'localhost', port: 3000)!
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|||||||
@@ -46,8 +46,12 @@ pub fn (mut site DocSite) generate() ! {
|
|||||||
mut footer_file := pathlib.get_file(path: '${cfg_path}/footer.json', create: true)!
|
mut footer_file := pathlib.get_file(path: '${cfg_path}/footer.json', create: true)!
|
||||||
footer_file.write(json.encode_pretty(site.config.footer))!
|
footer_file.write(json.encode_pretty(site.config.footer))!
|
||||||
|
|
||||||
mut aa := site.path_src.dir_get('docs')!
|
osal.rm("${site.factory.path_build.path}/docs")!
|
||||||
aa.copy(dest: '${site.factory.path_build.path}/docs', delete: true)!
|
|
||||||
|
if os.exists("${site.path_src.path}/docs"){
|
||||||
|
mut aa := site.path_src.dir_get('docs')!
|
||||||
|
aa.copy(dest: '${site.factory.path_build.path}/docs', delete: true)!
|
||||||
|
}
|
||||||
|
|
||||||
// now we need to process the pages, call the sitegen module, which will look for statements like
|
// now we need to process the pages, call the sitegen module, which will look for statements like
|
||||||
// !!site.page sitename:'atest'
|
// !!site.page sitename:'atest'
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ pub fn play(args_ PlayArgs) ! {
|
|||||||
|
|
||||||
mut ds := new()!
|
mut ds := new()!
|
||||||
|
|
||||||
|
|
||||||
if plbook.exists_once(filter: 'docusaurus.define') {
|
if plbook.exists_once(filter: 'docusaurus.define') {
|
||||||
mut action := plbook.action_get(actor: 'docusaurus', name: 'define')!
|
mut action := plbook.action_get(actor: 'docusaurus', name: 'define')!
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user