Skip to content
The Artifex (4r7if3x) edited this page Aug 19, 2024 · 2 revisions

Notes

  • TreeGen works on all major operating systems including BSD, Linux, macOS, and Windows.
  • TreeGen does not overwrite your existing files.

Installation

Download the appropriate binary or package for your processor architecture and operating system from the latest release. Then, you can install it as a system command:

BSD, Linux, and macOS
sudo chmod +x /path/to/treegen
sudo mv /path/to/treegen /usr/bin/treegen
Windows
Unblock-File -Path "C:\path\to\treegen.exe"
Move-Item -Path "C:\path\to\treegen.exe" -Destination "C:\Windows\System32\treegen.exe"

or, follow the instructions below to install the provided packages:

Debian-based Linux distros
sudo apt install /path/to/treegen.deb
RedHat-based Linux distros
sudo dnf install /path/to/treegen.rpm

otherwise, you can also compile and install it directly from the source if you have Go installed on your system:

go install github.com/bilbilak/treegen

Usage

treegen --help

Examples:

BSD, Linux, and macOS
treegen /path/to/tree.txt
treegen < /path/to/tree.txt
cat /path/to/tree.txt | treegen
treegen <<EOF
myProject/
├── README.md
├── src/
│   ├── main.js
│   ├── components/
│   │   ├── Header.js
│   │   ├── Footer.js
│   │   └── shared/
│   │	   ├── Button.js
│   │	   └── Slider.js
│   └── utils/
│	   ├── helpers.js
│	   └── test/
│		   ├── helper.test.js
│		   └── mockData.js
├── lib/
│   ├── middleware.js
│   └── database.js
├── tests/
│   ├── main.test.js
│   └── components/
│	   ├── Header.test.js
│	   └── Footer.test.js
└── package.json
EOF
Windows
treegen "C:\path\to\tree.txt"
Get-Content "C:\path\to\tree.txt" | treegen
$tree = @"
myProject/
├── README.md
├── src/
│   ├── main.js
│   ├── components/
│   │   ├── Header.js
│   │   ├── Footer.js
│   │   └── shared/
│   │	   ├── Button.js
│   │	   └── Slider.js
│   └── utils/
│	   ├── helpers.js
│	   └── test/
│		   ├── helper.test.js
│		   └── mockData.js
├── lib/
│   ├── middleware.js
│   └── database.js
├── tests/
│   ├── main.test.js
│   └── components/
│	   ├── Header.test.js
│	   └── Footer.test.js
└── package.json
"@

$tree.Trim() | treegen
@"myProject/
 ├── README.md
 ├── src/
 │   ├── main.js
 │   ├── components/
 │   │   ├── Header.js
 │   │   ├── Footer.js
 │   │   └── shared/
 │   │	   ├── Button.js
 │   │	   └── Slider.js
 │   └── utils/
 │	   ├── helpers.js
 │	   └── test/
 │		   ├── helper.test.js
 │		   └── mockData.js
 ├── lib/
 │   ├── middleware.js
 │   └── database.js
 ├── tests/
 │   ├── main.test.js
 │   └── components/
 │	   ├── Header.test.js
 │	   └── Footer.test.js
 └── package.json"@ | treegen
Clone this wiki locally