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

Feature request: normalize tables #37

Open
ModProg opened this issue Feb 10, 2022 · 3 comments
Open

Feature request: normalize tables #37

ModProg opened this issue Feb 10, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@ModProg
Copy link

ModProg commented Feb 10, 2022

I'd like an option, turning inline tables into normal tables, and vice versa.

So from

[dependencies]
serde = {version = "1", features = ["derive"]}

[dependencies.log]
version = "0.4"
features = ["std"]

to

[dependencies]
serde = {version = "1", features = ["derive"]}
log = { version = "0.4", features = ["std"]}

or

[dependencies.serde]
version = "1" 
features = ["derive"]

[dependencies.log]
version = "0.4"
features = ["std"]

Depending on the flag / config given.

@DevinR528
Copy link
Owner

I would be fine with adding this with a command-line flag, I think that would be a cool addition! I don't have a whole lot of extra time but would be able to help if you were interested in opening a PR, otherwise, it might be a while till I got to it?

A question, would you specify the names like cargo sort --merge log,serde or would the merge/expand inline tables be a general thing and work on any inline table or any table with a dot in the header of dependency, dev-dep, etc?

@ModProg
Copy link
Author

ModProg commented Feb 11, 2022

I would say something like a max_width, either in characters or in fields. like values below get merged into one line and those above get promoted to real tables.

And for the extremes just set it to 0 or usize::MAX.

@DevinR528 DevinR528 added the enhancement New feature or request label Feb 17, 2022
@DevinR528
Copy link
Owner

I guess this isn't really outside the scope since cargo sort has to know all about formatting because anytime you reorder something you also have to format.

I will have time to work on these few issues someday soonish hopefully.

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

No branches or pull requests

2 participants