-
Notifications
You must be signed in to change notification settings - Fork 2.9k
cargo new should allow me to set the default package version #16948
Copy link
Copy link
Open
Labels
A-configurationArea: cargo config files and env varsArea: cargo config files and env varsC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-initCommand-newS-triageStatus: This issue is waiting on initial triage.Status: This issue is waiting on initial triage.
Metadata
Metadata
Assignees
Labels
A-configurationArea: cargo config files and env varsArea: cargo config files and env varsC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-initCommand-newS-triageStatus: This issue is waiting on initial triage.Status: This issue is waiting on initial triage.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Problem
Currently, if I run
cargo new mypkgit createsCargo.tomlwith version set to0.1.0. This appears to be because we hardcode this version in https://github.com/rust-lang/cargo/blob/master/src/cargo/ops/cargo_new.rs#L801. I would like to be able to configure cargo to use a different default version.Proposed Solution
Add a field to the cargo configuration file
If present,
cargo new mypkgwould be created with the version set to1.0.0. Otherwise, we would default to creating packages at0.1.0.Notes
Hopefully, we can just ignore questions like "Should we allow the user to set the initial version with a flag? Or an env var?" My feeling is: set-by-config is the only thing I want in terms of an actuall feature I want to use, as opposed to something to be added for completeness/consistency. If for some reason I really need to programmatically create packages with a specified version, I can hack something together with project-local config files.