Skip to content

Commit 1425103

Browse files
committed
Improve export error message for when multiple build tools are enabled
1 parent 8cc0161 commit 1425103

File tree

1 file changed

+8
-4
lines changed
  • modules/cli/src/main/scala/scala/cli/commands/export0

1 file changed

+8
-4
lines changed

modules/cli/src/main/scala/scala/cli/commands/export0/Export.scala

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,15 @@ object Export extends ScalaCommand[ExportOptions] {
155155
val shouldExportToSbt = options.sbt.getOrElse(false)
156156
val shouldExportToMaven = options.maven.getOrElse(false)
157157

158-
val exportOptions = List(shouldExportToMill, shouldExportToSbt, shouldExportToMaven)
159-
160-
if (exportOptions.count(identity) > 1) {
158+
val exportOptions =
159+
(if shouldExportToMill then List("Mill") else Nil) ++
160+
(if shouldExportToSbt then List("SBT") else Nil) ++
161+
(if shouldExportToMaven then List("Maven") else Nil)
162+
val exportOptionsString = exportOptions.mkString(", ")
163+
if exportOptions.length > 1 then {
161164
logger.error(
162-
s"Error: Cannot export to both mill and sbt. Please pick one build tool to export."
165+
s"""Error: Cannot export to more than one tool at once (currently chosen: $exportOptionsString).
166+
|Pick one build tool to export to.""".stripMargin
163167
)
164168
sys.exit(1)
165169
}

0 commit comments

Comments
 (0)