Skip to content

Commit

Permalink
Fix version
Browse files Browse the repository at this point in the history
  • Loading branch information
deusaquilus committed Dec 29, 2023
1 parent 12a7fbe commit 4746d45
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 12 deletions.
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,22 @@
This is a port of Li Haoyi's excellent Scala pretty-printing library into Kotlin.
(As well as Li Haoyi's excellent Ansi-Formatting library Fansi!)

TODO - Explain how can handle Sequence due to lazieness
## Usage

Add the following to your build.gradle.kts:

```kotlin
implementation("io.exoquery:pprint-kotlin:1.0.0")
```

The use the library like this:
```kotlin
import io.exoquery.pprint

data class Name(val first: String, val last: String)
data class Person(val name: Name, val age: Int)
val p = Person(Name("Joe", "Bloggs"), 42)
println(pprint(p))
```


4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ nexusPublishing {
apply(plugin = "io.github.gradle-nexus.publish-plugin")

group = "io.exoquery"
version = "1.0"
version = "1.0.0"

apply(plugin = "kotlin")
apply(plugin = "maven-publish")
Expand Down Expand Up @@ -84,7 +84,7 @@ allprojects {
pom {
name.set("decomat")
description.set("DecoMat - Deconstructive Pattern Matching for Kotlin")
url.set("https://github.com/exoquery/decomat")
url.set("https://github.com/deusaquilus/pprint-kotlin")

licenses {
license {
Expand Down
19 changes: 10 additions & 9 deletions src/test/kotlin/io/exoquery/pprint/Examples.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@ package io.exoquery.pprint
import io.exoquery.fansi.Str
import io.exoquery.pprint

data class Name(val first: String, val last: String)
data class Person(val name: Name, val age: Int)

data class Name(val first: String, val last: String)

fun main() {
// val p = Person(Name("Joe", "Bloggs"), 123)
// val q = Person(Name("Quiggs", "Moggs"), 123)
// println(PPrinter()(mapOf("key" to "value")))

val seq = generateSequence { "foo" }
//val joined = Str.join(PPrinter.BlackWhite.tokenize(seq, height = 5).iterator())
val joined = pprint(seq)
run {
val p = Person(Name("Joe", "Bloggs"), 42)
println(pprint(p))
}

println(joined)
//val seq = generateSequence { "foo" }
////val joined = Str.join(PPrinter.BlackWhite.tokenize(seq, height = 5).iterator())
//val joined = pprint(seq)
//
//`println(joined)
}

0 comments on commit 4746d45

Please sign in to comment.