-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Normal method for embedding git commit in the version? #527
Comments
You can either manually add the commit hash and just add it your version with const LATEST_COMMIT: &'static str = "abcd1234";
fn main() {
App::new("prog").version(&*format!("v1.2.3 ({})", LATEST_COMMIT));
} But what I think most people do is add a Although this isn't really anything specific to |
Thanks! I found this approach based on your suggestion:
I'm distributing a single binary, so maybe I'll write code to write code. You can change .rs files in build.rs, right? Or do you know of a project that's already doing this? Definitely not specific to clap, but I'd like to add an example when I figure it out, since it seems like a ubiquitous need. |
https://github.com/cstorey/git-build-version/ is an example of how to do this without requiring files be available at runtime. |
for now it's a good idea to use creat shadow-rs. |
Great example for integrating clap struct with shadow-rs. |
I want to be able to track down what version of the software a user is using, based on git commit ID.
I see this showing up in most Rust command-line tools, but I haven't figured out how it's done.
Any suggestions?
The text was updated successfully, but these errors were encountered: