36 lines
1.6 KiB
Plaintext
36 lines
1.6 KiB
Plaintext
Usage:
|
|
v fmt [options] path_to_source.v [path_to_other_source.v]
|
|
v fmt [options] path/to/dir [path/to/other_dir]
|
|
cat source.v | v fmt
|
|
Read source code from stdin, output formatted file to stdout.
|
|
|
|
Formats the given V source files or recursively formats all files in the directory,
|
|
then prints their formatted source to stdout.
|
|
|
|
Options:
|
|
-c Check if a file is already formatted. If not, print the filepath and exit with code 2.
|
|
Compared to -verify it is quicker but has a small trade-off in precision.
|
|
|
|
-diff Display the differences between the formatted source(s) and the original source(s).
|
|
This will attempt to find a working `diff` command automatically unless you
|
|
specify one with the VDIFF_TOOL environment variable.
|
|
|
|
-l List files whose formatting differs from vfmt.
|
|
|
|
-w Write result to (source) file(s) instead of to stdout.
|
|
|
|
-debug Print the kinds of encountered AST statements/expressions on stderr.
|
|
|
|
-verify Make sure the provided file is already formatted. Useful for checking code contributions
|
|
in CI for example.
|
|
|
|
Environment Variables:
|
|
VDIFF_TOOL A command-line tool that will be executed with the original file path
|
|
and a temporary formatted file path as arguments. e.g.
|
|
`VDIFF_TOOL=opendiff v fmt -diff path/to/file.v` will become:
|
|
opendiff path/to/file.v /tmp/v/vfmt_file.v
|
|
|
|
VDIFF_OPTIONS A set of command-line options to be sent immediately after the
|
|
`diff` command. e.g.
|
|
VDIFF_OPTIONS="-W 80 -y" v fmt -diff path/to/file.v /tmp/v/vfmt_file.v
|