From 2a9d1b204be82c33f691f3ef777b96989445e0bb Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Fri, 1 Aug 2025 18:44:40 +0300 Subject: [PATCH] tools: improve the output of `./v doc -m -f html vlib/` --- cmd/tools/vdoc/html.v | 6 ++++-- cmd/tools/vdoc/main.v | 1 + cmd/tools/vdoc/vdoc.v | 7 ++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd/tools/vdoc/html.v b/cmd/tools/vdoc/html.v index 49683789be..d2107ac996 100644 --- a/cmd/tools/vdoc/html.v +++ b/cmd/tools/vdoc/html.v @@ -79,8 +79,10 @@ fn (vd &VDoc) render_search_index(out Output) { } js_search_index.writeln('];\n') js_search_data.writeln('];\n') + final := js_search_index.str() + js_search_data.str() out_file_path := os.join_path(out.path, 'search_index.js') - os.write_file(out_file_path, js_search_index.str() + js_search_data.str()) or { panic(err) } + println('Generating search_index.js of ${final.len:8} bytes in `${out_file_path} ...') + os.write_file(out_file_path, final) or { panic(err) } } fn (mut vd VDoc) render_static_html(out Output) { @@ -115,7 +117,7 @@ fn (vd &VDoc) get_resource(name string, out Output) string { } else { output_path := os.join_path(out.path, name) if !os.exists(output_path) { - println('Generating ${out.typ} in "${output_path}"') + println('Generating ${res.len:8} bytes of static resources in `${output_path}` ...') os.write_file(output_path, res) or { panic(err) } } return name diff --git a/cmd/tools/vdoc/main.v b/cmd/tools/vdoc/main.v index 3ee1ed62ca..a801e646c4 100644 --- a/cmd/tools/vdoc/main.v +++ b/cmd/tools/vdoc/main.v @@ -42,6 +42,7 @@ mut: } fn main() { + unbuffer_stdout() // avoid the need for flush_stdout() calls if os.args.len < 2 || '-h' in os.args || '-help' in os.args || '--help' in os.args || os.args[1..] == ['doc', 'help'] { os.system('${os.quoted_path(vexe)} help doc') diff --git a/cmd/tools/vdoc/vdoc.v b/cmd/tools/vdoc/vdoc.v index 4a44444b13..ead5947541 100644 --- a/cmd/tools/vdoc/vdoc.v +++ b/cmd/tools/vdoc/vdoc.v @@ -188,11 +188,9 @@ fn (mut vd VDoc) work_processor(mut work sync.Channel, mut wg sync.WaitGroup) { break } vd.vprintln('> start processing ${pdoc.d.base_path} ...') - flush_stdout() file_name, content := vd.render_doc(pdoc.d, pdoc.out) output_path := os.join_path(pdoc.out.path, file_name) - println('Generating ${pdoc.out.typ} in "${output_path}"') - flush_stdout() + println('Generating ${content.len:8} bytes of ${pdoc.out.typ} in `${output_path}` ...') os.write_file(output_path, content) or { panic(err) } } wg.done() @@ -436,15 +434,14 @@ fn (mut vd VDoc) generate_docs_from_file() { vd.render_search_index(out) // move favicons to target directory println('Copying favicons...') - favicons_path := os.join_path(cfg.theme_dir, 'favicons') - favicons := os.ls(favicons_path) or { panic(err) } for favicon in favicons { favicon_path := os.join_path(favicons_path, favicon) destination_path := os.join_path(out.path, favicon) os.cp(favicon_path, destination_path) or { panic(err) } } + println('Copied ${favicons.len} icons to `${out.path}` .') } } }