com.indoorvivants:rendition_sjs1_3

rendition


License
Apache-2.0

Documentation

This library is not really designed to be used by anyone other than me but I'm too cheap to pay (even more) for private github actions minutes

Rendition is a micro library intended to be replace basically the same code in projects like sn-bindgen and langoustine

import rendition._

val lb = LineBuilder()

lb.use {
    line("object test:")
    nest {
      line("def hello = ")
      nest {
        line("val x = 25")
        withReset { line("// top level!") }
        deep(4) {
          line("// super nested")
        }
      }
      line("def test = 5")
    }
}

val expected = 
"""
|object test:
|  def hello = 
|    val x = 25
|// top level!
|            // super nested
|  def test = 5
""".stripMargin.trim

assert(expected == lb.result.trim)