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

Function setup

src/setup/mod.rs:46–64  ·  view source on GitHub ↗
(workspace_dir: &str)

Source from the content-addressed store, hash-verified

44}
45
46pub fn setup(workspace_dir: &str) -> Result<(), AppError> {
47 let path = PathBuf::from(workspace_dir);
48 let maybe_path = if path.exists() {
49 Ok(path)
50 } else {
51 Err(AppError::UserError(format!("Given workspace path {} does not exist", workspace_dir)))
52 };
53
54 maybe_path
55 .and_then(|path| {
56 if path.is_absolute() {
57 Ok(path)
58 } else {
59 Err(AppError::UserError(format!("Workspace path {} needs to be absolute", workspace_dir)))
60 }
61 })
62 .and_then(determine_projects)
63 .and_then(|projects| write_new_config_with_projects(projects, workspace_dir))
64}
65
66fn determine_projects(path: PathBuf) -> Result<BTreeMap<String, Project>, AppError> {
67 let workspace_path = path.clone();

Callers 1

_mainFunction · 0.85

Calls 1

Tested by

no test coverage detected