🎨 fix format
This commit is contained in:
parent
fd1d8ef26d
commit
ea78a8ffcc
1 changed files with 8 additions and 8 deletions
|
@ -32,7 +32,7 @@ fn new_build_cmd() cli.Command {
|
||||||
logger.set_level(log.Level.info)
|
logger.set_level(log.Level.info)
|
||||||
build(mut logger) or {
|
build(mut logger) or {
|
||||||
logger.error(err.msg())
|
logger.error(err.msg())
|
||||||
println("Build failed")
|
println('Build failed')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,22 +80,22 @@ fn pre_proc_md_to_html(contents string) ?string {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build(mut logger log.Log) ? {
|
fn build(mut logger log.Log) ? {
|
||||||
println("Start building")
|
println('Start building')
|
||||||
mut sw := time.new_stopwatch()
|
mut sw := time.new_stopwatch()
|
||||||
|
|
||||||
dist := commands.default_dist
|
dist := commands.default_dist
|
||||||
if os.exists(dist) {
|
if os.exists(dist) {
|
||||||
logger.info("re-create dist dir")
|
logger.info('re-create dist dir')
|
||||||
os.rmdir_all(dist)?
|
os.rmdir_all(dist)?
|
||||||
os.mkdir_all(dist)?
|
os.mkdir_all(dist)?
|
||||||
} else {
|
} else {
|
||||||
logger.info("create dist dir")
|
logger.info('create dist dir')
|
||||||
os.mkdir_all(dist)?
|
os.mkdir_all(dist)?
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy static files
|
// copy static files
|
||||||
if os.exists(commands.defautl_static) {
|
if os.exists(commands.defautl_static) {
|
||||||
logger.info("copy static files")
|
logger.info('copy static files')
|
||||||
os.cp_all(commands.defautl_static, dist, false)?
|
os.cp_all(commands.defautl_static, dist, false)?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ fn build(mut logger log.Log) ? {
|
||||||
mut config_map := get_config_map()?
|
mut config_map := get_config_map()?
|
||||||
|
|
||||||
md_paths := os.walk_ext('.', '.md')
|
md_paths := os.walk_ext('.', '.md')
|
||||||
logger.info("start md to html")
|
logger.info('start md to html')
|
||||||
for path in md_paths {
|
for path in md_paths {
|
||||||
mut md := os.read_file(path)?
|
mut md := os.read_file(path)?
|
||||||
md = pre_proc_md_to_html(md)?
|
md = pre_proc_md_to_html(md)?
|
||||||
|
@ -114,9 +114,9 @@ fn build(mut logger log.Log) ? {
|
||||||
html_path := os.join_path(dist, filename)
|
html_path := os.join_path(dist, filename)
|
||||||
os.write_file(html_path, html)?
|
os.write_file(html_path, html)?
|
||||||
}
|
}
|
||||||
logger.info("end md to html")
|
logger.info('end md to html')
|
||||||
|
|
||||||
sw.stop()
|
sw.stop()
|
||||||
println("Total in " + sw.elapsed().milliseconds().str() + " ms")
|
println('Total in ' + sw.elapsed().milliseconds().str() + ' ms')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue