From 5f2ae91d5f58baffe8bf8dda15d9124069a4eecf Mon Sep 17 00:00:00 2001 From: BryanLiang Date: Fri, 29 Mar 2024 17:42:39 +0800 Subject: [PATCH] fix: Completions use custom install location Also, replace calls to `tr` with fish built-in --- CHANGELOG.md | 6 ++++++ completions/sdk.fish | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6724ef0..ef495c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Fixes + +- Completions use custom SDKMAN! install path (#48; thanks, @Bryan2333!) + ## [2.0.0] - 2023-06-27 ### Breaking diff --git a/completions/sdk.fish b/completions/sdk.fish index 7908dc8..54693df 100644 --- a/completions/sdk.fish +++ b/completions/sdk.fish @@ -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