(maybe_settings: Option<Settings>, path_to_repo: PathBuf, name: &str)
| 149 | } |
| 150 | |
| 151 | fn load_project(maybe_settings: Option<Settings>, path_to_repo: PathBuf, name: &str) -> Result<Project, AppError> { |
| 152 | let repo: Repository = Repository::open(path_to_repo)?; |
| 153 | let remote = repo.find_remote("origin")?; |
| 154 | let url = remote |
| 155 | .url() |
| 156 | .ok_or_else(|| AppError::UserError(format!("invalid remote origin at {:?}", repo.path())))?; |
| 157 | Ok(Project { |
| 158 | name: name.to_owned(), |
| 159 | git: url.to_owned(), |
| 160 | after_clone: maybe_settings.clone().and_then(|s| s.default_after_clone), |
| 161 | after_workon: maybe_settings.clone().and_then(|s| s.default_after_workon), |
| 162 | override_path: None, |
| 163 | additional_remotes: None, // TODO: use remotes |
| 164 | tags: maybe_settings.and_then(|s| s.default_tags), |
| 165 | bare: None, |
| 166 | trusted: false, |
| 167 | project_config_path: "default".to_string(), |
| 168 | }) |
| 169 | } |
| 170 | |
| 171 | fn write_new_config_with_projects(projects: BTreeMap<String, Project>, workspace_dir: &str) -> Result<(), AppError> { |
| 172 | let settings: config::settings::PersistedSettings = config::settings::PersistedSettings { |
no outgoing calls
no test coverage detected