1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//! # git_info
//!
//! Extracts git repository information.
//!
//! This library main goal is to provide development/build tools such as
//! [cargo-make](https://sagiegurari.github.io/cargo-make/)the needed information on the current git repository.
//!
//! # Examples
//!
//! ```
//! fn main() {
//! let info = git_info::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![]));
//! }
//! ```
//!
//! # Installation
//! In order to use this library, just add it as a dependency:
//!
//! ```ini
//! [dependencies]
//! git_info = "*"
//! ```
//!
//! # Contributing
//! See [contributing guide](https://github.com/sagiegurari/git_info/blob/master/.github/CONTRIBUTING.md)
//!
//! # License
//! Developed by Sagie Gur-Ari and licensed under the
//! [Apache 2](https://github.com/sagiegurari/git_info/blob/master/LICENSE) open source license.
//!
doctest!;
use crateGitInfo;
/// Returns the current git repository information.
///
/// # Example
///
/// ```
/// fn main() {
/// let info = git_info::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![]));
/// }
/// ```