Skip to content

Commit

Permalink
Preserve '--' in arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
MaciejG604 committed Oct 9, 2023
1 parent 732adfd commit dea7659
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions modules/cli/src/main/scala/scala/cli/ScalaCli.scala
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,15 @@ object ScalaCli {
isSipScala = false
args0.toArray
else
// .ignoreUnrecognized drops '--'
val programArgs = args0.dropWhile(_ != "--")
val optionArgs = args0.takeWhile(_ != "--")
// Parse again to consume --power at any position
PowerOptions.parser.ignoreUnrecognized.parse(args0) match {
PowerOptions.parser.ignoreUnrecognized.parse(optionArgs) match {
case Right((powerOptions, unrecognizedArgs)) =>
if powerOptions.power then
isSipScala = false
unrecognizedArgs.toArray
(unrecognizedArgs ++ programArgs).toArray
case Left(e) =>
System.err.println(e.message)
sys.exit(1)
Expand Down

0 comments on commit dea7659

Please sign in to comment.