mirror of
https://github.com/nushell/nushell
synced 2025-01-15 22:54:16 +00:00
"#194 Added trash switch checked before normal rm command action"
This commit is contained in:
parent
fc1301c92d
commit
74dddc880d
1 changed files with 4 additions and 6 deletions
|
@ -944,16 +944,14 @@ impl Shell for FilesystemShell {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
if path.is_dir() {
|
|
||||||
std::fs::remove_dir_all(&path)?;
|
|
||||||
} else if path.is_file() {
|
|
||||||
if trash.item {
|
if trash.item {
|
||||||
SendToTrash::remove(path).unwrap();
|
SendToTrash::remove(path).unwrap();
|
||||||
} else {
|
} else if path.is_dir() {
|
||||||
|
std::fs::remove_dir_all(&path)?;
|
||||||
|
} else if path.is_file() {
|
||||||
std::fs::remove_file(&path)?;
|
std::fs::remove_file(&path)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
return Err(ShellError::labeled_error(
|
return Err(ShellError::labeled_error(
|
||||||
format!("Remove aborted. {:}", e.to_string()),
|
format!("Remove aborted. {:}", e.to_string()),
|
||||||
|
|
Loading…
Reference in a new issue