Accept directory as manifest-path (default file name) or accept file not named Cargo.toml #7856
Labels
A-cli
Area: Command-line interface, option parsing, etc.
C-feature-request
Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
S-needs-design
Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.
Current behaviour
I think there is some behaviour of
Cargo
and the--manifest-path
option that I think is a little inconsistent.When no manifest path is used (e.g.
cargo build
) it chosesCargo.toml
.i.e. it has the notion of
Cargo.toml
as the default cargo manifest file, when in the CWD.i.e. same is true when workspace refer to sub-crates, it selects 'Cargo.toml' in the named sub-folder
When you specify a manifest path to a directory...
...then Cargo does not try to use the default file name (
Cargo.toml
) in the specified directory, it forces you to specify the full path including the file name.I think that could make sense if there could be some confusion as to what file to use in said directory, but in fact you cannot specify a file that is not called
Cargo.toml
:I propose:
You can specify a manifest path to a directory and then
cargo
will try to use the fileCargo.toml
in that directory if it is present.Allow manifest-path to specify a file that is NOT called
Cargo.toml
.I happen to have a project that needs this (long story), but overall I am unaware of issues with the use of other filenames (when specified explicitly as part of
--manifest-path
option. Trying other default filename would be problematic and a bad idea). Please let me know of any in comments.Acceptance criteria
All current forms would continue to work
cargo build
cargo build --manifest-path=subdir/Cargo.toml
And other forms that currently give an error would start to work:
cargo build --manifest-path my_manifest.toml
cargo build --manifest-path ./my_manifest.toml
cargo build --manifest-path .
(not very useful, but a valid directory)cargo build --manifest-path subdir
cargo build --manifest-path subdir/
cargo build --manifest-path subdir/my_manifest.toml
If the proposal seems acceptable, I would be willing to take a stab at implementing it (having never looked at cargo code and being full of innocence and optimism... :-) )
The text was updated successfully, but these errors were encountered: