M fish/completions/sdk.fish => fish/completions/sdk.fish +4 -4
@@ 60,21 60,21 @@ end
# # # # # #
function __fish_sdkman_candidates
- cat "$HOME"/.sdkman/var/candidates | tr ',' '\n'
+ cat "$SDKMAN_DIR"/var/candidates | string replace -a -r ',' '\n'
end
function __fish_sdkman_candidates_with_versions
set regexpHome (string replace -a '/' '\\/' "$HOME/")
- find "$HOME"/.sdkman/candidates/ -mindepth 2 -maxdepth 2 -name '*current' \
+ find "$SDKMAN_DIR"/candidates/ -mindepth 2 -maxdepth 2 -name '*current' \
| awk -F '/' '{ print $(NF-1) }' \
| sort -u
end
function __fish_sdkman_installed_versions
set cmd (commandline -opc)
- if [ -d "$HOME"/.sdkman/candidates/$cmd[3]/current ]
- ls -v1 "$HOME"/.sdkman/candidates/$cmd[3] | grep -v current
+ if [ -d "$SDKMAN_DIR"/candidates/$cmd[3]/current ]
+ ls -v1 "$SDKMAN_DIR"/candidates/$cmd[3] | grep -v current
end
end
M fish/conf.d/sdk.fish => fish/conf.d/sdk.fish +13 -6
@@ 10,22 10,29 @@
# Account for custom install locations
if set -q __sdkman_custom_dir
set -gx SDKMAN_DIR "$__sdkman_custom_dir"
-else
- # This is the default location:
+end
+# Guard: SDKMAN! needs to be installed
+if set -q SDKMAN_DIR; and not test -f "$SDKMAN_DIR/bin/sdkman-init.sh"
+ echo "WARNING: SDKMAN! installation path set to $SDKMAN_DIR, but no installation found there"
+ exit 0
+end
+
+# Unless overridden, use the default location:
+if not set -q SDKMAN_DIR
set -gx SDKMAN_DIR "$HOME/.sdkman"
end
set __fish_sdkman_init "$SDKMAN_DIR/bin/sdkman-init.sh"
-# Copied from https://github.com/jorgebucaran/fisher/blob/main/functions/fisher.fish to be consistent:
-set --query fisher_path || set --local fisher_path $__fish_config_dir
-set __fish_sdkman_noexport_init "$fisher_path/functions/__sdkman-noexport-init.sh"
-
# Guard: SDKMAN! needs to be installed
if not test -f "$__fish_sdkman_init"
exit 0
end
+# Copied from https://github.com/jorgebucaran/fisher/blob/main/functions/fisher.fish to be consistent:
+set --query fisher_path || set --local fisher_path $__fish_config_dir
+set __fish_sdkman_noexport_init "$fisher_path/functions/__sdkman-noexport-init.sh"
+
# Hack for issue #19:
# Create version of sdkman-init that doesn't export any environment variables.
# Refresh if sdkman-init changed.
M fish/fish_plugins => fish/fish_plugins +1 -1
@@ 2,4 2,4 @@ jorgebucaran/fisher
jorgebucaran/nvm.fish
jorgebucaran/replay.fish
lilyball/nix-env.fish
-reitzig/sdkman-for-fish@v2.0.0
+reitzig/sdkman-for-fish@v2.1.0