From c0ce1e90573010f75a006deadc4c66c6e77ae0a7 Mon Sep 17 00:00:00 2001 From: Herlon Aguiar Date: Wed, 20 Apr 2022 06:54:37 +0200 Subject: [PATCH] nu-cli/completions: fix file completions with quotes (#5242) * nu-cli/completions: fix file completions with quotes * wrap with backticks --- crates/nu-cli/src/completions/file_completions.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/nu-cli/src/completions/file_completions.rs b/crates/nu-cli/src/completions/file_completions.rs index f6452c8c1e..f880ddc9a0 100644 --- a/crates/nu-cli/src/completions/file_completions.rs +++ b/crates/nu-cli/src/completions/file_completions.rs @@ -136,6 +136,11 @@ pub fn file_path_completion( path = format!("\'{}\'", path); } + // Fix files or folders with quotes + if path.contains('\'') || path.contains('"') { + path = format!("`{}`", path); + } + Some((span, path)) } else { None