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

vpm: add list command (#5888)

This commit is contained in:
Lukas Neubert
2020-07-20 16:39:37 +02:00
committed by GitHub
parent c60948e52e
commit c93467bca5
3 changed files with 18 additions and 3 deletions

View File

@ -9,7 +9,7 @@ import v.vmod
const (
default_vpm_server_urls = ['https://vpm.best', 'https://vpm.vlang.io']
valid_vpm_commands = ['help', 'search', 'install', 'update', 'outdated', 'remove']
valid_vpm_commands = ['help', 'search', 'install', 'update', 'outdated', 'list', 'remove']
excluded_dirs = ['cache', 'vlib']
supported_vcs_systems = ['git', 'hg']
supported_vcs_folders = ['.git', '.hg']
@ -79,6 +79,9 @@ fn main() {
'outdated' {
vpm_outdated()
}
'list' {
vpm_list()
}
'remove' {
vpm_remove(module_names)
}
@ -283,6 +286,17 @@ fn vpm_outdated() {
}
}
fn vpm_list() {
module_names := get_installed_modules()
if module_names.len == 0 {
println('You have no modules installed.')
exit(0)
}
for mod in module_names {
println(mod)
}
}
fn vpm_remove(module_names []string) {
if settings.is_help {
vhelp.show_topic('remove')