this repo has no description

Use natord in sorting

authored by knightpp.bsky.social and committed by

Tangled 266579d3 d3a94c27

+7 -4
+7 -4
src/main.zig
··· 2 2 const builtin = @import("builtin"); 3 3 const ourio = @import("ourio"); 4 4 const zeit = @import("zeit"); 5 + const natord = @import("natord.zig"); 5 6 const build_options = @import("build_options"); 6 7 7 8 const posix = std.posix; ··· 289 290 290 291 if (cmd.entries.len == 0) return; 291 292 292 - if (cmd.opts.sort_by_mod_time) { 293 - std.sort.pdq(Entry, cmd.entries, cmd.opts, Entry.lessThan); 294 - } 293 + std.sort.pdq(Entry, cmd.entries, cmd.opts, Entry.lessThan); 295 294 296 295 if (cmd.opts.reverse_sort) { 297 296 std.mem.reverse(Entry, cmd.entries); ··· 695 694 return lhs.statx.mtime.sec > rhs.statx.mtime.sec; 696 695 } 697 696 698 - return std.ascii.lessThanIgnoreCase(lhs.name, rhs.name); 697 + return natord.orderIgnoreCase(lhs.name, rhs.name) == .lt; 699 698 } 700 699 701 700 fn modeStr(self: Entry) [10]u8 { ··· 1197 1196 if (std.mem.startsWith(u8, a, "-")) return .short; 1198 1197 return .positional; 1199 1198 } 1199 + 1200 + test "ref" { 1201 + _ = natord; 1202 + }