Export licence and licence-field in environment variable #8024
Labels
A-environment-variables
Area: environment variables
C-feature-request
Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Before starting, please stop me if it is possible to access to the
licence
orlicence-field
when compiling with cargo.Describe the problem you are trying to solve
Access
licence
andlicence-field
when compiling a rust program with cargo.Describe the solution you'd like
I think it should be through environment variable to be consistent with the other exported variables (like author, version, …) of the manifest. I don't think it is necessary to be able to recursively access to the version of the dependencies, at least for a first version.
Why do I want to access them
I was trying to create a help message to my program using
clap
. The default generated help message is nice, but I noticed that it didn't included information about the licence of my software, even using the app_from_crate macro. I wanted to add it, and thus looked at the implementation of that macro. I saw that it was accessing its information (the author name, the name of the application, the version, …) from environment variables exported by cargo. I then looked at the cargo documentation and saw than neither thelicence
norlicence-field
was exported. Sincecrate.io
requires that either must be set, I think that there is a high chance to have one of those filed, and it could be useful to be able to access them.Note: Having the licence visible in the help message make it easy to export it in a man page through help2man.
Notes
I will try to look at the issue myself. I may need some guidance though.
The text was updated successfully, but these errors were encountered: