sdkman-for-fish/test/reinitialize.fish
Raphael Reitzig e41ccb9ce8 Offer to install SDKMAN! if not already installed.
Fixes issue #26

Also:

 - Change language in README to clarify that
   SDKMAN! is not included.
 - Polishes to `.editorconfig`.
2019-11-05 04:24:36 +01:00

27 lines
847 B
Fish
Executable file

# If either of
# - $SDKMAN_DIR is unset
# - $SDKMAN_DIR points to a directory not owned by the current user
# is true, sdkman-for-fish should run sdkman's init script.
# Assumes sdkman-for-fish is installed
set proper_value "$SDKMAN_DIR"
begin
set -e SDKMAN_DIR
set in_new_shell (fish -lc 'echo $SDKMAN_DIR')
if [ "$in_new_shell" != "$proper_value" ]
echo "SDKMAN_DIR initialized to $in_new_shell instead of $proper_value"
exit 1
end
end
begin
set -x SDKMAN_DIR "/" # belongs to root, who hopefully doesn't run this
set in_new_shell (fish -lc 'echo $SDKMAN_DIR')
if [ "$in_new_shell" != "$proper_value" ]
echo "SDKMAN_DIR reinitialized to $in_new_shell instead of $proper_value"
exit 1
end
end
# TODO: add test that fails if `test` in conf.d/sdk.fish:80 errors (cf issue #28 et al.)