There is nothing fancy going on here, just leveraging existing infrastructure to help make identity removal less janky than simply deleting the directory manually
EEI2PN4NL622EJMAASO4QCJILWZPQ6DC2HSVVAUDZRFCNFGKZKUAC
use crate::identity::{
choose_identity_name, create_identity, load_full_identities, load_full_identity,
repair_id_state, FullIdentity,
use crate::{
config,
identity::{
choose_identity_name, create_identity, load_full_identities, load_full_identity,
repair_id_state, FullIdentity,
},
}
SubCommand::Remove { identity_name } => {
let identity = load_identity(identity_name).await?;
let path = config::global_config_dir()
.unwrap()
.join("identities")
.join(&identity.name);
writeln!(stderr, "Removing identity: {identity} at {path:?}")?;
if Confirm::with_theme(config::load_theme()?.as_ref())
.with_prompt("Do you wish to continue?")
.default(false)
.interact()?
{
std::fs::remove_dir_all(path)?;
writeln!(stderr, "Identity removed.")?;
} else {
bail!("User did not wish to continue");
}