| commit | 69891ed897c1a347ae285a4811441851ab0c8c77 | [log] [tgz] |
|---|---|---|
| author | Christopher Anderson <nvll@users.noreply.github.com> | Mon Aug 18 17:39:24 2025 -0700 |
| committer | GitHub <noreply@github.com> | Mon Aug 18 19:39:24 2025 -0500 |
| tree | e5924956f8958353288d3d2d3b7fee677df15bbe | |
| parent | 6af969c8293e2c434aad49f21530a7c145b72dc5 [diff] |
Default Config path to CWD if not specified; Update README.md (#26) dtsfmt < input.dts > output.dts now works without needing to specify a filename argument. Fixes #19
Auto formatter for device tree files.
You can install dtsfmt by running the install script which will download the latest release.
curl -LSfs https://go.mskelton.dev/dtsfmt/install | sh
Or you can build from source.
git clone --recurse-submodules https://github.com/mskelton/dtsfmt.git cd dtsfmt cargo install --path .
To run dtsfmt, simply provide a file/directory path to the dtsfmt command.
dtsfmt .
The following configuration options are available for dtsfmt. Configuration should be added to a .dtsfmtrc.toml file at the root of your project.
indent_str = " " # Optional, used for each indent level when printing. # Default is two spaces.
layout = "kinesis:adv360" # Required # Available options are ["kinesis:adv360", "sweep", "moergo:glove80"]
warn_on_unhandled_tokens = false # Optional # Used to check if an input file contains any tokens not handled by the parser/printer.
You can add a .dtsfmtignore file at the root of your project to exclude files and paths from formatting. This file follows the same rules as .gitignore.
--checkWhen you want to check if your files are formatted, you can run dtsfmt with the --check flag (or -c). This will output a human-friendly message and a list of unformatted files, if any.
dtsfmt --check .
--stdinIf passed the --stdin flag dtsfmt will read from stdin and write to stdout.
dtsfmt --stdin < input.dts > output.dts