From 11385c6385bb2d4de20eb85c6bdb131f0aa02dc3 Mon Sep 17 00:00:00 2001 From: Raphael Reitzig <4246780+reitzig@users.noreply.github.com> Date: Sat, 14 Jul 2018 11:58:01 +0200 Subject: [PATCH] Copy PATH of the sdk-running bash to the current fish. Solves issue #8. --- conf.d/sdk.fish | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/conf.d/sdk.fish b/conf.d/sdk.fish index fda9f13..6560e04 100644 --- a/conf.d/sdk.fish +++ b/conf.d/sdk.fish @@ -22,6 +22,15 @@ if test -f "$sdkman_init" # Declare the sdk command for fish function sdk - bash -c "source $sdkman_init && sdk $argv" + set bashEcho (bash -c "source $sdkman_init && sdk $argv && echo \"\$PATH\"") + + # If SDKMAN! succeeded, copy PATH here (might have changed) + if [ $status = 0 ] + set newPath (string split : "$bashEcho[-1]") + set -gx PATH $newPath + end + + # Print output of SDKMAN! + string join \n $bashEcho[0..-2] end end