๐ŸŒณ Tree Weaver

A lightning-fast, cross-platform file structure generator written in Erlang. Tree Weaver enables you to easily define and create directory structures using simple tree-like text files.

VersionLicenseErlang

๐Ÿ“‹ Table of Contents

๐Ÿ” Overview

Tree Weaver transforms text-based tree representations into actual directory structures. It's perfect for:

โœจ Features

๐Ÿš€ Installation

Prerequisites

Installing Erlang

macOS (Homebrew)

brew update
brew install erlang

Ubuntu/Debian

# Add Erlang Solutions repository
wget https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb
sudo dpkg -i erlang-solutions_2.0_all.deb
sudo apt-get update
sudo apt-get install esl-erlang

Windows

  1. Download from Official Erlang Website
  2. Run the installer
  3. Add Erlang to system PATH

Using Prebuilt Binaries

Download the latest release from our GitHub Releases page.

Building from Source

# Clone the repository
git clone https://github.com/zackkitzmiller/tree-weaver.git
cd tree-weaver

# If you have 'just' installed (recommended)
just setup
just build

# Or using rebar3 directly
rebar3 compile
rebar3 escriptize

The executable will be available at _build/default/bin/tree-weaver.

๐ŸŽฌ Usage

# Basic usage with a tree file
tree-weaver project.tree

# Dry run (preview without creating files)
tree-weaver --dry-run project.tree

# Custom destination
tree-weaver --dest /path/to/destination project.tree

# Use current directory as root (skips creating the root directory)
tree-weaver --dest . project.tree

# Display help
tree-weaver

๐Ÿ“ Examples

Simple Project Structure

Create a file simple-project.tree:

simple-project/
|-- src/
|   |-- main.erl
|-- test/
|   |-- main_tests.erl
|-- README.md

Run:

tree-weaver simple-project.tree

This creates:

simple-project/
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ main.erl
โ”œโ”€โ”€ test/
โ”‚   โ””โ”€โ”€ main_tests.erl
โ””โ”€โ”€ README.md

Complex Web Application

See the feelsbank.tree example in the repository for a complex Go web application structure.

๐Ÿ“„ File Format

Tree Weaver uses a simple text format to represent directory structures:

  1. First line: Root directory name
  2. Subsequent lines: Directory structure with indentation
  3. Lines ending with /: Directories
  4. Lines without /: Files
  5. Comments: Use # Comment text anywhere in a line

Example with comments:

my-project/  # Root directory
|-- src/     # Source code
|   |-- main.erl  # Main entry point
|-- README.md     # Documentation

Indentation Rules

๐Ÿ”ง Command Line Options

Tree Weaver supports the following command line options:

Option Description
--dry-run Show what would be created without making changes
--dest PATH Specify destination path (default: current directory)
--dest . Use current directory as root (skip creating root directory)

๐Ÿ’ป Development

Using Just

We recommend using Just for common development tasks:

# Setup development environment
just setup

# Compile
just compile

# Run tests
just test

# Create executable
just build

# Create sample and run with it
just demo

Manual Development

If you prefer not to use Just:

# Compile the project
rebar3 compile

# Run tests
rebar3 eunit

# Create executable
rebar3 escriptize

# Start dev shell
rebar3 shell

๐Ÿงช Testing

Run the test suite:

just test
# or
rebar3 eunit

To run a specific test:

just test-one tree_weaver_tests
# or
rebar3 eunit --module=tree_weaver_tests

๐Ÿค Contributing

We welcome contributions! See CONTRIBUTING.md for details.

Quick steps:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add or update tests
  5. Submit a pull request

Please follow the Code of Conduct.

๐Ÿ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgements


Built with โค๏ธ by Zack Kitzmiller# Tree Weaver