|
|
@ -23,17 +23,21 @@ impl Builtin for Ls { |
|
|
|
continue;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
let metadata = match metadata(entry.path()) {
|
|
|
|
Ok(m) => m,
|
|
|
|
Err(_) => {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
let file_name = entry.file_name().to_string_lossy().to_string();
|
|
|
|
let mut file_type = "unknown";
|
|
|
|
let tmp = entry.file_type().unwrap();
|
|
|
|
if tmp.is_dir() {
|
|
|
|
if metadata.file_type().is_dir() {
|
|
|
|
file_type = "dir"
|
|
|
|
} else if tmp.is_file() {
|
|
|
|
} else if metadata.file_type().is_file() {
|
|
|
|
file_type = "file"
|
|
|
|
} else if tmp.is_symlink() {
|
|
|
|
} else if metadata.file_type().is_symlink() {
|
|
|
|
file_type = "link"
|
|
|
|
}
|
|
|
|
let metadata = metadata(entry.path()).unwrap();
|
|
|
|
println!(
|
|
|
|
"{:} | {:4} | {}",
|
|
|
|
right_padding(&file_name, 16),
|
|
|
|