-
Notifications
You must be signed in to change notification settings - Fork 924
Redesign CLI #1028
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
Comments
Sounds good to me! Details: -i and -n seem connected i.e., -n without -i doesn't seem to make sense. We probably want the default to be no backups too, and have an option for leaving backups (this is a good opportunity to change that default, actually). I think --help/-h should take an optional parameter, rather than having a separate --help-for. |
The dependency is actually already set up via clap:
The error message could be a bit better, but I think it makes enough sense. I don't think it's straightforward to change how that prints in clap. There's similar conflict checking for trying to specify
Yeah, I went with a conservative default, but I agree that the default should be changed (#856).
Great idea! I'll see if I can do it; clap is sometimes a bit annoying. |
The |
One thing I forgot to mention: the default I have in mind is to print to stdout ( |
Hmm, that is safer, but also less convenient - I imagine the most common use case is reformatting in place. |
That makes sense to me. |
@nrc should a new CLI be gated on being ready to switch the default write mode, or can I just wire this all up and make PR? @marcusklaas any inputs on this? |
I think you could probably just do it. Unless you think there is anything really major blocking the default write mode. |
—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or mute the thread. |
@kamalmarhubi looking at the Can you maybe specify/show more clearly which options can be used together and which cannot be combined? E.g, I would be surprised if I can use |
It would be great to have the option edit in place while also creating backups in a separate directory for safety.. #796 |
Closing in favour of #1976 |
In the run up to 1.0, I think it would be nice to redesign the CLI with a fresh look at the current functionality. There's been a lot of features added, and some of them aren't super well exposed in the CLI.
I think the big area for improvement is in
write-mode
. Internally it makes sense as a single enum but for the user I think it is better to break it out into multiple flags. Here is a draft--help
output I threw together using clap:It also includes some features I want to implement before 1.0, namely outputting a unified diff, and formatting based on a diff (continuation of #434).
I wanted to put this out for comment before actually reworking the rustfmt binary. The code for creating the CLI is at https://github.com/kamalmarhubi/rustfmt/blob/cli-v2/src/bin/rustfmt-cli-v2.rs.
The text was updated successfully, but these errors were encountered: