compiler: improve the help message

pull/2051/head
Nicolas Sauzede 2019-09-13 15:19:41 +02:00 committed by Alexander Medvednikov
parent 5aaa794519
commit 7f3cfea02b
1 changed files with 21 additions and 22 deletions

View File

@ -3,8 +3,6 @@ module main
const ( const (
HelpText = 'Usage: v [options/subcommands] [file.v | directory] HelpText = 'Usage: v [options/subcommands] [file.v | directory]
When V is run without any arguments, it is a shorthand for `v runrepl`. When V is run without any arguments, it is a shorthand for `v runrepl`.
When given a .v file, it will be compiled. The output executable will have the same name as the input .v file. When given a .v file, it will be compiled. The output executable will have the same name as the input .v file.
@ -20,20 +18,20 @@ const (
You can set it like this: `export VFLAGS="-cc clang -debug"` on unix, `set VFLAGS=-os msvc` on windows. You can set it like this: `export VFLAGS="-cc clang -debug"` on unix, `set VFLAGS=-os msvc` on windows.
Options: Options:
- Shorthand for `v runrepl` . - Shorthand for `v runrepl`.
-h, help Display this information. -h, --help Display this information.
-live Enable hot code reloading (required by functions marked with [live]). -live Enable hot code reloading (required by functions marked with [live]).
-os <OS> Produce an executable for the selected OS. -os <OS> Produce an executable for the selected OS.
OS can be linux, mac, windows, msvc, etc... OS can be linux, mac, windows, msvc, etc...
-os msvc is useful, if you want to use the MSVC compiler on Windows. -os msvc is useful, if you want to use the MSVC compiler on Windows.
-prod Build an optimized executable. -prod Build an optimized executable.
-v, version Display compiler version and git hash of the compiler source. -v, --version Display compiler version and git hash of the compiler source.
Debugging options: Debugging options:
-cc <ccompiler> Specify which C compiler you want to use as a C backend. -cc <ccompiler> Specify which C compiler you want to use as a C backend.
The C backend compiler should be able to handle C99 compatible C code. The C backend compiler should be able to handle C99 compatible C code.
Common C compilers are gcc, clang, tcc, icc, cl ... Common C compilers are gcc, clang, tcc, icc, cl...
-cflags flags Pass additional C flags to the C backend compiler. -cflags <flags> Pass additional C flags to the C backend compiler.
Example: -cflags `sdl2-config --cflags` Example: -cflags `sdl2-config --cflags`
-debug Keep the generated C file for debugging in program.tmp.c even after compilation. -debug Keep the generated C file for debugging in program.tmp.c even after compilation.
@ -45,16 +43,17 @@ Debugging options:
Subcommands: Subcommands:
up Update V. Run `v up` at least once per day, since V development is rapid and features/bugfixes are added constantly. up Update V. Run `v up` at least once per day, since V development is rapid and features/bugfixes are added constantly.
run <file.v> Build and execute the V program in file.v . You can add arguments for the V program *after* the file name. run <file.v> Build and execute the V program in file.v. You can add arguments for the V program *after* the file name.
build module Compile a module into an object file. build <module> Compile a module into an object file.
runrepl Run the V REPL. If V is running in a tty terminal, the REPL is interactive, otherwise it just reads from stdin. runrepl Run the V REPL. If V is running in a tty terminal, the REPL is interactive, otherwise it just reads from stdin.
symlink Useful on unix systems. Symlinks the current V executable to /usr/local/bin/v, so that V is globally available. symlink Useful on unix systems. Symlinks the current V executable to /usr/local/bin/v, so that V is globally available.
install module Install a user module from https://vpm.vlang.io/ . install <module> Install a user module from https://vpm.vlang.io/.
test v Run all V test files, and compile all V examples. test v Run all V test files, and compile all V examples.
fmt Run vfmt to format the source code. [wip] fmt Run vfmt to format the source code. [wip]
doc Run vdoc over the source code and produce documentation. [wip] doc Run vdoc over the source code and produce documentation. [wip]
translate Translates C to V. [wip, will be available in V 0.3] translate Translates C to V. [wip, will be available in V 0.3]
version Display compiler version and git hash of the compiler source.
' '
) )