make cd recornize symblic link (#5454)

This commit is contained in:
WindSoilder 2022-05-06 23:39:48 +08:00 committed by GitHub
parent 768ff47d28
commit e14e60dd2c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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) {