From 54a55c406a3f761dbcf2b07f1aa2b6570c60f5de Mon Sep 17 00:00:00 2001 From: wuaoxiang Date: Mon, 12 Oct 2020 11:04:35 +0800 Subject: [PATCH] Rename get git last commit message example --- ...exec_command_get_git_last_commit_info_before_compile.rs} | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) rename examples/{basic_execute_shell_command.rs => exec_command_get_git_last_commit_info_before_compile.rs} (59%) diff --git a/examples/basic_execute_shell_command.rs b/examples/exec_command_get_git_last_commit_info_before_compile.rs similarity index 59% rename from examples/basic_execute_shell_command.rs rename to examples/exec_command_get_git_last_commit_info_before_compile.rs index 5c1d275..615577d 100644 --- a/examples/basic_execute_shell_command.rs +++ b/examples/exec_command_get_git_last_commit_info_before_compile.rs @@ -14,6 +14,10 @@ fn main() -> Result<(), Box> { .output()?; let last_commit_str = String::from_utf8(cmd_res.stdout)?; let last_commit: CommitInfo = toml::de::from_str(&last_commit_str)?; - dbg!(last_commit); + dbg!(&last_commit); + // if in build.rs, emit git_last_commit_info to compile time and retired use env! as const &st + // println!("cargo:rustc-env={}={}", "LAST_COMMIT_HASH", last_commit.hash); + // println!("cargo:rustc-env={}={}", "LAST_COMMIT_DATE", last_commit.date); + // println!("cargo:rustc-env={}={}", "LAST_COMMIT_MESSAGE", last_commit.message); Ok(()) }