dirtree

Package Version Hex Docs

gleam add dirtree@1

A simple package for loading, reordering, and pretty-printing directory trees.

import dirtree

pub fn main() -> Nil {
  let tree = dirtree.from_paths(
    "../examples",
    [
      "futuristic/pngs/png2.png",
      "futuristic/svgs/svg2.png",
      "futuristic/svgs/svg1.png",
      "notes/README.md",
      "futuristic/pngs/png1.png",
      "empty-directory/",
    ],
  )

  tree
  |> dt.pretty_print
  |> string.join("\n")
  |> io.println

  // ->
  //
  // ../examples
  //    ├─ empty-directory
  //    ├─ futuristic
  //    │  ├─ pngs
  //    │  │  ├─ png1.png
  //    │  │  └─ png2.png
  //    │  └─ svgs
  //    │     ├─ svg1.png
  //    │     └─ svg2.png
  //    └─ notes
  //       ├─ README.md
  //       └─ old-README.md
}

Further documentation can be found at https://hexdocs.pm/dirtree.

Development

gleam run   # Run the project
gleam test  # Run the tests
Search Document