postmodern / chruby

Changes the current Ruby
MIT License
2.85k stars 190 forks source link

Use bash globbing to set RUBIES #424

Closed ktchen14 closed 2 years ago

ktchen14 commented 4 years ago

This is an alternative to #406. It fixes #413 and uses bash native functionality instead of ls at all. The impetus for this change is that an alias to ls breaks chruby. Specifically in my case I have:

alias ls=exa

Which doesn't have a -A flag.

havenwood commented 4 years ago

A shell-based solution would need to be portable to zsh since chruby support bash and zsh.

For the moment, you can source chruby before you set your exa alias for a fix.

havenwood commented 4 years ago

See #278 for a stab at numeric sorting. We discussed the possibility of creating a shell library for portable numeric sorting, since it's an annoying gap. I'm for switching to a portable shell solution but think it should fix the numeric sorting issue too.

ktchen14 commented 4 years ago

@havenwood I just pushed a new version of the code which should be zsh compatible. I don't really use zsh but from a careful reading of the documentation this is the simplest version that I think works for both bash and zsh.

ktchen14 commented 4 years ago

Also this doesn't handle ordering. That looks hard to do in a portable fashion and I believe is out of scope for this PR.

ktchen14 commented 4 years ago

Ping. Please let me know if there are any changes I should make or if I should close this PR. Thanks!