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, levenshtein_distance, Span,
}; };
use reedline::Suggestion; use reedline::Suggestion;
use std::fs;
use std::path::Path; use std::path::Path;
use std::sync::Arc; use std::sync::Arc;
@ -120,7 +121,7 @@ pub fn directory_completion(
return result return result
.filter_map(|entry| { .filter_map(|entry| {
entry.ok().and_then(|entry| { entry.ok().and_then(|entry| {
if let Ok(metadata) = entry.metadata() { if let Ok(metadata) = fs::metadata(entry.path()) {
if metadata.is_dir() { if metadata.is_dir() {
let mut file_name = entry.file_name().to_string_lossy().into_owned(); let mut file_name = entry.file_name().to_string_lossy().into_owned();
if matches(&partial, &file_name, match_algorithm) { if matches(&partial, &file_name, match_algorithm) {