Human-friendly Go module that builds and prints directory trees using ASCII art.
go get github.com/borodean/asciitree
// Build a directory tree representation:
tree := asciitree.NewDir("albums").Add(
asciitree.NewFile("ONUKA.jpg"),
asciitree.NewDir("VIDLIK").AddFiles(
"Svitanok.mp3",
"Vidlik.mp3",
),
asciitree.NewDir("KOLIR").AddFiles(
"CEAHC.mp3",
"ZENIT.mp3",
"UYAVY (feat. DakhaBrakha).mp3",
"XASHI.mp3",
),
)
// Sort the tree's descendants alphanumerically while placing directories
// before files:
tree.Sort(asciitree.WithDirsFirst(true))
// Print an ASCII art representation of the directory tree:
fmt.Println(tree)
MIT.