-
Notifications
You must be signed in to change notification settings - Fork 121
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
Add options for sort order #84
Add options for sort order #84
Conversation
sort options as per ls, long args will override flags if both are used. sort order applies within directory args, not between the args themselves.
Also note that if in future k uses a shell unit-test framework, there's a test-case comparing k sort output against ls sort output that I'd be happy to adapt. I wasn't sure of the status of the javascript testing branch, so I have just left it out for now... |
is it possible to sort so dirs come first? for example right now I have this
possible with K? |
Although it's not currently implemented, I will try adding the relevant glob qualifier and see what it gets us once I'm back in front of a terminal later today... |
Support for --group-directories-first has been added, fresh-eyes testing would be appreciated. 😄 |
Worked for me! |
on restart, I got this
|
Hmmm, that's disappointing for sure! Let me look into spaceship and antigen
caching to see how it could all be related and I'll get back to you within
24 hours from now.
I'm assuming the current versions of each, and a generic enough linux, but
let me know if there's any specifics I should be aware of, environment
wise. Thanks for helping out with testing, it's always needed... 😊
|
Jonathan @reduxionist I think this is not related to "k", but just in case I reported this bug to spaceship theme If I disable "spaceship prompt" then everything works (for now I have used a different theme) |
Oh great, it didn't sound k-related to me either but given the timing I
thought it best not to make any assumptions. I actually use spaceship
myself, and even after having forced an upgrade, mine has no issue with
k-head, but I don't use antigen so probably an issue with spaceship and
antigen caching. Anyway, if anything comes back as k-related please don't
hesitate to let me know! :)
|
hi @reduxionist I have not forgotten about this, I've just been really busy for the last few weeks. I will get to it asap. Thanks again :) |
No problem, I hadn’t thought anything of it yet, just the normal ebb and flow of free-time to deadline when working on multiple projects concurrently. 😄 Actually, --group-directories-first showed me that custom sort expressions could fill our needs quite cleanly, so I’ll do by-extension next and hopefully get to by-version after that. |
Excellent stuff, sorry it took me so long to test this. |
Thrilled you liked it! Given that's the case, I will submit a PR for sort-by-extension as soon as this RSI-enforced downtime has expired. I'm guessing most appropriate to append to this one, but let me know if you would rather a new PR instead... |
Could you open a new PR instead please, this ones is a little busy already. Cheers 🙂 |
Closes #50 |
Sort options are as per ls, except:
-Version and extension sort not implemented due to lack of a direct glob sort equivalent, should they be desired in future they can be added to current implementation via either oe and lambda or o+ and function qualifiers.
-Long-form time args can be passed directly after --sort (ls requires: --sort=time --time=long-arg-name)
-Long args will override flags if both are used (ls: last-seen wins)
Sort order applies within directory args, not between the args themselves.