(maybe_config: Result<Config, AppError>, name: &str, remote_name: String)
| 92 | } |
| 93 | |
| 94 | pub fn remove_remote(maybe_config: Result<Config, AppError>, name: &str, remote_name: String) -> Result<(), AppError> { |
| 95 | let config: Config = maybe_config?; |
| 96 | if !config.projects.contains_key(name) { |
| 97 | return Err(AppError::UserError(format!("Project key {} does not exists. Can not update.", name))); |
| 98 | } |
| 99 | let mut project_config: Project = config.projects.get(name).expect("Already checked in the if above").clone(); |
| 100 | let additional_remotes = project_config.additional_remotes.unwrap_or_default(); |
| 101 | let additional_remotes = additional_remotes.into_iter().filter(|r| r.name != remote_name).collect(); |
| 102 | project_config.additional_remotes = Some(additional_remotes); |
| 103 | |
| 104 | config::write_project(&project_config)?; |
| 105 | Ok(()) |
| 106 | } |
| 107 | |
| 108 | pub fn update_entry( |
| 109 | maybe_config: Result<Config, AppError>, |
no test coverage detected