Skip to content

Commit

Permalink
Improve export error message for when multiple build tools are enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Gedochao committed Sep 23, 2024
1 parent 8cc0161 commit 1425103
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,15 @@ object Export extends ScalaCommand[ExportOptions] {
val shouldExportToSbt = options.sbt.getOrElse(false)
val shouldExportToMaven = options.maven.getOrElse(false)

val exportOptions = List(shouldExportToMill, shouldExportToSbt, shouldExportToMaven)

if (exportOptions.count(identity) > 1) {
val exportOptions =
(if shouldExportToMill then List("Mill") else Nil) ++
(if shouldExportToSbt then List("SBT") else Nil) ++
(if shouldExportToMaven then List("Maven") else Nil)
val exportOptionsString = exportOptions.mkString(", ")
if exportOptions.length > 1 then {
logger.error(
s"Error: Cannot export to both mill and sbt. Please pick one build tool to export."
s"""Error: Cannot export to more than one tool at once (currently chosen: $exportOptionsString).
|Pick one build tool to export to.""".stripMargin
)
sys.exit(1)
}
Expand Down

0 comments on commit 1425103

Please sign in to comment.