-
Notifications
You must be signed in to change notification settings - Fork 904
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
Update documentation on stdin input with rustfmt #4336
Comments
I just started working on this, do you want me to leave it for a new contributor? |
No worries! Feel free to work on this or any issue really, I'm just trying to be more mindful about tagging ones that even net-new users could potentially work on |
I would like to give the note part a shot. Once I figured out how to make pull requests form fork to forked from. |
Regarding examples, I personally wouldn't even go that far perhaps. Regarding what I suggested, it may be still not foolproof. The tricky parts is that although most options may need As a side note for the designe choice regarding I closed my previous pull request, this needs a notch more of thought. But I've got an idea. |
I think all users of rustfmt have the same goal: just to get the app to format some code. How to tell rustfmt to do this feels secondary to that goal, and while it is important, IMO being able to provide good documentation for the app and maintaining compatibility with existing usages is much more important. UX on the granularity of CLI flags and default inputs expected by a program can be disagreed on by reasonable people; I think it is unlikely a productive conclusion would be made of this. imho we should focus on where we already are and find ways to better support information discovery. |
Current Readme:
Take 2. Mind the lack of "Rustfmt can also read data from stdin.", since it is later mentioned.
For the record, it's bugging me that But, somebody must correct me if that's not even true, that all other options need The new for |
This would be a good issue to file upstream to structopt. The relevant code is here: Lines 130 to 132 in 27b54e9
Imo |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@ayazhafiz - let me know if you're still interested in working on this one and if so i'll drop the help-wanted label. Feel free to revamp the running section altogether, as it's a bit outdated with rustfmt 2.0 anyway (for example I'd like to lead with As far as the inline help text, understood we may be limited in some ways around what's available via structopt, but I have to imagine we can make some improvements. Even something as marginal as changing |
Yeah I can take this, will do in the next day or so.
…________________________________
От: Caleb Cartwright <notifications@github.com>
Отправлено: Tuesday, July 21, 2020 1:36:24 PM
Кому: rust-lang/rustfmt <rustfmt@noreply.github.com>
Копия: hafiz <ayaz.hafiz.1@gmail.com>; Mention <mention@noreply.github.com>
Тема: Re: [rust-lang/rustfmt] Update documentation on stdin input with rustfmt (#4336)
@ayazhafiz<https://github.com/ayazhafiz> - let me know if you're still interested in working on this one and if so i'll drop the help-wanted label. Feel free to revamp the running section altogether, as it's a bit outdated with rustfmt 2.0 anyway (for example --recursive flag would be required to format submods).
I'd like to lead with cargo fmt as that's the most common use case and easiest usage pattern for folks, and then call out the files & stdin options with rustfmt itself. There's a portion of rustfmt users that make use of the stdin feature pretty extensively, but we can certainly do a better job broadcasting that feature and use cases.
As far as the inline help text, understood we may be limited in some ways around what's available via structopt, but I have to imagine we can make some improvements. Even something as marginal as changing Format Rust code to something like Format Rust code in files or from stdin would be helpful.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#4336 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AE6GL6XQR5UUMQXKDRTYBZLR4XN2RANCNFSM4PDA4D5A>.
|
Awesome, thank you! |
This commit includes changes to the readme, cargo-fmt, and rustfmt - Readme - rearrange sections to an order I believe is a more natural progression (this is opinionated, open to suggestions) - add a TOC (I can add a CI test to ensure it's up to date, lmk what you think) - cargo-fmt - link to config options - rustfmt - elaborate on operation with files/stdin - include examples - link to config options Closes rust-lang#4336
@calebcartwright we should reopen this until the follow up PRs go in? |
Yeah good catch. I thought the PR description was update to remove the keyword but presumably some commit message had it in there |
This time we try to clean up a lot of the README, after its structure was reorged in rust-lang#4345. cc @calebcartwright Closes rust-lang#4336
* Update documentation, round 2 This time we try to clean up a lot of the README, after its structure was reorged in #4345. cc @calebcartwright Closes #4336 * fixup! Update documentation, round 2
rustfmt supports formatting files as well as rust code provided via stdin. However, the readme documentation and
rustfmt --help
description text could use some updates to make this explicitly clear, as well as call out that if you runrustfmt
without specifying any files that rustfmt will be waiting for input from stdin.This could be addressed by updating the running section in the readme, with more details and ideally some examples (e.g.
echo "fn main ( ) { }" | rustfmt
with stdout output from rustfmt), as well as updating the structopt info to provide more detail when users runrustfmt --help
.rustfmt/src/rustfmt/main.rs
Lines 44 to 47 in 27b54e9
https://docs.rs/structopt/0.3.15/structopt/#how-to-derivestructopt
If anyone is interested in working on this please leave a comment or ping us on Discord!
The text was updated successfully, but these errors were encountered: