Crate gitmodules

Source
Expand description

This crate provides a simple regular expression based parsing library for reading the .gitmodules file of a Git repository.

§Usage

Add this to your Cargo.toml:

[dependencies]
gitmodules = "0.1"

Usage is trivial:

use std::io::BufReader;
use gitmodules::{read_gitmodules, Submodule};

fn demo() {
    let text = r#"
[submodule "foo"]
    path = "some/path"
"#
    .as_bytes();
    let text = BufReader::new(text);
    let submodules = read_gitmodules(text).unwrap();
    println!("Submodule name {}", submodules.first().unwrap().name());
}

Structs§

Submodule
Represents a Git submodule entry with its attributes.

Functions§

read_gitmodules
Read a .gitmodules file and return a vector of the configured Git submodules.