Crates.io | git_info2 |
lib.rs | git_info2 |
version | 0.1.2 |
source | src |
created_at | 2024-03-10 05:13:29.373748 |
updated_at | 2024-03-10 05:13:29.373748 |
description | Extracts git repository information. |
homepage | http://github.com/wenyuzhao/git_info2 |
repository | https://github.com/wenyuzhao/git_info2.git |
max_upload_size | |
id | 1168432 |
size | 1,039,675 |
Extracts git repository information.
Forked from sagiegurari/git_info.
This library main goal is to provide development/build tools such as cargo-make the needed information on the current git repository.
Simply include the library and invoke the get function to pull all info as follows:
fn main() {
let info = git_info2::get();
println!(
"User Name: {}",
info.user_name.unwrap_or("Unknown".to_string())
);
println!(
"User Email: {}",
info.user_email.unwrap_or("Unknown".to_string())
);
println!("Dirty: {}", info.dirty.unwrap_or(false));
println!(
"Current Branch: {}",
info.current_branch.unwrap_or("Unknown".to_string())
);
println!(
"Last Commit Hash: {}",
info.head.last_commit_hash.unwrap_or("Unknown".to_string())
);
println!(
"Last Commit Hash (short): {}",
info.head
.last_commit_hash_short
.unwrap_or("Unknown".to_string())
);
println!("Config: {:#?}", info.config.unwrap());
println!("Branches: {:#?}", info.branches.unwrap_or(vec![]));
}
In order to use this library, just add it as a dependency:
[dependencies]
git_info = "^0.1.2"
See full docs at: API Docs
See Changelog
Developed by Sagie Gur-Ari and licensed under the Apache 2 open source license.