v/cmd/tools/modules/vhelp/vhelp.v

16 lines
310 B
V
Raw Normal View History

2020-03-13 20:52:49 +01:00
module vhelp
import os
pub fn show_topic(topic string) {
2020-03-20 16:41:18 +01:00
vexe := os.real_path(os.getenv('VEXE'))
2020-03-13 20:52:49 +01:00
vroot := os.dir(vexe)
target_topic := os.join_path(vroot, 'cmd', 'v', 'help', '${topic}.txt')
2020-03-13 20:52:49 +01:00
content := os.read_file(target_topic) or {
eprintln('Unknown topic: $topic')
exit(1)
}
println(content)
}
2020-03-20 16:41:18 +01:00