Skip to content

Commit

Permalink
INCOMPLETE
Browse files Browse the repository at this point in the history
  • Loading branch information
tribbloid committed Nov 2, 2023
1 parent 336262f commit aec96de
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions core/src/main/scala/splain/PluginSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,42 @@ 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 = {
if (!enabled) false
else if (enableAll) true
else opt(key, "true") == "true"
if (enabled) opt(key, "true") == "true"
else false

}

def intOptional(key: String): Option[Int] =
def intOption(key: String): Option[Int] =
if (enabled)
pluginOpts.get(key).flatMap(a => scala.util.Try(a.toInt).toOption)
else
None

def int(key: String): Int = {
val opt = intOptional(key)
val opt = intOption(key)

opt.getOrElse(throw new SplainInternalError(s"$key is not defined"))
}

def nstringOption(key: String): Option[String] =
if ()

// once read, changing pluginOpts will no longer be useful
def implicitDiverging: Boolean = boolean(PluginSettings.Key.implicitDiverging)

def implicitDivergingMaxDepth: Int = int(Key.implicitDivergingMaxDepth)

def typeDetail: Int = int(PluginSettings.Key.typeDetail)
def typeDetail: String = (PluginSettings.Key.typeDetail)

object TypeDetail {}
object TypeDetail {

def showTypeReduction: Boolean = boolean(PluginSettings.Key.typeReduction)

def showTypeDefPosition: Boolean = boolean(PluginSettings.Key.typeDefPosition)
def showTypeReduction: Boolean = boolean(PluginSettings.Key.typeReduction)

def showTypeDefPosition: Boolean = boolean(PluginSettings.Key.typeDefPosition)
}

def typeDiffsDetail: Int = int(PluginSettings.Key.typeDiffsDetail)

Expand All @@ -60,30 +64,26 @@ object PluginSettings {
object Key {

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

val debug = "Vdebug"

val implicitDiverging = "Vimplicits-diverging"

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

val typeReduction = "Vtype-reduction"

val typeDefPosition = "Vtype-def-position"
// val typeReduction = "Vtype-reduction"
//
// val typeDefPosition = "Vtype-def-position"

val typeDetail = "Vtype-detail"

val typeDiffsDetail = "Vtype-diffs-detail"

val debug = "Vdebug"
}

val inits: Map[String, String] = Map(
Key.enabled -> "true",
Key.enableAll -> "false",
Key.implicitDiverging -> "false",
Key.implicitDivergingMaxDepth -> "100",
Key.typeReduction -> "false",
Key.typeDefPosition -> "false",
Key.typeDetail -> "1",
Key.typeDiffsDetail -> "1",
Key.debug -> "false"
Expand Down

0 comments on commit aec96de

Please sign in to comment.