GitHub Maven Central Version Scaladoc

files-tree

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

Table of contents

Dependencies

Usage

Use with SBT

libraryDependencies += "org.encalmo" %% "files-tree" % "0.9.3"

or with SCALA-CLI

//> using dep org.encalmo::files-tree:0.9.3

Examples

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

Project content

├── .github
│   └── workflows
│       ├── pages.yaml
│       ├── release.yaml
│       └── test.yaml
│
├── .gitignore
├── .scalafmt.conf
├── FilesTree.scala
├── FilesTree.test.scala
├── LICENSE
├── project.scala
├── README.md
└── test.sh