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

GVM doesn't work with Fish shell #294

Closed
ctwise opened this issue Sep 29, 2014 · 29 comments
Closed

GVM doesn't work with Fish shell #294

ctwise opened this issue Sep 29, 2014 · 29 comments

Comments

@ctwise
Copy link

ctwise commented Sep 29, 2014

The previous work-around for using GVM with the Fish shell was to add all the 'current' links to the PATH. This appears to be broken with newer versions of GVM. The 'current' link is only set to the default version of the given tool and doesn't get updated when 'use'-ing a different version.

@marc0der
Copy link
Member

Unfortunately we do not support fish shell. Only bash and zsh are supported (as well as power shell through posh GVM).

The real solution would be to write a client for fish shell that utilises the GVM API.

@kirach
Copy link

kirach commented Oct 7, 2015

Not cool guys, totally not cool. I've been using GVM alongside fish shell for about 1 year and today my setup was broken after update from GVM to sdkman.

@marc0der
Copy link
Member

marc0der commented Oct 7, 2015

As before, we do not officially support fish shell. If you want to get involved to make it compatible, feel free to fork and contribute to this free service that we are providing to you.

@mariuszs
Copy link

mariuszs commented Mar 9, 2016

+1

@ctwise
Copy link
Author

ctwise commented Mar 9, 2016

http://tedwise.com/2016/02/26/using-sdkman-with-the-fish-shell

@mariuszs
Copy link

mariuszs commented Mar 9, 2016

Thanks but this is not working solution.

Simple workaround, add to ~/.config/fish/config.fish:

# sdkman
set PATH $PATH (find ~/.sdkman/candidates/*/current/bin -maxdepth 0)

Completion script from your blog is working after removing first invalid method named: __fish_gvm_no_command.

@ctwise
Copy link
Author

ctwise commented Mar 10, 2016

Sorry, fixed the post.

@mariuszs
Copy link

Thx, works like a charm 👍

@gchiappe
Copy link

You should support fish-shell, I don't think that should be a difficult task and fish-shell is much better than the old fashioned bash shell. Also thanks for this great work, sticking with bash for now.

@marc0der
Copy link
Member

We still have no major plans to support fish shell as it still has a pretty
small user base. You could always try ZSH of course ;-P

On Tue, 19 Apr 2016 at 16:01 Giancarlo Chiappe [email protected]
wrote:

You should support fish-shell, I don't think that should be a difficult
task and fish-shell is much better than the old fashioned bash shell. Also
thanks for this great work, sticking with bash for now.


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#294 (comment)

@mariuszs
Copy link

So, this is all about popularity :) I dont get why happy fish user could try ZSH? Could you explain?

@marc0der
Copy link
Member

Probably because making sdkman compatible with a new shell (with
corresponding automated tests) is a lot of work and effort. Remember that
this project is free and worked on in our own spare time.

If the fish shell community wants to be supported, we would gladly
accommodate them and we welcome good quality PRs to our project.
On Tue, 19 Apr 2016 at 20:25, Mariusz Smykuła [email protected]
wrote:

So, this is all about popularity :) I dont get why happy fish user could
try ZSH? Could you explain?


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#294 (comment)

@marc0der
Copy link
Member

marc0der commented Jul 5, 2016

Closing this issue as sadly no PRs were received.

@marc0der marc0der closed this as completed Jul 5, 2016
@Markcial
Copy link

Markcial commented Aug 23, 2016

i know is a closed post, but just FYI, you can add fish shell support easily with this snippet of code

function sdk
     bass source ~/.sdkman/bin/sdkman-init.sh --no-use ';' sdk $argv
end

has a dependency on the bass library : https://github.com/edc/bass

example :

fish -home-marc_007

@venth
Copy link

venth commented Oct 1, 2016

Please take look at blog entry describing sdkman along with fish shell ;) http://tedwise.com/2016/02/26/using-sdkman-with-the-fish-shell (praises for Ted Wise).

@amosbird
Copy link

@Markcial this doesn't work for me.

 ❯ sdk list
$  is not a valid variable in fish.
- (line 33): printf "                                                         $ sdk install activator";printf '
                                                                               ^
from sourcing file -
        called on line 14 of file ~/.config/fish/functions/bass.fish

in function “bass”
        called on line 2 of file ~/.config/fish/functions/sdk.fish
        with parameter list “source /home/amos/.sdkman/bin/sdkman-init.sh --no-use ; sdk list”

in function “sdk”
        called on standard input
        with parameter list “list”

source: Error while reading file “-”

 ❯              

@Markcial
Copy link

@amosbird Fixed on edc/bass, can you try upgrading your edc/bass with fisher up edc/bass please?

@amosbird
Copy link

@Markcial Thanks. It works now.

@yookoala
Copy link

yookoala commented Jul 27, 2017

I wrote a script like this and saved as $HOME/.config/fish/conf.d/sdkman.fish. Seems it works. And it does not depend on bass:

#!/usr/bin/fish

# sdk command
function sdk
        bash -c "source $HOME/.sdkman/bin/sdkman-init.sh && sdk $argv"
end

# add paths
for ITEM in $HOME/.sdkman/candidates/* ;
        set -gx PATH $PATH $ITEM/current/bin
end

@reitzig
Copy link
Contributor

reitzig commented May 8, 2018

@ctwise I'm getting lots of errors:

~> sdk list
mktemp: too few X's in template ‘env’
mktemp: too few X's in template ‘env’
bash: -c: line 0: syntax error near unexpected token `newline'
bash: -c: line 0: `source ~/.sdkman/bin/sdkman-init.sh && sdk list && printenv > '
~/.config/fish/functions/sdk.fish (line 12): Invalid redirection target: $path_env
          echo "$elem" >> $path_env
                       ^
in function “sdk”
	called on standard input
	with parameter list “list”

It seems the interface of mktemp has changed:

TEMPLATE must contain at least 3 consecutive 'X's in last component.

So, simple fix:

set after_env (mktemp -t env.XXX)
set path_env (mktemp -t env.XXX)

Thanks a lot, huge help!

I wonder how much work it would be to make this into a PR. Sdkman's installer could detect if .config/fish exists and then write those scripts of yours in the correct places?

@reitzig
Copy link
Contributor

reitzig commented Jun 14, 2018

@ctwise The list of commands apparently need an update, too: outdated doesn't exist anymore. (I didn't check everything).

Maybe, at this point, it'd be good to have a Github project for your scripts (and deploy them via fisher or similar), then we could collaborate to keep it up to date more easily. Are you up for setting that up?

@reitzig
Copy link
Contributor

reitzig commented Jun 14, 2018

@marc0der The fish script @ctwise posted on his blog still has it (but otherwise works fine). Sorry for hijacking your bugtracker for communicating with him about something you have no intentions to support; will endeavour to move the discussion elsewhere.

@marc0der
Copy link
Member

No probs, feel free to keep discussing it here. I just didn't understand the context so my bad...

@mariuszs
Copy link

mariuszs commented Jun 15, 2018

@reitzig Please use @yookoala solution, works like a charm, and it is very simple.

@reitzig
Copy link
Contributor

reitzig commented Jun 15, 2018

@mariuszs I can see how @yookoala's snippet makes sdk and installed binaries available (and more simply so than the other alternatives); it doesn't provide auto-completion, though (which is the bigger part of @ctwise's post).

@reitzig
Copy link
Contributor

reitzig commented Jul 11, 2018

I set up a repo: reitzig/sdkman-for-fish. There is some work to do on the completions; pull requests appreciated.

@ctwise and @yookoala, I hope you are fine with the MIT license and credits; if not, please let me know.

Update: Completion is now up to date and improved (doesn't complete arbitrarily many parameters, which sdk doesn't support). Also fixed bugs with the sdk function itself (subshells would get duplicate PATH entries; sdk use didn't work). Install with fisher install reitzig/sdkman-for-fish.

Update 2: To all who google here, I can only recommend to install "my" version. What was posted above was simply broken; for instance, sdk use and sdk offline just wouldn't work. Check out the growing issue list in case of doubt -- this has turned out to be a larger bite than what I thought I signed up for!

@reitzig
Copy link
Contributor

reitzig commented Jul 14, 2018

@marc0der At this point, would it be conceivable to have the SDKMAN! installer detect the presence of fish, and either install support there (potentially destructive, so meh) or give the user a hint how they can get it?

@marc0der
Copy link
Member

I'm open to either approach. We seem to have a lot of fish shell users now so why not give them first class support?

The installer script can be found here:
https://github.com/sdkman/sdkman-hooks/blob/master/app/views/install.scala.txt

@reitzig
Copy link
Contributor

reitzig commented Jul 14, 2018

I posted a draft: sdkman/sdkman-hooks#9

It would be great if one of the other fish users could chime in. As the author of the (not yet fully matured and battle-tested) integration I feel slightly awkward pushing this.

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

No branches or pull requests

10 participants