-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
cargo init
add option to remove default comment
#12210
Comments
cargo init
add option to remove "# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html"cargo init
add option to remove default comment
For a lot of these requests, we tend to point people to #5151. For me,
I could see the possibility of moving this to a |
ah that makes sense. was not aware of this
I feel using
Are you proposing the comment be part of |
I wasn't thinking of
Not proposing it as in saying we should but bringing it up for brainstorming and either stdout or stderr, yes. |
I have a lot of cargo aliases in my zshrc so it would not require taking any more time typing. It would be a difference between
Makes sense. Yea I feel the comment is definitely helpful to beginners (maybe?) but does the comment outweigh it poluting so many people's |
Out of curiosity. Why do people |
Until we have "cargo script", As for my frequency for writing a new crate, its probably once every other month or so? I'm honestly more likely to copy/paste than start fresh though things like automatic inheritance for |
Several use cases. I think the biggest one for me is if I have a giant workspace with many sub-libs where many depend on each other. Doing this speeds up build times afaik and even if it doesn't, it allows for CI to more easily detect changes and run a subset of all tests. Generally, I am making about one crate per day I'd say, but I am def not everyone. |
Triage: Unless there are more interests in making it a one-off flag, I am now considering it as blocked by #5151. |
@weihanglo what are your thoughts on the idea of switching the comment to a |
A However, since we have |
fix(new): Print a note, rather than a comment, for more information ### What does this PR try to resolve? For myself, I find it frustrating when tools add boilerplate that I have to remove after every use. A `note:` on the command-line is more ephemeral, helping people who need it while not interfering with those that don't. Fixes #12210 ### How should we test and review this PR? ### Additional information
Problem
While initializing a new project using
cargo init
, a comment is automatically inserted at the top of theCargo.toml
file:# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Although this is undoubtedly a helpful resource for newcomers and those unfamiliar with Cargo, for seasoned Rust developers this is not necessary and it adds an additional manual step of removing it every time a new project is initialized. Especially for developers working with automated systems or setting up multiple projects, the comment can be slightly annoying.
Proposed Solution
I propose adding an option to the
cargo init
command, let's say--no-comment
, that when used will not include the standard commented URL at the top of theCargo.toml
file. The command would look like this:cargo init --no-comment
By providing this option, developers have the flexibility to opt-in or opt-out of having the comment in their
Cargo.toml
file as per their requirements or preferences. It wouldn't impact beginners as the default behavior would still be to include the comment, unless explicitly opted out using the--no-comment
flag.Notes
I believe this minor enhancement would improve the developer experience by reducing manual interventions, particularly for those creating a large number of Rust projects or using automated tools to initialize Rust projects. This change should not affect the functionality of
cargo init
, and it would be backward compatible since it just introduces a new optional flag.Please consider this request and let me know if you need any additional information. I am willing to try to implement it. Thanks!
The text was updated successfully, but these errors were encountered: