Skip to content

Export licence and licence-field in environment variable #8024

@robinmoussu

Description

@robinmoussu

Before starting, please stop me if it is possible to access to the licence or licence-field when compiling with cargo.

Describe the problem you are trying to solve

Access licence and licence-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 the licence nor licence-field was exported. Since crate.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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-environment-variablesArea: environment variablesC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions