|
|
|
@ -240,7 +240,26 @@ impl Vcs {
|
|
|
|
|
.as_table()
|
|
|
|
|
.ok_or_else(|| Error::cargo_error("Cargo_vcs.toml is not a yaml table"))?
|
|
|
|
|
.to_owned();
|
|
|
|
|
// TODO
|
|
|
|
|
|
|
|
|
|
if let Some(vcs_section) = vcs_main.get_mut("vcs") {
|
|
|
|
|
if let Some(vcs) = vcs_section.as_table_mut() {
|
|
|
|
|
if vcs.remove(profile_name).is_none() {
|
|
|
|
|
return Err(Error::project_error("Profile not found in toml file"));
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return Err(Error::project_error("VCS subsection not a table"));
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return Err(Error::project_error("VCS subsection missing in toml file"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let new_contents = toml::to_string(&vcs_main)?;
|
|
|
|
|
fs::write(vcs_path, new_contents)?;
|
|
|
|
|
|
|
|
|
|
// remove from memory list too
|
|
|
|
|
self.profiles.retain(|p| p != profile_name);
|
|
|
|
|
|
|
|
|
|
println!("Profile {} removed", profile_name.with(PROFILE_COLOR),);
|
|
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
|
|
|
|