Skip to content

Commit

Permalink
Some improvements for the plugin
Browse files Browse the repository at this point in the history
1. Make the completions work with the custom install location. The sdkman install location is hardcoded in the original completion file.
2. Replace the tr command with fish shell builtin command
  • Loading branch information
Bryan2333 committed Mar 29, 2024
1 parent 2d169ba commit 2f17870
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions completions/sdk.fish
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 2f17870

Please sign in to comment.