Environment variable to identify the binary name #8251
Labels
C-feature-request
Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
E-easy
Experience: Easy
S-accepted
Status: Issue or feature is accepted, and has a team member available to help mentor or review
Currently, cargo provides an environment variable
CARGO_PKG_NAME
containing the name of the crate.clap
uses this inclap::crate_name
to get the name of the crate to use as the program name.However, this doesn't work for crates that build more than one binary. I'd like to have an environment variable specifying the name of the binary being built, such as
CARGO_BIN_NAME
, whichclap
could use for a more accurate idea of the name of the program.For example, given the following
Cargo.toml
:When building
src/main.rs
, cargo should setCARGO_PKG_NAME=cratename
andCARGO_BIN_NAME=binname
.The text was updated successfully, but these errors were encountered: