-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Configurable error messages (#243)
- Loading branch information
Showing
3 changed files
with
50 additions
and
17 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
main/src/io/github/iltotore/iron/internal/IronConfig.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package io.github.iltotore.iron.internal | ||
|
||
/** | ||
* The config or Iron at compile-time. | ||
* | ||
* @param color enable colored messages | ||
* @param shortMessages use abbreviated messages, useful for error lenses and similar | ||
*/ | ||
case class IronConfig(color: Boolean, shortMessages: Boolean) | ||
|
||
object IronConfig: | ||
|
||
/** | ||
* The config as defined by the properties/environment. | ||
*/ | ||
val fromSystem: IronConfig = IronConfig( | ||
color = sys.props.get("iron.color").orElse(sys.env.get("IRON_COLOR")).flatMap(_.toBooleanOption).getOrElse(true), | ||
shortMessages = sys.props.get("iron.shortMessages").orElse(sys.env.get("IRON_SHORT_MESSAGES")).flatMap(_.toBooleanOption).getOrElse(false), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters