A small Scala 3 utility to draw a files tree, like:
├── bar
│ └── foo
│ └── foo.bar
│
├── foo
│ └── zoo
│ └── bar.txt
│
├── zoo
│ └── foo
│ └── bar
│ └── zoo.scala
│
└── zoo.scala
- Scala >= 3.3.5
Use with SBT
libraryDependencies += "org.encalmo" %% "files-tree" % "0.9.3"
or with SCALA-CLI
//> using dep org.encalmo::files-tree:0.9.3
val pathTree = FilesTree.compute(
Seq(
Paths.get("/test"),
Paths.get("/test", "foo", "bar.txt"),
Paths.get("foo.bar"),
Paths.get("/test", "test.scala")
)
)
FilesTree.draw(pathTree) shouldBe
"""├── foo.bar
|└── test
| ├── foo
| │ └── bar.txt
| │
| └── test.scala""".stripMargin├── .github
│ └── workflows
│ ├── pages.yaml
│ ├── release.yaml
│ └── test.yaml
│
├── .gitignore
├── .scalafmt.conf
├── FilesTree.scala
├── FilesTree.test.scala
├── LICENSE
├── project.scala
├── README.md
└── test.sh