- marked as enhancement
Fish Shell support
Fish shell badly needs a proper ruby manager. Most current solutions are half-baked jury-rigged solutions based on rvm/rbenv/chruby etc. They are all highly brittle, don't work well with third party tools such as editors etc.
Comments (9)
-
repo owner -
repo owner Need a fish specific version of this shell wrapper and internal changes to
uru_rt
.This function will need updating and a new fishScript var.
And what about fish running in msys2 on windows?
pacman
isn't included in the msys2-basedgit-bash
so this scenario is low priority. -
repo owner Initial fish support is working except for this one showstopper issue.
Fish returns error (i.e. -
$status == 1
) for the firstset -x PATH
in~/.uru/uru_lackee.fish
because the/_U1_
and/_U2_
canaries are nonexistent dirs.# autogenerated by uru set -x PATH /_U1_ /home/jon/.gem/ruby/2.3.0/bin /home/jon/.rubies/ruby-2.3.0/bin /_U2_ /opt/git/bin /home/jon/godev/mygo/bin /usr/local/go/bin /home/jon/bin /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games /usr/local/games ^/dev/null set -x GEM_HOME /home/jon/.gem/ruby/2.3.0
Oddly, fish warns the user and sets PATH even though it returns error. This error appears to prevent the second
set -x GEM_HOME
from running.Need a clean way of having fish ignore the error code from the first set so that
GEM_HOME
can be set when a ruby is activated.UPDATE: when run from an interactive shell via
source uru_lackee.fish
, bothPATH
andGEM_HOME
are set properly. Why is it not working (i.ePATH
set, butGEM_HOME
not set) when sourced from within theuru
function? TODO...look into function scoping issues with setting a new envar (GEM_HOME
) vs. updating an existing envar (PATH
). -
You might want to take a look at https://github.com/JeanMertz/chruby-fish
-
repo owner Using
set -gx ...
solves the missingGEM_HOME
issue.uru
andfish
now appear to play well together.Try the new
rc2
downloads and let me know how things work.After putting
uru_rt
on yourPATH
, installuru
in fish viaecho 'uru_rt admin install | source' >> ~/.config/fish/config.fish
/home/jon $ functions uru function uru --description 'Manage your ruby versions' set -x URU_INVOKER fish # uru_rt must already be on PATH uru_rt $argv if test -d "$URU_HOME" -a -f "$URU_HOME/uru_lackee.fish" source "$URU_HOME/uru_lackee.fish" else if test -f "$HOME/.uru/uru_lackee.fish" source "$HOME/.uru/uru_lackee.fish" end end /home/jon $ uname -sorvp Linux 4.8.0-27-generic #29-Ubuntu SMP Thu Oct 20 21:03:13 UTC 2016 x86_64 GNU/Linux /home/jon $ echo $SHELL /usr/bin/fish /home/jon $ fish --version fish, version 2.3.1 /home/jon $ uru ls --verbose 232p212-x64 : ruby 2.3.2p212 (2016-11-12 revision 56722) [x86_64-linux] ID: 2.3.2-p212 Home: /home/jon/.rubies/ruby-2.3.0/bin GemHome: /home/jon/.gem/ruby/2.3.0 /home/jon $ uru 23 ---> now using ruby 2.3.2-p212 tagged as `232p212-x64` /home/jon $ uru ls => 232p212-x64 : ruby 2.3.2p212 (2016-11-12 revision 56722) [x86_64-linux] /home/jon $ env | egrep '^GEM_HOME|^PATH' GEM_HOME=/home/jon/.gem/ruby/2.3.0 PATH=/_U1_:/home/jon/.gem/ruby/2.3.0/bin:/home/jon/.rubies/ruby-2.3.0/bin:/_U2_:/opt/git/bin:/home/jon/godev/mygo/bin:/usr/local/go/bin:/home/jon/bin:/opt/git/bin:/home/jon/godev/mygo/bin:/usr/local/go/bin:/home/jon/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games /home/jon $ ruby --version ruby 2.3.2p212 (2016-11-12 revision 56722) [x86_64-linux] /home/jon $ gem --version 2.6.8 /home/jon $ uru nil ---> removing non-system ruby from current environment /home/jon $ uru ls 232p212-x64 : ruby 2.3.2p212 (2016-11-12 revision 56722) [x86_64-linux] /home/jon $ env | egrep '^GEM_HOME|^PATH' PATH=/opt/git/bin:/home/jon/godev/mygo/bin:/usr/local/go/bin:/home/jon/bin:/opt/git/bin:/home/jon/godev/mygo/bin:/usr/local/go/bin:/home/jon/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
-
repo owner The
rc3
downloads now support fish in msys2 and cygwin in windows environments.Jon@BLACK ~> uname -a MSYS_NT-6.3 BLACK 2.6.0(0.304/5/3) 2016-09-07 20:45 x86_64 Msys Jon@BLACK ~> fish --version fish, version 2.4.0 Jon@BLACK ~> cat ~/.config/fish/config.fish set -x PATH /c/tools $PATH set -x SHELL /usr/bin/fish set -x URU_HOME /c/Users/Jon/.uru # infect shell with uru function uru_rt admin install | source Jon@BLACK ~> functions uru function uru --description 'Manage your ruby versions' set -x URU_INVOKER fish # uru_rt must already be on PATH uru_rt $argv if test -d "$URU_HOME" -a -f "$URU_HOME/uru_lackee.fish" source "$URU_HOME/uru_lackee.fish" else if test -f "$HOME/.uru/uru_lackee.fish" source "$HOME/.uru/uru_lackee.fish" end end Jon@BLACK ~> uru ver uru v0.8.3.rc3 [windows/386 go1.7.3] Jon@BLACK ~> uru ls 226p384-x32 : ruby 2.2.6p384 (2016-10-27 revision 56505) [i386-mingw32] 232p212-x32 : ruby 2.3.2p212 (2016-11-12 revision 56722) [i386-mingw32] jruby : jruby 9.1.5.0 (2.3.1) 2016-09-07 036ce39 Java HotSpot(TM) 64-Bit... Jon@BLACK ~> uru 23 ---> now using ruby 2.3.2-p212 tagged as `232p212-x32` Jon@BLACK ~> uru ls 226p384-x32 : ruby 2.2.6p384 (2016-10-27 revision 56505) [i386-mingw32] => 232p212-x32 : ruby 2.3.2p212 (2016-11-12 revision 56722) [i386-mingw32] jruby : jruby 9.1.5.0 (2.3.1) 2016-09-07 036ce39 Java HotSpot(TM) 64-Bit... Jon@BLACK ~> ruby --version ruby 2.3.2p212 (2016-11-12 revision 56722) [i386-mingw32] Jon@BLACK ~> gem --version 2.6.8 Jon@BLACK ~> env | egrep '^GEM_HOME|^PATH' PATH=/U/_U1_:/C/Apps/rubies/ruby-2.3/bin:/U/_U2_:/C/tools:/C/Apps/DevTools/msys64/usr/local/bin:... PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC Jon@BLACK ~> uru nil ---> removing non-system ruby from current environment Jon@BLACK ~> uru ls 226p384-x32 : ruby 2.2.6p384 (2016-10-27 revision 56505) [i386-mingw32] 232p212-x32 : ruby 2.3.2p212 (2016-11-12 revision 56722) [i386-mingw32] jruby : jruby 9.1.5.0 (2.3.1) 2016-09-07 036ce39 Java HotSpot(TM) 64-Bit...
-
Everything works perfectly; thank you!
-
You should create a landing page so more people will know about uru. It is a much better alternative than the other shell switchers, a blogpost about using it with chruby may also encourage adoption.
-
repo owner - changed status to closed
Support Fish on *nix and Cygwin/MSYS2. Closes
#93Install the
uru
function in the Fish shell viaecho 'uru_rt admin install | source' >> ~/.config/fish/config.fish
The above method is preferred as it allows the
uru
function to be dynamically updated with minimal or no inconvenience to the user.Another method to install
uru
is to create a persistent function viaecho 'uru_rt admin install | source' > ~/.config/fish/functions/uru.fish
→ <<cset 534ffc463b22>>
- Log in to comment
While I don't currently use fish, I'm fine with adding support if it doesn't add too much complexity.
uru
shell function by having the user appendecho 'eval "$(uru_rt admin install)"'
into the relevant shell startup file. What fish startup file should this be injected into so that both graphical and non-graphical environments get theuru
cmd?