https://github.com/softprops/treeline-scala
Renders nested tree branches in unicode and ascii
https://github.com/softprops/treeline-scala
Last synced: 8 months ago
JSON representation
Renders nested tree branches in unicode and ascii
- Host: GitHub
- URL: https://github.com/softprops/treeline-scala
- Owner: softprops
- License: mit
- Created: 2013-02-01T13:31:22.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2014-05-10T20:00:03.000Z (about 12 years ago)
- Last Synced: 2024-05-09T09:41:57.187Z (about 2 years ago)
- Language: Scala
- Homepage: http://softprops.github.com/treeline/
- Size: 172 KB
- Stars: 9
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# treeline
A unicode tree renderer.
├─┬ ↑
│ └── ⬆
├─┬ ⬆
│ └── ↑
└── ↑
## install
### using [ls](http://ls.implicit.ly/#installing)
ls-install treeline
### using [sbt](http://www.scala-sbt.org/)
libraryDepdendencies += "me.lessis" %% "treeline" % "0.1.0"
## usage
Treeline exposes two objects `Trees` and `Branches`. A `Tree` is made of one or more `Branches` and a `Branch` is just a name to display and an optional list of `Branches`.
```scala
import treeline._
println(Tree()(Branch("foo", Branch("bar", Branch("baz")), Branch("boom"))))
```
foo
├─┬ bar
│ └── baz
└── boom
You can also render in ascii where unicode is not supported by calling the `ascii` method on a tree.
```scala
println(Tree().ascii(Branch("foo", Branch("bar", Branch("baz")), Branch("boom"))))
```
This will render
foo
+-- bar
| `-- baz
`-- boom
Doug Tangren (softprops) 2013