Simple tool for sorting toml files via cli or ci. It was made with Cargo.toml files in mind but is likely useful elsewhere.
cargo install --git https://github.com/Off-Narrative-Labs/toml_sorttoml-sort [files]toml-sort --check [files]This will only check ./Cargo.toml:
- uses: Off-Narrative-Labs/toml_sort@v1If you want the action to check all the TOML files, then you can use:
- uses: Off-Narrative-Labs/toml_sort@v1
with:
all: true🆕 If you want the action to check all the TOML files that match a certain name:
- uses: Off-Narrative-Labs/toml_sort@v1
with:
all: true
match: "Cargo.toml"In alternative, if you want to check only a certain set of files:
- uses: Off-Narrative-Labs/toml_sort@v1
with:
files: Cargo.toml foo/Cargo.toml bar/Cargo.tomlLook no further. This repository itself uses toml sort. Check out the toml-sort.toml file right here in the repository.
One major motivator for developing this tool is that it will sort your dependencies lexicographically while still respecting your commented in section headings.
[dependencies]
# Common ones
clap = "..."
serde = "..."
# Private things
a-secret-thing = "..."
other-unpublished-stuff = "..."
private-crate = "..."