It should be possible to set an option from the CLI, e.g.,
$ rustfmt --format_doc_comments=true
I was also just looking for this feature!
From @shepmaster on discord: for Linux users, you can do the following "hack":
rustfmt file.rs --config-path =(echo normalize_doc_attributes = true)
I'm unfamiliar with the syntax you show; I used Bash's process substitution:
cargo +nightly fmt -- --config-path <(echo "format_doc_comments=true")
sorry, habit: that syntax is on zsh http://zsh.sourceforge.net/Doc/Release/Expansion.html#Process-Substitution. Thanks @shepmaster for spotting this.
Hi @shepmaster @scampi I would like to contribute and tackle this issue. It's my first time contributing to the project, could you provide me with a little guidance on how to get started on this?
@dannomayer Thanks for giving this a try!
I would add the logic to src/bin/main.rs:
--config=rustfmt.toml fileThe module config contains everything that pertains to the Config struct.
Don't hesitate to open a WIP PR to get early feedbacks.
@Bruflot Thanks for giving this a try, looks good to me. I left some comments to the single option commit. Just open a PR in draft mode if you want to get early feedbacks ;o)
Hi @scampi , could you please assign me to this issue? I'll give it a try in a day or so.
And a question:
--config invocations. Do we allow them? If so, what if some values are passed multiple times, either within one --config invocation or not? I'd suggest "later overrides former" policy.@CreepySkeleton Thank you for your interest in contributing to rustfmt! I will assign you to this issue.
multiple --config invocations. Do we allow them? If so, what if some values are passed multiple times, either within one --config invocation or not? I'd suggest "later overrides former" policy.
I think that we can allow multiple --config and I agree that the later should override the values when there are multiple key-value pairs with the same key.