-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
C-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`E-easyExperience: EasyExperience: EasyS-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or reviewStatus: Issue or feature is accepted, and has a team member available to help mentor or review
Description
Currently, cargo provides an environment variable CARGO_PKG_NAME
containing the name of the crate. clap
uses this in clap::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
, which clap
could use for a more accurate idea of the name of the program.
For example, given the following Cargo.toml
:
[package]
name = "cratename"
version = "0.1.0"
edition = "2018"
[[bin]]
name = "binname"
path = "src/main.rs"
[dependencies]
clap = "2.33.1"
When building src/main.rs
, cargo should set CARGO_PKG_NAME=cratename
and CARGO_BIN_NAME=binname
.
schneiderfelipe
Metadata
Metadata
Assignees
Labels
C-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`E-easyExperience: EasyExperience: EasyS-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or reviewStatus: Issue or feature is accepted, and has a team member available to help mentor or review