Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sort by date #50

Open
jaromil opened this issue Jul 20, 2015 · 6 comments
Open

sort by date #50

jaromil opened this issue Jul 20, 2015 · 6 comments

Comments

@jaromil
Copy link

jaromil commented Jul 20, 2015

Would be real nice to port the equivalent of the -t flag in ls to sort by date (most recent last).

Very useful for messy home dirs like mine 😅

@k2xl
Copy link

k2xl commented Jan 17, 2018

Also suggest sorting by file size

@reduxionist
Copy link
Contributor

There's an implementation of sort by time (-s m/--sort m) and size (-s L/--sort L), including -r/--reverse direction, available at reduxionist/k/tree/feature/sort-options .

@jaromil @k2xl , if you guys could please give it a try and let me know what you think, then once it's looking good to us we can ask @supercrabtree whether he wants to add it, and then, if so, what needs to be done before issuing the PR...

Thanks for k @supercrabtree!

@jaromil
Copy link
Author

jaromil commented Feb 11, 2018

Works great on my setup. For the record, to quickly install your branch with antigen:

antigen bundle reduxionist/k --branch=feature/sort-options

@supercrabtree
Copy link
Owner

Hello,

I have been neglecting k for a little too long. This feature sounds great, if you would like to submit a PR I would happily review and merge.

Thanks

@reduxionist
Copy link
Contributor

Cool, in that case: using zsh's sort globs as the options was the cleanest approach I saw. Substituting directly made the only change to existing lines a $SORT_GLOB appendix on the glob qualifiers. I subsequently noticed the design specification in #27, however, which suggests implementing the rest of ls's arg spec as is. The backwards-compatibility is one of the main reasons k keeps winning "ls alternative of choice" for me; I've invested too much muscle memory at the console to reprogram the synapses for those options now. Objectively, the average user is unlikely to be as fluent in glob qualifiers as they are with ls arguments, so I think it's worth adding a mapping step to go from ls sort arg input to zsh glob spec commands. Unless you say otherwise, I'll submit a PR for that first and just leave the current branch hanging for now in case you prefer the simpler implementation. In any case, should I rebase on the currently active branches or stick to master?

@supercrabtree
Copy link
Owner

Hi, sounds good, please use master as a base branch :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants