From 2831b61a0b84f250385ce809921e442f954077ff Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Thu, 14 Nov 2024 13:48:01 +0200 Subject: [PATCH] ci,v.help: work around -autofree bugs, fix `./v -autofree -o v2 cmd/v` --- vlib/v/help/help.v | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/vlib/v/help/help.v b/vlib/v/help/help.v index 4e3868c23bf6d7..bc5beaa6b1fe6e 100644 --- a/vlib/v/help/help.v +++ b/vlib/v/help/help.v @@ -56,10 +56,13 @@ pub fn print_and_exit(topic string, opts ExitOptions) { print_known_topics() exit(fail_code) } - println(os.read_file(topic_path) or { - eprintln('error: failed reading topic file: ${err}') + topic_content := os.read_file(topic_path) or { + msg := err.str() + eprintln('error: failed reading topic file: ${msg}') exit(fail_code) - }.trim_space()) + } + cleaned := topic_content.trim_space() + println(cleaned) exit(opts.exit_code) } @@ -76,7 +79,8 @@ fn print_known_topics() { res << topic } } - println('Known help topics: ${res.sorted()}') + sorted_topics := res.sorted() + println('Known help topics: ${sorted_topics}') } fn get_vexe() string {