vpm

December 17, 2019 ยท View on GitHub

(Available Chinese README version) | (Available Portuguese README version)

vpm(0.0.2) is a package manager for V, written on V.

  • The package is now downloaded to the ~/.vmodules directory.

Requirements

  • V compiler >=v0.1.23.
  • Install git, because the package is currently downloaded via git clone.

Building

$ git clone https://github.com/yue-best-practices/vpm
$ cd vpm
$ v -prod .

CLI Usage

CommandParamsDescription
-v/versionShow vpm version
init<project-name>Initialize project (create the vpm.json file)
get<git-url> <pkg-name>Fetch package from the git repo (add dependency to the vpm.json.
installInstall the package from the vpm.json file.
-h/helpShow help information.
cleanDelete the vpm.json file.
lsShow installed packages list
rm<package-name>...Remove packages in the vpm.json file by name

Packages

For an overview of all the available and supported packages, you can look at VPM Repository.

Example

Here is an example of using the vargs package.

  • Make project directory test
$ mkdir test
$ cd test
  • Init vpm.json
$ vpm init
  • Write example code
$ vim main.v
import vargs
import os

fn main() {
    _args := vargs.parse(os.args, 1)
    println(_args.str())
    println(_args.command)
    println(_args.unknown[0])
}
  • Install args package
$ vpm get https://github.com/nedpals/v-args vargs
  • Build
$ v -prod main.v
  • Run
$ ./main hello world
{ command: hello, options: {}, unknown: ["world"] }
hello
world