MCPcopy Create free account
hub / github.com/brocode/fw / determine_projects

Function determine_projects

src/setup/mod.rs:66–92  ·  view source on GitHub ↗
(path: PathBuf)

Source from the content-addressed store, hash-verified

64}
65
66fn determine_projects(path: PathBuf) -> Result<BTreeMap<String, Project>, AppError> {
67 let workspace_path = path.clone();
68
69 let project_entries: Vec<fs::DirEntry> = fs::read_dir(path).and_then(Iterator::collect).map_err(AppError::Io)?;
70
71 let mut projects: BTreeMap<String, Project> = BTreeMap::new();
72 for entry in project_entries {
73 let path = entry.path();
74 if path.is_dir() {
75 match entry.file_name().into_string() {
76 Ok(name) => {
77 let mut path_to_repo = workspace_path.clone();
78 path_to_repo.push(&name);
79 match load_project(None, path_to_repo, &name) {
80 Ok(project) => {
81 projects.insert(project.name.clone(), project);
82 }
83 Err(e) => eprintln!("Error while importing folder. Skipping it. {}", e),
84 }
85 }
86 Err(_) => eprintln!("Failed to parse directory name as unicode. Skipping it."),
87 }
88 }
89 }
90
91 Ok(projects)
92}
93
94pub fn org_import(maybe_config: Result<Config, AppError>, org_name: &str, include_archived: bool) -> Result<(), AppError> {
95 let current_config = maybe_config?;

Callers

nothing calls this directly

Calls 1

load_projectFunction · 0.85

Tested by

no test coverage detected