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

Function remove_remote

src/project/mod.rs:94–106  ·  view source on GitHub ↗
(maybe_config: Result<Config, AppError>, name: &str, remote_name: String)

Source from the content-addressed store, hash-verified

92}
93
94pub 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
108pub fn update_entry(
109 maybe_config: Result<Config, AppError>,

Callers 1

_mainFunction · 0.85

Calls 1

write_projectFunction · 0.85

Tested by

no test coverage detected