2019-08-01 02:34:28 +03:00
|
|
|
module main
|
|
|
|
|
|
|
|
import (
|
|
|
|
http
|
|
|
|
os
|
|
|
|
json
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
//url = 'http://localhost:8089'
|
2019-08-05 05:34:12 +03:00
|
|
|
url = 'https://vpm.best'
|
2019-08-01 02:34:28 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
struct Mod {
|
|
|
|
id int
|
|
|
|
name string
|
|
|
|
url string
|
|
|
|
nr_downloads int
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
if os.args.len != 2 {
|
|
|
|
println('usage: vget [module]')
|
|
|
|
return
|
|
|
|
}
|
|
|
|
name := os.args.last()
|
|
|
|
s := http.get_text(url + '/jsmod/$name')
|
2019-08-05 05:34:12 +03:00
|
|
|
mod := json.decode(Mod, s) or {
|
|
|
|
println('Error. Make sure you are online.')
|
|
|
|
return
|
|
|
|
}
|
2019-08-01 02:34:28 +03:00
|
|
|
home := os.home_dir()
|
2019-08-04 18:00:00 +03:00
|
|
|
os.exec('git -C "$home/.vmodules" clone --depth=1 $mod.url $mod.name')
|
2019-08-01 02:34:28 +03:00
|
|
|
println(s)
|
|
|
|
}
|
|
|
|
|