Skip to content

Commit 8c889a5

Browse files
author
Oliver Weiler
authored
Make Bash completion work with POSIX mode (#978)
* Make Bask completion work with POSIX mode * Fix broken assignment
1 parent bff371f commit 8c889a5

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

contrib/completion/bash/sdk

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@ __sdkman_complete_command() {
3232
done
3333
;;
3434
install|list)
35-
curl --silent "${SDKMAN_CANDIDATES_API}/candidates/all" | \
35+
local -r all_candidates=$(curl --silent "${SDKMAN_CANDIDATES_API}/candidates/all")
36+
3637
while IFS= read -d, -r candidate; do
3738
candidates+=($candidate)
38-
done
39+
done <<< "$all_candidates"
3940
;;
4041
env)
4142
candidates=("init install clear")
@@ -72,10 +73,11 @@ __sdkman_complete_candidate_version() {
7273
done
7374
;;
7475
install)
75-
curl --silent "${SDKMAN_CANDIDATES_API}/candidates/$candidate/${SDKMAN_PLATFORM}/versions/all" | \
76+
local -r all_candidate_versions=$(curl --silent "${SDKMAN_CANDIDATES_API}/candidates/$candidate/${SDKMAN_PLATFORM}/versions/all")
77+
7678
while IFS= read -d, -r version; do
7779
candidates+=($version)
78-
done
80+
done <<< "$all_candidate_versions"
7981
;;
8082
esac
8183

src/test/groovy/sdkman/env/BashEnv.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class BashEnv {
4646
* Starts the external bash process.
4747
*/
4848
void start() {
49-
process = ["bash", "--noprofile", "--norc", "-i", "-o", "noclobber"].execute(env, workDir)
49+
process = ["bash", "--noprofile", "--norc", "--posix", "-i", "-o", "noclobber"].execute(env, workDir)
5050

5151
consumeProcessStream(process.inputStream)
5252
consumeProcessStream(process.errorStream)

0 commit comments

Comments
 (0)