Fix trash functionality (#3146)

For now the trash doesn't work because the trash-support flag isn't enabled in nu-engine
crate, so make it work by adding this flag.

Signed-off-by: Tw <wei.tan@intel.com>

Co-authored-by: Tw <wei.tan@intel.com>
This commit is contained in:
Tw 2021-03-09 17:34:14 +08:00 committed by GitHub
parent 49a9107e0f
commit 1dc7e00d20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 2 deletions

1
Cargo.lock generated
View File

@ -3475,6 +3475,7 @@ dependencies = [
"tempfile", "tempfile",
"term_size", "term_size",
"termcolor", "termcolor",
"trash",
"umask", "umask",
"users", "users",
] ]

View File

@ -144,7 +144,7 @@ s3 = ["nu_plugin_s3"]
selector = ["nu_plugin_selector"] selector = ["nu_plugin_selector"]
sqlite = ["nu_plugin_from_sqlite", "nu_plugin_to_sqlite"] sqlite = ["nu_plugin_from_sqlite", "nu_plugin_to_sqlite"]
start = ["nu_plugin_start"] start = ["nu_plugin_start"]
trash-support = ["nu-cli/trash-support", "nu-command/trash-support"] trash-support = ["nu-cli/trash-support", "nu-command/trash-support", "nu-engine/trash-support"]
tree = ["nu_plugin_tree"] tree = ["nu_plugin_tree"]
xpath = ["nu_plugin_xpath"] xpath = ["nu_plugin_xpath"]
#This is disabled in extra for now #This is disabled in extra for now

View File

@ -17,6 +17,7 @@ nu-stream = { version = "0.27.2", path = "../nu-stream" }
nu-value-ext = { version = "0.27.2", path = "../nu-value-ext" } nu-value-ext = { version = "0.27.2", path = "../nu-value-ext" }
nu-ansi-term = { version = "0.27.2", path = "../nu-ansi-term" } nu-ansi-term = { version = "0.27.2", path = "../nu-ansi-term" }
trash = { version = "1.3.0", optional = true }
async-recursion = "0.3.2" async-recursion = "0.3.2"
async-trait = "0.1.42" async-trait = "0.1.42"
bytes = "0.5.6" bytes = "0.5.6"
@ -52,3 +53,4 @@ nu-test-support = { version = "0.27.2", path = "../nu-test-support" }
[features] [features]
rustyline-support = [] rustyline-support = []
dirs = ["dirs-next"] dirs = ["dirs-next"]
trash-support = ["trash"]

View File

@ -609,7 +609,7 @@ impl Shell for FilesystemShell {
let result; let result;
#[cfg(feature = "trash-support")] #[cfg(feature = "trash-support")]
{ {
let rm_always_trash = config::config(Tag::unknown())? let rm_always_trash = nu_data::config::config(Tag::unknown())?
.get("rm_always_trash") .get("rm_always_trash")
.map(|val| val.is_true()) .map(|val| val.is_true())
.unwrap_or(false); .unwrap_or(false);