From e14e60dd2cad1f2f428f6eec35dee46d7cc9326f Mon Sep 17 00:00:00 2001 From: WindSoilder Date: Fri, 6 May 2022 23:39:48 +0800 Subject: [PATCH] make cd recornize symblic link (#5454) --- crates/nu-cli/src/completions/directory_completions.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/nu-cli/src/completions/directory_completions.rs b/crates/nu-cli/src/completions/directory_completions.rs index 4efc2dd955..c04e910ce5 100644 --- a/crates/nu-cli/src/completions/directory_completions.rs +++ b/crates/nu-cli/src/completions/directory_completions.rs @@ -4,6 +4,7 @@ use nu_protocol::{ levenshtein_distance, Span, }; use reedline::Suggestion; +use std::fs; use std::path::Path; use std::sync::Arc; @@ -120,7 +121,7 @@ pub fn directory_completion( return result .filter_map(|entry| { entry.ok().and_then(|entry| { - if let Ok(metadata) = entry.metadata() { + if let Ok(metadata) = fs::metadata(entry.path()) { if metadata.is_dir() { let mut file_name = entry.file_name().to_string_lossy().into_owned(); if matches(&partial, &file_name, match_algorithm) {