vpm: use current folder v.mod, if no args provided in `v install`
parent
ddcb5f7da3
commit
ed7ed6262f
|
@ -5,6 +5,7 @@ import os.cmdline
|
||||||
import net.http
|
import net.http
|
||||||
import json
|
import json
|
||||||
import vhelp
|
import vhelp
|
||||||
|
import v.vmod
|
||||||
|
|
||||||
const (
|
const (
|
||||||
default_vpm_server_urls = ['https://vpm.best', 'https://vpm.vlang.io']
|
default_vpm_server_urls = ['https://vpm.best', 'https://vpm.vlang.io']
|
||||||
|
@ -49,7 +50,7 @@ fn main() {
|
||||||
exit(5)
|
exit(5)
|
||||||
}
|
}
|
||||||
vpm_command := params[0]
|
vpm_command := params[0]
|
||||||
module_names := params[1..]
|
mut module_names := params[1..]
|
||||||
ensure_vmodules_dir_exist()
|
ensure_vmodules_dir_exist()
|
||||||
// println('module names: ') println(module_names)
|
// println('module names: ') println(module_names)
|
||||||
match vpm_command {
|
match vpm_command {
|
||||||
|
@ -60,6 +61,15 @@ fn main() {
|
||||||
vpm_search(module_names)
|
vpm_search(module_names)
|
||||||
}
|
}
|
||||||
'install' {
|
'install' {
|
||||||
|
if module_names.len == 0 && os.exists('./v.mod') {
|
||||||
|
println('Detected v.mod file inside the project directory. Using it...')
|
||||||
|
manifest := vmod.from_file('./v.mod') or {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
module_names = manifest.dependencies
|
||||||
|
}
|
||||||
|
|
||||||
vpm_install(module_names)
|
vpm_install(module_names)
|
||||||
}
|
}
|
||||||
'update' {
|
'update' {
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
Usage:
|
Usage:
|
||||||
v install module [module] [module] [...]
|
v install module [module] [module] [...]
|
||||||
^^^^^^^^^^^^^ will install the modules you specified
|
^^^^^^^^^^^^^ will install the modules you specified
|
||||||
|
|
||||||
|
You can also do `v install` directly if you have dependencies stored
|
||||||
|
inside the `v.mod` file. This will automatically installs the modules
|
||||||
|
specified inside of it.
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-help - Show usage info.
|
-help - Show usage info.
|
||||||
-verbose - Print more details about the performed operation.
|
-verbose - Print more details about the performed operation.
|
||||||
-server-url - When doing network operations, use this vpm server. Can be given multiple times.
|
-server-url - When doing network operations, use this vpm server.
|
||||||
|
Can be given multiple times.
|
||||||
|
|
Loading…
Reference in New Issue