Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow sorting TOML table keys #252

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Allow sorting TOML table keys #252

wants to merge 1 commit into from

Conversation

orf
Copy link

@orf orf commented Nov 8, 2024

Quite often you want to keep the overall structure of a TOML file, but sort the keys within. For example, a Cargo.toml file:

[package]
name = "xyz"

[dependencies]
tokio = {version = "1.38.0", features = ["full"]}
clap = {version = "4.5.4", features = ["derive", "env"]}

Right now this will be re-formatted as

[dependencies]
clap = {version = "4.5.4", features = ["derive", "env"]}
tokio = {version = "1.38.0", features = ["full"]}

[package]
name = "xyz"

Which is annoying - I'd like to keep the [package] table at the top, but just sort the keys (dependencies, mostly) within:

[package]
name = "xyz"

[dependencies]
clap = {version = "4.5.4", features = ["derive", "env"]}
tokio = {version = "1.38.0", features = ["full"]}

This MR adds a flag to support this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant