V is a tool for managing V source code.
Usage:
v [options] [command] [arguments]
Examples:
v hello.v Compile the file `hello.v` and output it as
`hello` or `hello.exe`.
v run hello.v Same as above but also run the produced
executable immediately after compilation.
v -g run hello.v Same as above but makes debugging easier
(Useful in case your program crashes).
(see `v help build` and `v help build-c`
for more information)
v crun hello.v Same as above but do not recompile if the
executable already exists and is newer than the
sources.
v -o h.c hello.v Translate `hello.v` to `h.c` only. Do not compile
further.
v -v2 hello.v Compile `hello.v` with the V2 frontend
(`cmd/v2/v2.v`). Use `-b arm64` or
`-backend arm64` to switch V2 backends.
v -o - hello.v Translates `hello.v` and outputs the C source
code to stdout. Does not compile further.
v watch hello.v Re-do the same compilation when a source code
change is detected. The compiled result does not
get executed, only compiled.
v watch run hello.v Re-run the same `hello.v` file when a source
code change is detected.
V supports the following commands:
* Project Scaffolding Utilities:
new Setup the file structure for a V project
(in a sub folder).
init Setup the file structure for an already existing
V project.
* Commonly Used Utilities:
run Compile and run a V program. Delete the
executable if V created it for this run.
crun Compile and run a V program, keeping the
executable for reuse.
If you run the same program a second time,
without changing the source files,
V will just run the executable, without
recompilation. Suitable for scripting.
test Run all test files in the provided directory.
fmt Format the V code provided.
vet Report suspicious code constructs.
doc Generate the documentation for a V module.
example: `v doc strings`
vlib-docs Generate and open the documentation of all the
vlib modules.
repl Run the REPL (Read-eval-print loop).
watch Re-compile/re-run a source file, each time it is
changed.
example: `v watch run hello.v`
where Find and print the location of current project
declarations.
quest Help us make V better, by doing a small randomly
selected task, like triaging an issue, improving
the documentation, testing, etc.
* Installation Management Utilities:
symlink Create a symbolic link for V.
up Run the V self-updater.
self [-prod] Run the V self-compiler, use -prod to optimize
compilation.
version Print the version text and exits.
* Package Management Utilities:
install Install a module from VPM.
link Symlink the current project into VMODULES.
remove Remove a module that was installed from VPM.
search Search for a module from VPM.
unlink Remove the symlink for the current project
from VMODULES.
update Update an installed module from VPM.
upgrade Upgrade all the outdated modules.
list List all installed modules.
outdated List installed modules that need updates.
show Display information about a module on vpm
Use "v help " for more information about a command, example:
`v help build`, `v help build-c`, `v help build-native`
Use "v help other" to see less frequently used commands.
Use "v help topics" to see a list of all known help topics.
Note: Help is required to write more help topics.
Only build, new, init, doc, fmt, vet, run, test, watch, search, install,
link, remove, unlink, update, bin2v, check-md are properly documented currently.