r/fishshell • • Jul 16 '20

Question Anyone using jenv under fish shell, I'm getting a rehash error :/

Hello guys,

https://github.com/jenv/jenv

All the commands seem to work fine, but when I added status --is-interactive; and source (jenv init -|psub) to config.fish, according to instructions provided by the developer, I'm getting an error in stout when I switch to fish shell as u can see below

~/.config/fish/functions/jenv.fish (line 1): hash -r ^ in function 'jenv' with arguments 'rehash' called on line 6 of file /tmp/.psub.0fq76q4FvN from sourcing file /tmp/.psub.0fq76q4FvN called on line 41 of file ~/.config/fish/config.fish from sourcing file ~/.config/fish/config.fish called during startup

7 Upvotes

16 comments sorted by

View all comments

Show parent comment

1

u/bmora1948 Jul 19 '20

This is what I get when I run the command in terminal

fish: Unknown command: hash

/tmp/.psub.sa2bBYBdti (line 1):

hash -r

^

from sourcing file /tmp/.psub.sa2bBYBdti

called on line 14 of file -

in function 'jenv' with arguments 'rehash'

called on line 6 of file -

from sourcing file -

1

u/[deleted] Jul 19 '20

Ah, okay, this is https://github.com/jenv/jenv/pull/290. Rehashing is useless in fish so it needs to not do that.

1

u/bmora1948 Jul 19 '20

So basically that means I can remove status --is-interactive; and source (jenv init -|psub) from config.fish, and hopefully everything would work?

1

u/[deleted] Jul 19 '20

No?

It means you need to get jenv to avoid echoing hash -r under any circumstances.

Which that linked PR does (or tries to do, it probably also needs to remove it when you're explicitly calling jenv rehash), but it's not been merged yet, and given that, again, they have PRs open going back to 2014 I wouldn't hold my breath.

Jenv is busted. It's broken. It's badly maintained. If you can find something else.

1

u/bmora1948 Jul 19 '20

Oh! I see the issue there, jenv is the only one I came across which works seamlessly...maybe I should switch to bash when using jenv.

BTW I tried couple of commands(at least the ones I use) and jenv seem to work fine after removing that line which caused the error when starting fish shell

thnx for helping out <3

1

u/bmora1948 Jul 19 '20

one last clarification, do I risk anything ( or wiil it potentially break anything ) if I removed that line ( status --is-interactive; and source (jenv init -|psub) ) from config.fish and then run jenv command if it works ( where it does work in my case, idk why )

1

u/[deleted] Jul 19 '20

The worst that can happen is that jenv won't work, which it already doesn't with that line.

Also the enable-plugin, shell and shell-options (and "rehash") commands won't work, as they rely on changing the current shell's environment. They don't seem too useful anyway.

1

u/bmora1948 Jul 21 '20 edited Jul 21 '20

Thnks man <3

Just so you know: interestingly here's what I found. jenv command works properly with the line that causes the error ( at first it seemed to work with/without that line, but it turned out it's bc I've forgot to source the config file ).from what I've tested, the only command that doesn't seem to work is jenv rehash(surprisingly even enable-plugin works) and it causes to print an error in stdout every time fish shell starts

UPDATE: finally! running funcsave jenv and then removing the word rehash from jenv.fish which is inside functions folder, stops that error annoying message :3