Important
nufmt
is in a pre-alpha state, not suitable for usage at all.
Do not use in productive nushell scripts!
Some of the outputs deletes comments, break the functionality of the script or doesn't format at all.
To use the formatter, test it first and use it with caution!.
cargo install --git https://github.com/nushell/nufmt
- Using our bundled Nix flake.
If you still want to use it, or test it to contribute, this is the --help
.
nufmt [OPTIONS] [FILES] ...
Files
are a list of files. It cannot be used combined with --stdin
.
You can format many files with one command!. For example:
nufmt my-file1.nu my-file2.nu my-file3.nu
-
--dry-run
if you just want to check files without formatting them. It cannot be combined with stdin. -
-s
or--stdin
formats fromstdin
, returns tostdout
as a String. It cannot be used combined withfiles
. -
-c
or--config
pass the config file path. Sample:nufmt <files> --config my-config.json
or
nufmt --stdin <string> --config my-stdin-config.json
-
-h
or--help
show help and exit -
-v
or--version
prints the version and exit
nufmt
exits with the following status codes:
- 0: if
nufmt
terminates successfully, regardless of whether files or stdin were formatted. - 1 (only used in check mode):
nufmt
terminates successfully and at least one file would be formatted if check mode was off. - 2:
nufmt
terminates abnormally due to invalid configuration, invalid CLI options, or an internal error.
We have a contribution guide. If you still have doubts, you can mention @AucaCoyan
who is active on this repo.