git_workspace/commands/
list.rs1use crate::lockfile::Lockfile;
2use anyhow::Context;
3use std::path::Path;
4
5pub fn list(workspace: &Path, full: bool) -> anyhow::Result<()> {
7 let lockfile = Lockfile::new(workspace.join("workspace-lock.toml"));
9 let repositories = lockfile.read().context("Error reading lockfile")?;
10 let existing_repositories = repositories.iter().filter(|r| r.exists(workspace));
11 for repo in existing_repositories {
12 if full {
13 println!("{}", repo.get_path(workspace).unwrap().display());
14 } else {
15 println!("{}", repo.name());
16 }
17 }
18 Ok(())
19}