ls but with io_uring

Use string length for sorting #9

closed
opened by knightpp.bsky.social targeting main from knightpp.bsky.social/lsr: fix-sorting
0
by knightpp.bsky.social 3 comments
expand 2 commits
Sort always
Include string length into sorting

This doesn't seem like the right approach... I don't see any other version of ls that sorts by string length. The output I get in the lsr directory with this patch is:

~/r/t/r/lsr main โ†‘2 ๏” zig build run -- -al
drwxr-xr-x tim tim      -  16 May 15:50 ๓ฐ‰‹ .
drwxr-xr-x tim tim      -  15 May 14:32 ๓ฐ‰‹ ..
drwxr-xr-x tim tim      -  16 May  6:08 ๓ฐ‰‹ nix
drwxr-xr-x tim tim      -  18 May  9:44 ๓ฐ‰‹ src
drwxr-xr-x tim tim      -  18 May  9:44 ๓ฐ‰‹ .git
drwxr-xr-x tim tim      -  14 May 11:06 ๓ฐ‰‹ docs
drwxr-xr-x tim tim      -   7 May  6:19 ๓ฐ‰‹ zig-out
drwxr-xr-x tim tim      -   6 May  8:27 ๓ฐ‰‹ .zig-cache
-rw-r--r-- tim tim  1.0 KB  4 May 17:43 ๓ฐˆค LICENSE
-rw-r--r-- tim tim  2.9 KB  7 May  6:42 ๎šฉ build.zig
-rw-r--r-- tim tim  1.3 KB  6 May  6:20 ๓ฑ„… flake.nix
-rw-r--r-- tim tim  3.0 KB 16 May 15:50 ๎˜‰ README.md
-rw-r--r-- tim tim   29 B   6 May  6:20 ๓ฐˆค .gitignore
-rw-r--r-- tim tim  1.5 KB  6 May  6:20 ๓ฑ„… flake.lock
-rw-r--r-- tim tim  950 B  14 May 11:00 ๎šฉ build.zig.zon
-rw-r--r-- tim tim 60.0 KB  5 May 10:35 ๏‡… screenshot.png

Hmm. Eza prints what I expect in this case. Looking at the code https://github.com/eza-community/eza/blob/e04bdba044c4ef43e77a2c778fa604aeb49dce84/src/fs/filter.rs#L259

They use some smart sorting method.

You are right, my patch breaks ordering. I'll close this PR for now.

closed without merging
sign up or login to add to the discussion
Labels

None yet.

Participants 2
AT URI
at://did:plc:3zsjx5jgd6dbi4orckspsqiq/sh.tangled.repo.pull/3lpgpgbsf4e22