improve vhelp.v a bit

pull/1947/head
Alexander Medvednikov 2019-09-15 14:08:40 +03:00
parent b71bb95f7d
commit bcf3dbf974
3 changed files with 32 additions and 26 deletions

View File

@ -31,7 +31,7 @@
- A bug with struct ordering was fixed, now structs can be declared in any order. - A bug with struct ordering was fixed, now structs can be declared in any order.
- V modules can now be built with `v build module`. - V modules can now be built with `v build module`.
- `@FILE, @LINE, @FN, @COLUMN` for debugging. - `@FILE, @LINE, @FN, @COLUMN` for debugging.
- JavaScript backend! (big project, WIP until Sep 13) - JavaScript backend!

View File

@ -1,47 +1,55 @@
module main module main
const ( const (
HelpText = 'Usage: v [options/subcommands] [file.v | directory] HelpText = 'Usage: v [options/commands] [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 run in REPL mode.
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 executable will have the
You can use -o to specify a different output name. same name as the input .v file: `v foo.v` produces `./foo` on *nix systems,
`foo.exe` on Windows.
When given a directory, all the .v files contained in it, will be compiled as part of a single main module. You can use -o to specify a different output executable's name.
By default the executable will be named a.out.
When given a directory, all .v files contained in it will be compiled as
part of a single main module.
By default the executable will have the same name as the directory.
To compile all V files in current directory, run `v .`
Any file ending in _test.v, will be treated as a test. Any file ending in _test.v, will be treated as a test.
It will be compiled and run, evaluating the assert statements in every function named test_xxx. It will be compiled and run, evaluating the assert statements in every
function named test_xxx.
You can put common options inside an environment variable named VFLAGS, so that you do not repeat them. You can put common options inside an environment variable named VFLAGS, so that
You can set it like this: `export VFLAGS="-cc clang -debug"` on unix, `set VFLAGS=-os msvc` on windows. you don\'t have to repeat them.
Options: You can set it like this: `export VFLAGS="-cc clang -debug"` on *nix,
- Shorthand for `v runrepl`. `set VFLAGS=-os msvc` on Windows.
-h, --help Display this information.
Options/commands:
-h, help Display this information.
-o <file> Write output to <file>.
-o <file>.c Produce C source without compiling it.
-o <file>.js Produce JavaScript source.
-prod Build an optimized executable.
-v, version Display compiler version and git hash of the compiler source.
-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.
-os msvc is useful, if you want to use the MSVC compiler on Windows. Use msvc if you want to use the MSVC compiler on Windows.
-prod Build an optimized executable.
-v, --version Display compiler version and git hash of the compiler source.
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.
-g Show v line numbers in backtraces. Implies -debug. -g Show v line numbers in backtraces. Implies -debug.
-o <file> Place output into <file>. If file has a .c suffix, produce C source, and do not compile it further.
-obf Obfuscate the resulting binary. -obf Obfuscate the resulting binary.
-show_c_cmd Print the full C compilation command and how much time it took. -show_c_cmd Print the full C compilation command and how much time it took.
- Shorthand for `v runrepl`.
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.
@ -49,11 +57,9 @@ Subcommands:
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.
' '
) )

View File

@ -23,7 +23,7 @@
- declarative ui with hot reload (similar to swiftui) - declarative ui with hot reload (similar to swiftui)
- "building a simple blog with vweb" tutorial + youtube video - "building a simple blog with vweb" tutorial + youtube video
- webassembly backend (via emscripten) - webassembly backend (via emscripten)
- javascript backend + javascript backend
- new playground with a v compiler running in the browser - new playground with a v compiler running in the browser
+ o(log n) type lookup + o(log n) type lookup
- remove all compiler memory leaks - remove all compiler memory leaks