Skip to content

Commit 5452944

Browse files
helpermethodmarc0der
authored andcommitted
Add completion for sdk install
1 parent ca918e7 commit 5452944

File tree

1 file changed

+12
-2
lines changed
  • contrib/completion/bash

1 file changed

+12
-2
lines changed

contrib/completion/bash/sdk

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ __sdkman_complete_command() {
2929
candidates+=(${candidate_path##*/})
3030
done
3131
;;
32+
install)
33+
while IFS= read -d, -r candidate; do
34+
candidates+=($candidate)
35+
done < <(curl --silent "${SDKMAN_CANDIDATES_API}/candidates/all")
36+
;;
3237
completion)
3338
candidates=("bash" "zsh")
3439
;;
@@ -52,7 +57,7 @@ __sdkman_complete_command() {
5257
__sdkman_complete_candidate_version() {
5358
local -r command=$1
5459
local -r candidate=$2
55-
local -r version=$3
60+
local -r candidate_version=$3
5661

5762
local candidates
5863

@@ -66,9 +71,14 @@ __sdkman_complete_candidate_version() {
6671
candidates+=(${version_path##*/})
6772
done
6873
;;
74+
install)
75+
while IFS= read -d, -r version; do
76+
candidates+=($version)
77+
done < <(curl --silent "${SDKMAN_CANDIDATES_API}/candidates/$candidate/${SDKMAN_PLATFORM}/versions/all")
78+
;;
6979
esac
7080

71-
COMPREPLY=($(compgen -W "${candidates[*]}" -- "$current_word"))
81+
COMPREPLY=($(compgen -W "${candidates[*]}" -- "$candidate_version"))
7282
}
7383

7484
complete -o default -F _sdk sdk

0 commit comments

Comments
 (0)