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

doc: print available modules

This commit is contained in:
Alexander Medvednikov
2020-05-15 23:09:38 +02:00
parent 2dbb4c2ca7
commit 7caebc5781
2 changed files with 18 additions and 5 deletions

View File

@@ -26,9 +26,19 @@ pub fn doc(mod string, table &table.Table, prefs &pref.Preferences) string {
vlib_path := os.dir(pref.vexe_path()) + '/vlib'
mod_path := mod.replace('.', os.path_separator)
path := os.join_path(vlib_path, mod_path)
if !os.exists(path) {
println('module "$mod" not found')
println(path)
if mod == '' || !os.exists(path) {
if mod != '' {
println('module "$mod" not found')
}
println('\navailable modules:')
mut files := os.ls(vlib_path) or {
return ''
}
files.sort()
for file in files {
println(file)
}
// println(path)
return ''
}
// vfiles := os.walk_ext(path, '.v')