mirror of
https://github.com/ethauvin/sdkman-for-fish.git
synced 2025-04-25 05:17:11 -07:00
Implements a nasty hack for issue #19: mangle sdkman-init.
This commit is contained in:
parent
ba46492522
commit
88c81dc479
3 changed files with 18 additions and 9 deletions
|
@ -7,13 +7,21 @@
|
|||
# MIT License (MIT)
|
||||
# https://github.com/reitzig/sdkman-for-fish
|
||||
|
||||
set sdkman_init "$HOME/.sdkman/bin/sdkman-init.sh"
|
||||
set __fish_sdkman_init "$HOME/.sdkman/bin/sdkman-init.sh"
|
||||
set __fish_sdkman_noexport_init "$HOME/.config/fisherman/sdkman-for-fish/sdkman-noexport-init.sh"
|
||||
|
||||
# Guard: SDKMAN! needs to be installed
|
||||
if not test -f "$sdkman_init"
|
||||
if not test -f "$__fish_sdkman_init"
|
||||
exit 0
|
||||
end
|
||||
|
||||
# Hack for issue #19: Create version of sdkman-init that doesn't export
|
||||
# any environment variables.
|
||||
if not test -f "$__fish_sdkman_noexport_init"
|
||||
sed -e 's/^\(\s*\).*\(export\|to_path\).*$/\1:/g' "$__fish_sdkman_init" \
|
||||
> $__fish_sdkman_noexport_init
|
||||
end
|
||||
|
||||
# Runs the given command in bash, capturing some side effects
|
||||
# and repeating them on the current fish shell.
|
||||
# Returns the same status code as the given command.
|
||||
|
@ -64,6 +72,6 @@ end
|
|||
# If this is a subshell of a(n initialized) fish, no initialization
|
||||
# necessary. Otherwise:
|
||||
if not set -q SDKMAN_DIR
|
||||
__fish_sdkman_run_in_bash "source $sdkman_init"
|
||||
__fish_sdkman_run_in_bash "source $__fish_sdkman_init"
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue