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

Add options for sort order #84

Merged
merged 2 commits into from
Sep 9, 2018

Conversation

reduxionist
Copy link
Contributor

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.

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.
@reduxionist
Copy link
Contributor Author

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...

@dmitry-saritasa
Copy link

is it possible to sort so dirs come first? for example right now I have this

alias ls='LC_COLLATE=C ls -h --group-directories-first --color=auto'

possible with K?

@reduxionist
Copy link
Contributor Author

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...

@reduxionist
Copy link
Contributor Author

Support for --group-directories-first has been added, fresh-eyes testing would be appreciated. 😄
Pending merge to master, install via 'antigen bundle reduxionist/k --branch=add-sort-options' or equivalent.

@reduxionist reduxionist mentioned this pull request Jun 9, 2018
@dmitry-saritasa
Copy link

Worked for me!

@dmitry-saritasa
Copy link

Projects/1k/frontend on  develop [$!] 
➜ antigen update
Updating andrewferrier/fzf-z... Done. Took 0s.
Updating arialdomartini/oh-my-git... Done. Took 0s.
Updating caarlos0/zsh-pg... Done. Took 1s.
Updating denysdovhan/spaceship-zsh-theme... Done. Took 0s.
Updating fabiokiatkowski/exercism.plugin.zsh... Done. Took 0s.
Updating gerges/oh-my-zsh-jira-plus... Done. Took 1s.
Updating horosgrisa/zsh-dropbox... Done. Took 0s.
Updating johnhamelink/env-zsh... Done. Took 0s.
Updating marzocchi/zsh-notify... Done. Took 1s.
Updating molovo/tipz... Done. Took 0s.
Updating robbyrussell/oh-my-zsh... Done. Took 1s.
Updating robertzk/send.zsh... Done. Took 0s.
Updating srijanshetty/zsh-pip-completion... Done. Took 0s.
Updating supercrabtree/k... Done. Took 1s.
Updating svenXY/timewarrior... Done. Took 0s.
Updating uvaes/fzf-marks... Done. Took 0s.
Updating valentinocossar/sublime... Done. Took 1s.
Updating zdharma/zsh-diff-so-fancy... Done. Took 0s.
Updating zsh-users/zsh-history-substring-search... Done. Took 0s.
Updating zsh-users/zsh-syntax-highlighting... Done. Took 1s.
Deprecated in favor of antigen reset.
rm: remove regular file '/home/dmitry/.antigen/.cache/.zcache-payload'? y
rm: remove regular file '/home/dmitry/.antigen/.cache/.zcache-bundles'? y
Done. Please open a new shell to see the changes.
Projects/1k/frontend on  develop [$!] 
➜ antigen update
Updating andrewferrier/fzf-z... Done. Took 0s.
Updating arialdomartini/oh-my-git... Done. Took 0s.
Updating caarlos0/zsh-pg... Done. Took 1s.
Updating denysdovhan/spaceship-zsh-theme... Done. Took 0s.
Updating fabiokiatkowski/exercism.plugin.zsh... Done. Took 0s.
Updating gerges/oh-my-zsh-jira-plus... Done. Took 1s.
Updating horosgrisa/zsh-dropbox... Done. Took 0s.
Updating johnhamelink/env-zsh... Done. Took 0s.
Updating marzocchi/zsh-notify... Done. Took 1s.
Updating molovo/tipz... Done. Took 0s.
Updating robbyrussell/oh-my-zsh... Done. Took 1s.
Updating robertzk/send.zsh... Done. Took 0s.
Updating srijanshetty/zsh-pip-completion... Done. Took 0s.
Updating supercrabtree/k... Done. Took 1s.
Updating svenXY/timewarrior... Done. Took 0s.
Updating uvaes/fzf-marks... Done. Took 0s.
Updating valentinocossar/sublime... Done. Took 1s.
Updating zdharma/zsh-diff-so-fancy... Done. Took 0s.
Updating zsh-users/zsh-history-substring-search... Done. Took 0s.
Updating zsh-users/zsh-syntax-highlighting... Done. Took 1s.
Deprecated in favor of antigen reset.
rm: remove regular file '/home/dmitry/.antigen/.cache/.zcache-payload'? y
rm: remove regular file '/home/dmitry/.antigen/.cache/.zcache-bundles'? y
Done. Please open a new shell to see the changes.

on restart, I got this

home/dmitry/.antigen/.cache/.zcache-payload:source:5420: no such file or directory: /home/dmitry/.antigen/.cache/lib/utils.zsh
/home/dmitry/.antigen/.cache/.zcache-payload:source:5423: no such file or directory: /home/dmitry/.antigen/.cache/lib/hooks.zsh
/home/dmitry/.antigen/.cache/.zcache-payload:source:5426: no such file or directory: /home/dmitry/.antigen/.cache/lib/section.zsh
zsh: spaceship::union: command not found...
zsh: spaceship::deprecated: command not found...
zsh: spaceship::deprecated: command not found...
zsh: spaceship::deprecated: command not found...
zsh: spaceship::deprecated: command not found...
zsh: spaceship::deprecated: command not found...
zsh: spaceship_exec_time_precmd_hook: function definition file not found        
zsh: spaceship_exec_vcs_info_precmd_hook: function definition file not found
zsh: spaceship::compose_prompt: command not found...
zsh: spaceship::compose_prompt: command not found...
zsh: spaceship::compose_prompt: command not found...
zsh: spaceship::compose_prompt: command not found...
zsh: spaceship::compose_prompt: command not found...
zsh: spaceship::compose_prompt: command not found...
zsh: spaceship::compose_prompt: command not found...

@reduxionist
Copy link
Contributor Author

reduxionist commented Jun 13, 2018 via email

@dmitry-saritasa
Copy link

Jonathan @reduxionist I think this is not related to "k", but just in case I reported this bug to spaceship theme
spaceship-prompt/spaceship-prompt#469

If I disable "spaceship prompt" then everything works (for now I have used a different theme)

@reduxionist
Copy link
Contributor Author

reduxionist commented Jun 13, 2018 via email

@supercrabtree
Copy link
Owner

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 :)

@reduxionist
Copy link
Contributor Author

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.
Guidance on a testing-framework, however, would be of benefit the earlier it’s available. If you don't intend to resume with the javascript branch, then the language future contributors are guaranteed to be comfortable in now has viable options in every flavor of testing you might prefer: from the dominant xunit gang, through bdd/rspec, lightweight/micro, oop, to "UNIX-philosophy" and including even purpose-built for zsh itself frameworks. While it’s not quite the java testing ecosystem, I’m still impressed that even stubbing libraries are available from it now....

@supercrabtree
Copy link
Owner

Excellent stuff, sorry it took me so long to test this.

@supercrabtree supercrabtree merged commit e2bfbaf into supercrabtree:master Sep 9, 2018
@reduxionist reduxionist deleted the add-sort-options branch September 21, 2018 21:34
@reduxionist
Copy link
Contributor Author

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...

@supercrabtree
Copy link
Owner

Could you open a new PR instead please, this ones is a little busy already. Cheers 🙂

@reduxionist
Copy link
Contributor Author

Closes #50

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

Successfully merging this pull request may close these issues.

None yet

4 participants