3 releases

0.1.2 Apr 29, 2020
0.1.1 Dec 7, 2019
0.1.0 Nov 27, 2019

#80 in Build Utils

Download history 3585/week @ 2021-01-21 3165/week @ 2021-01-28 2560/week @ 2021-02-04 3513/week @ 2021-02-11 3217/week @ 2021-02-18 2942/week @ 2021-02-25 3266/week @ 2021-03-04 2839/week @ 2021-03-11 2803/week @ 2021-03-18 3860/week @ 2021-03-25 3656/week @ 2021-04-01 3617/week @ 2021-04-08 4122/week @ 2021-04-15 4422/week @ 2021-04-22 3875/week @ 2021-04-29 1917/week @ 2021-05-06

14,661 downloads per month
Used in 20 crates (19 directly)

Apache-2.0

785KB
358 lines

git_info

crates.io Continuous Integration codecov
license Libraries.io for GitHub Documentation downloads
Built with cargo-make

Extracts git repository information.

Overview

This library main goal is to provide development/build tools such as cargo-make the needed information on the current git repository.

Usage

Simply include the library and invoke the get function to pull all info as follows:

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:

[dependencies]
git_info = "^0.1.2"

API Documentation

See full docs at: API Docs

Contributing

See contributing guide

Release History

See Changelog

License

Developed by Sagie Gur-Ari and licensed under the Apache 2 open source license.

No runtime deps