submodule-kit 0.2.1

A CLI toolkit for managing git submodules
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::submodule::parse_gitmodules;

pub fn run() -> Result<(), String> {
    let submodules = parse_gitmodules()?;
    let col_width = submodules.iter().map(|s| s.path.len()).max().unwrap_or(0);
    for sub in &submodules {
        match &sub.branch {
            Some(branch) => println!("{:<col_width$}  {}  (branch: {branch})", sub.path, sub.url),
            None => println!("{:<col_width$}  {}", sub.path, sub.url),
        }
    }
    Ok(())
}

#[cfg(test)]
#[path = "list_tests.rs"]
mod tests;