1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/cmd/tools/modules/vhelp/vhelp.v

15 lines
311 B
V
Raw Normal View History

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