https://github.com/borodean/asciitree
Human-friendly Go module that builds and prints directory trees using ASCII art
https://github.com/borodean/asciitree
Last synced: 10 months ago
JSON representation
Human-friendly Go module that builds and prints directory trees using ASCII art
- Host: GitHub
- URL: https://github.com/borodean/asciitree
- Owner: borodean
- License: mit
- Created: 2021-12-25T00:02:18.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-02-08T17:04:58.000Z (over 4 years ago)
- Last Synced: 2025-06-20T21:49:08.481Z (about 1 year ago)
- Language: Go
- Homepage: https://pkg.go.dev/github.com/borodean/asciitree
- Size: 37.1 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Go Reference][go-reference-badge]][go-reference]
[![Codacy Quality][codacy-quality-badge]][codacy-dashboard]
[![Codecov Coverage][codecov-coverage-badge]][codecov-coverage]
# ![asciitree][asciitree-logo]
Human-friendly Go module that builds and prints directory trees using ASCII art.
## Installation
```bash
go get github.com/borodean/asciitree
```
## Usage
```go
// 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)
```
## License
MIT.
[go-reference-badge]: https://pkg.go.dev/badge/github.com/borodean/asciitree.svg
[go-reference]: https://pkg.go.dev/github.com/borodean/asciitree
[codacy-quality-badge]: https://app.codacy.com/project/badge/Grade/c5ef187cb0fa41f4ad4fa4f635cc8cd6
[codacy-dashboard]: https://www.codacy.com/gh/borodean/asciitree/dashboard
[codecov-coverage-badge]: https://codecov.io/gh/borodean/asciitree/branch/main/graph/badge.svg?token=UNHXM8TZJ4
[codecov-coverage]: https://codecov.io/gh/borodean/asciitree
[asciitree-logo]: ./logo.svg