mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
25 lines
538 B
Rust
25 lines
538 B
Rust
use anyhow::{Result, bail};
|
|
use tokio::fs;
|
|
use yazi_fs::must_exists;
|
|
use yazi_macro::outln;
|
|
|
|
use super::Dependency;
|
|
|
|
impl Dependency {
|
|
pub(super) async fn delete(&self) -> Result<()> {
|
|
self.header("Deleting package `{name}`")?;
|
|
|
|
let dir = self.target();
|
|
if must_exists(&dir).await {
|
|
fs::remove_dir_all(&dir).await?;
|
|
} else {
|
|
bail!(
|
|
"The package.toml file states that `{}` exists, but the directory was not found. The entry will be removed from package.toml.",
|
|
self.name
|
|
);
|
|
}
|
|
|
|
outln!("Done!")?;
|
|
Ok(())
|
|
}
|
|
}
|