Repository navigation
feat(ls): sort entries by modification time with -t - #1301
Open
Haasini-kudala wants to merge 1 commit into
Open
Haasini-kudala wants to merge 1 commit into
Haasini-kudala wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1297.
Add
ls('-t', ...)to return entries in descending modification-time order, with names breaking ties. This also works with explicit paths, globs,-l,-d,-A, and-L. With-R, the full returned list is sorted, as documented in the source and regenerated README.Collect timestamps alongside each entry using its actual path, so sorting also works when different directories contain the same relative filename. Use
mtimeMsto retain sub-millisecond precision, and keep the existing output types and ordering when-tis absent.Added 10 regression tests covering these combinations, ties, timestamp precision, and symlinks. The initial nine cases failed before the implementation because
-twas unrecognized.Validation on macOS with Node 24.22.3:
npm run test-with-coverage: 667 passed, 6 existing skips.npm run lint: passed.npm run check-node-support: passed.npm run gendocs: regenerated the README.