forked from extern/nushell
Sort ls case-insensitively by default (#1192)
This commit is contained in:
parent
60043df917
commit
147bfefd7e
@ -122,6 +122,17 @@ impl Shell for FilesystemShell {
|
|||||||
}
|
}
|
||||||
Ok(o) => o,
|
Ok(o) => o,
|
||||||
};
|
};
|
||||||
|
let mut entries = entries.collect::<Vec<Result<std::fs::DirEntry, _>>>();
|
||||||
|
entries.sort_by(|x, y| match (x, y) {
|
||||||
|
(Ok(entry1), Ok(entry2)) => entry1
|
||||||
|
.path()
|
||||||
|
.to_string_lossy()
|
||||||
|
.to_lowercase()
|
||||||
|
.cmp(&entry2.path().to_string_lossy().to_lowercase()),
|
||||||
|
(Err(_), Ok(_)) => std::cmp::Ordering::Greater,
|
||||||
|
(Ok(_), Err(_)) => std::cmp::Ordering::Greater,
|
||||||
|
_ => std::cmp::Ordering::Equal,
|
||||||
|
});
|
||||||
let stream = async_stream! {
|
let stream = async_stream! {
|
||||||
for entry in entries {
|
for entry in entries {
|
||||||
if ctrl_c.load(Ordering::SeqCst) {
|
if ctrl_c.load(Ordering::SeqCst) {
|
||||||
|
Loading…
Reference in New Issue
Block a user