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:
parent
c60948e52e
commit
c93467bca5
@ -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')
|
||||
|
@ -31,7 +31,8 @@ V supports the following commands:
|
||||
remove Remove a module that was installed from VPM.
|
||||
search Search for a module from VPM.
|
||||
update Update an installed module from VPM.
|
||||
outdated List installed modules that need updates.
|
||||
list List all installed modules.
|
||||
outdated Show installed modules that need updates.
|
||||
* Others:
|
||||
build Build a V code in the provided path (the default, so you can skip the word `build`).
|
||||
translate Translate C code to V (coming soon in 0.3).
|
||||
|
Loading…
Reference in New Issue
Block a user