Add new formatting control character to cargo tree
for the library name
.
#9659
Labels
C-feature-request
Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Problem
When examining dependencies with
cargo tree
, there is no way to print the libraryname
, which can be different from the packagename
, as seen here, in piston2d-graphics' manifest. A programmer using this in her own code would go:but
graphics
would not appear in the output ofcargo tree
, leading to confusion.Proposed solution
I propose adding a new formatting control character,
{n}
, that would print out the libraryname
, which defaults to the package name and of which there can be only one per package.If I had a project that declared piston2d-graphics as a dependency in its Cargo.toml, and I called cargo tree like
cargo tree --format '{p} ({n})'
, I would expect the output for the line that corresponded to piston2d-graphics to look like:Notes
The currently supported formatting characters are:
{p} — The package name.
{l} — The package license.
{r} — The package repository URL.
{f} — Comma-separated list of package features that are enabled.
If
{l}
were not already used for the license, I would propose that as the new control character.The text was updated successfully, but these errors were encountered: