mirror of https://github.com/sbt/sbt.git
Fix client argument parsing for commands containing `-`
When the user ran a command like `testOnly foo -- bar`, the client was incorrectly treating the `--` as an sbt argument. The assumption is that once an argument is found that does not start with a `-`, then everything following that argument is part of the command arguments.
This commit is contained in:
parent
aaee092c96
commit
3216848c77
|
|
@ -744,23 +744,20 @@ object NetworkClient {
|
|||
case a if a.startsWith("\"") => Array(a)
|
||||
case a => a.split(" ")
|
||||
}
|
||||
var foundCompletions = false
|
||||
var i = 0
|
||||
while (i < sanitized.length) {
|
||||
sanitized(i) match {
|
||||
case a if foundCompletions => completionArguments += a
|
||||
case a if completionArguments.nonEmpty => completionArguments += a
|
||||
case a if commandArgs.nonEmpty => commandArgs += a
|
||||
case a if a == noStdErr || a == noTab || a.startsWith(completions) =>
|
||||
foundCompletions = true
|
||||
completionArguments += a
|
||||
case a if a.startsWith("--sbt-script=") =>
|
||||
sbtScript = a.split("--sbt-script=").lastOption.getOrElse(sbtScript)
|
||||
case a if !a.startsWith("-") => commandArgs += a
|
||||
case a if !a.startsWith("-") => commandArgs += a
|
||||
case a @ SysProp(key, value) =>
|
||||
System.setProperty(key, value)
|
||||
sbtArguments += a
|
||||
case a if !foundCompletions =>
|
||||
sbtArguments += a
|
||||
case a => sbtArguments += a
|
||||
}
|
||||
i += 1
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue