Merge branch 'issue-19' into dev

This commit is contained in:
Raphael Reitzig 2018-07-21 20:40:51 +02:00
commit 9dd152bced
3 changed files with 16 additions and 3 deletions

View file

@ -8,12 +8,24 @@
# https://github.com/reitzig/sdkman-for-fish
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 "$__fish_sdkman_init"
exit 0
end
# Hack for issue #19:
# Create version of sdkman-init that doesn't export any environment variables.
# Refresh if sdkman-init changed.
if begin not test -f "$__fish_sdkman_noexport_init";
or env test "$__fish_sdkman_init" -nt "$__fish_sdkman_noexport_init"
end
mkdir -p (dirname $__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.

View file

@ -5,5 +5,5 @@ end
# Declare the sdk command for fish
function sdk -d "Manage SDKs"
__fish_sdkman_run_in_bash "source $__fish_sdkman_init && sdk $argv"
__fish_sdkman_run_in_bash "source \"$__fish_sdkman_noexport_init\" && sdk $argv"
end

View file

@ -8,7 +8,8 @@ set test_commands \
"sdk list java" \
"sdk update" \
"sdk use ant 1.9.9" \
"sdk offline enable > /dev/null; sdk install ant foo"
"sdk offline enable > /dev/null; sdk install ant foo" \
"sdk use ant 1.9.9 > /dev/null; sdk broadcast"
set test_count (count $test_commands)
set check_count (math "3 * $test_count")