Skip to content

Commit

Permalink
Plugin option "all" renamed to "enabled"
Browse files Browse the repository at this point in the history
"enableAll" option is added to enable all features
  • Loading branch information
tribbloid committed Sep 20, 2023
1 parent 66c1ca2 commit 34fa9f3
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions core/src/main/scala/splain/PluginSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ case class PluginSettings(pluginOpts: mutable.Map[String, String]) {
def opt(key: String, default: String): String = pluginOpts.getOrElse(key, default)

def enabled: Boolean = opt(Key.enabled, "true") == "true"
def enableAll: Boolean = opt(Key.enableAll, "false") == "true"

def boolean(key: String): Boolean = enabled && opt(key, "true") == "true"
def boolean(key: String): Boolean = {
if (!enabled) false
else if (enableAll) true
else opt(key, "true") == "true"
}

def int(key: String): Option[Int] =
if (enabled)
Expand All @@ -35,20 +40,20 @@ object PluginSettings {
object Key {

val enabled = "enabled"
val enableAll = "enableAll"

val implicitDiverging = "Vimplicits-diverging"

val implicitDivergingMaxDepth = "Vimplicits-diverging-max-depth"

val typeReduction = "Vtype-reduction"

val debug = "debug"
}

val defaults: Map[String, String] = Map(
Key.enabled -> "true",
Key.enableAll -> "false",
Key.implicitDiverging -> "false",
Key.implicitDivergingMaxDepth -> "100",
Key.typeReduction -> "false",
Key.debug -> "false"
Key.typeReduction -> "false"
)
}

0 comments on commit 34fa9f3

Please sign in to comment.