From 56817ea137eb317d27ef33b9425f1a93e6791d21 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sat, 7 Nov 2020 18:02:16 +0200 Subject: [PATCH] v search: add an import suggestion for an already existing module in vlib --- cmd/tools/vpm.v | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cmd/tools/vpm.v b/cmd/tools/vpm.v index db535ba19e..c7e66a5f2e 100644 --- a/cmd/tools/vpm.v +++ b/cmd/tools/vpm.v @@ -142,7 +142,17 @@ fn vpm_search(keywords []string) { } } if index == 0 { - println('No module(s) found for "$joined"') + vexe := os.getenv('VEXE') + vroot := os.real_path(os.dir(vexe)) + mut messages := ['No module(s) found for `$joined` .'] + for vlibmod in search_keys { + if os.is_dir(os.join_path(vroot, 'vlib', vlibmod)) { + messages << 'There is already an existing "$vlibmod" module in vlib, so you can just `import $vlibmod` .' + } + } + for m in messages { + println(m) + } } else { println('\nUse "v install author_name.module_name" to install the module.') }