From ac71f9eb4bb3c526640ad2c129a553b5b92ca0d7 Mon Sep 17 00:00:00 2001 From: Peyton Creery <44987569+phcreery@users.noreply.github.com> Date: Sat, 4 Jan 2025 01:14:52 -0600 Subject: [PATCH] v.help: improve message formatting (#23363) --- vlib/v/help/build/build.txt | 4 ++-- vlib/v/help/default.txt | 32 ++++++++++++++++++-------------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/vlib/v/help/build/build.txt b/vlib/v/help/build/build.txt index 8ba95ca11e9cc4..edd1a72dce95ef 100644 --- a/vlib/v/help/build/build.txt +++ b/vlib/v/help/build/build.txt @@ -9,7 +9,7 @@ to be a .v source file or folder containing .v source files. Everything after that, is assumed to be flags, that V will ignore itself, but will pass to the executable after it is compiled. -This enables you to do for example: `v -cc gcc -g myfile.v run -param1 abcde` +This enables you to do for example: `v -cc gcc -g run myfile.v -param1 abcde` ... which means for V: "compile using gcc, produce debugging information, then run `./myfile -param1 abcde` and exit with its exit code". @@ -59,7 +59,7 @@ NB: the build flags are shared with the run command too: value assigned to ``. If no flag identifier (or value) is assigned, `$d()` will return the passed ``. - -g + -g, -debug Compile the executable in debug mode, allowing code to be debugged more easily. -o , -output diff --git a/vlib/v/help/default.txt b/vlib/v/help/default.txt index 62bd01c1d2f23d..7b026320f06a00 100644 --- a/vlib/v/help/default.txt +++ b/vlib/v/help/default.txt @@ -8,19 +8,21 @@ Examples: `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 make debugging easier - (in case your program crashes). - v crun hello.v Same as above, but do not recompile, if the - executable already exists, and is newer than the + 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`. Do not compile + v -o h.c hello.v Translate `hello.v` to `h.c` only. Do not compile further. - v -o - hello.v Translate `hello.v` and output the C source code - to stdout. Do not compile further. - v watch hello.v Re-does the same compilation, when a source code - 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 + 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: @@ -44,11 +46,13 @@ V supports the following commands: 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. + 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. @@ -76,5 +80,5 @@ 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, 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.