@@ -76,14 +76,6 @@ if (($allArgs.Count -eq 0) -or (($allArgs.Count -eq 1) -and ($allArgs[0] -in @("
7676 exit 1
7777}
7878
79- function NormalizeArg {
80- param (
81- [Parameter (Mandatory = $true , ValueFromPipeline = $true )]
82- [string []] $Items
83- )
84- $Items -join " ,"
85- }
86-
8779function QuoteString {
8880 param (
8981 [Parameter (ValueFromPipeline = $true )]
@@ -103,40 +95,23 @@ function QuoteString {
10395 }
10496}
10597
106- $elixirParams = @ ()
10798$erlangParams = @ ()
10899$beforeExtras = @ ()
109100$allOtherParams = @ ()
110101
111102$runErlPipe = $null
112103$runErlLog = $null
113104
114- for ($i = 0 ; $i -lt $allArgs.Count ; $i ++ ) {
105+ :loop for ($i = 0 ; $i -lt $allArgs.Count ; $i ++ ) {
115106 $private :arg = $allArgs [$i ]
116107
117108 switch - exact ($arg ) {
118109 { $_ -in @ (" -e" , " -r" , " -pr" , " -pa" , " -pz" , " --eval" , " --remsh" , " --dot-iex" , " --dbg" ) } {
119- $private :nextArg = NormalizeArg($allArgs [++ $i ])
120-
121- $elixirParams += $arg
122- $elixirParams += $nextArg
123-
110+ ++ $i
124111 break
125112 }
126113
127- { $_ -in @ (" -v" , " --version" ) } {
128- # Standalone options goes only once in the Elixir params, when they are empty.
129- if (($elixirParams.Count -eq 0 ) -and ($allOtherParams.Count -eq 0 )) {
130- $elixirParams += $arg
131- }
132- else {
133- $allOtherParams += $arg
134- }
135- break
136- }
137-
138- " --no-halt" {
139- $elixirParams += $arg
114+ { $_ -in @ (" -v" , " --version" , " --no-halt" ) } {
140115 break
141116 }
142117
@@ -204,14 +179,11 @@ for ($i = 0; $i -lt $allArgs.Count; $i++) {
204179 }
205180
206181 " +iex" {
207- $elixirParams += " +iex"
208182 $useIex = $true
209-
210183 break
211184 }
212185
213186 " +elixirc" {
214- $elixirParams += " +elixirc"
215187 break
216188 }
217189
@@ -229,9 +201,6 @@ for ($i = 0; $i -lt $allArgs.Count; $i++) {
229201 exit 1
230202 }
231203
232- $elixirParams += " --rpc-eval"
233- $elixirParams += $key
234- $elixirParams += $value
235204 break
236205 }
237206
@@ -249,16 +218,14 @@ for ($i = 0; $i -lt $allArgs.Count; $i++) {
249218 exit 1
250219 }
251220
252- $elixirParams += " -boot_var"
253- $elixirParams += $key
254- $elixirParams += $value
221+ $erlangParams += " -boot_var"
222+ $erlangParams += $key
223+ $erlangParams += $value
255224 break
256225 }
257226
258227 Default {
259- $private :normalized = NormalizeArg $arg
260- $allOtherParams += $normalized
261- break
228+ break :loop
262229 }
263230 }
264231}
@@ -280,8 +247,7 @@ if ($null -ne $env:ELIXIR_ERL_OPTIONS) {
280247$allParams += $erlangParams
281248$allParams += $beforeExtras
282249$allParams += " -extra"
283- $allParams += $elixirParams
284- $allParams += $allOtherParams
250+ $allParams += $allArgs
285251
286252$binSuffix = " "
287253
0 commit comments