1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

v help: add v help watch, rename -watch in v help too

This commit is contained in:
Delyan Angelov 2021-05-05 21:31:45 +03:00
parent 2c4a59f367
commit 7288f12847
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
2 changed files with 23 additions and 3 deletions

View File

@ -9,8 +9,9 @@ Examples:
v -cg run hello.v Same as above, but make debugging easier (in case your program crashes). v -cg run hello.v Same as above, but make debugging easier (in case your program crashes).
v -o h.c hello.v Translate `hello.v` to `h.c`. Do not compile further. v -o h.c hello.v Translate `hello.v` to `h.c`. Do not compile further.
v -watch hello.v Re-compiles over and over the same compilation, when a source change is detected. v watch hello.v Re-does the same compilation, when a source code change is detected.
v -watch run file.v Re-runs over and over the same file.v, when a source change is detected. The program is only compiled, not run.
v watch run hello.v Re-runs the same `hello.v` file, when a source code change is detected.
V supports the following commands: V supports the following commands:
* New project scaffolding: * New project scaffolding:
@ -25,6 +26,7 @@ V supports the following commands:
doc Generate the documentation for a V module. doc Generate the documentation for a V module.
vlib-docs Generate and open the documentation of all the vlib modules. vlib-docs Generate and open the documentation of all the vlib modules.
repl Run the REPL. repl Run the REPL.
watch Re-compile/re-run a source file, each time it is changed.
* Installation/self updating: * Installation/self updating:
symlink Create a symbolic link for V. symlink Create a symbolic link for V.
@ -52,4 +54,4 @@ Use "v help <command>" for more information about a command, example: `v help bu
Use "v help other" to see less frequently used commands. Use "v help other" to see less frequently used commands.
Note: Help is required to write more help topics. Note: Help is required to write more help topics.
Only build, new, init, doc, fmt, vet, run, test, search, install, remove, update, bin2v, check-md are properly documented currently. Only build, new, init, doc, fmt, vet, run, test, watch, search, install, remove, update, bin2v, check-md are properly documented currently.

18
cmd/v/help/watch.txt Normal file
View File

@ -0,0 +1,18 @@
v watch [--clear] [--ignore .db] [--add /path/to/a/file.v] [other V options] [run] program.v
Description:
`v watch` collects all .v files needed for a compilation, then when
any of the .v source files changes, it re-runs the compilation.
Options:
-c, --clear Clears the terminal before each re-run.
-a, --add <string> Add more files to be watched.
Useful with `v watch -add=feature.v run cmd/v feature.v`,
when you want to change *both* the V compiler,
and the `feature.v` file.
-i, --ignore <string> Ignore files having these extensions.
Useful with `v watch -ignore=.db run vwebserver.v`,
if your `vwebserver` writes to an sqlite.db file in the
same folder.