Skip to main content

Create complex project structures effortlessly.

Project description

Maketree CLI

GitHub Repository Latest PyPi version supported Python versions Project licence Black PyPI - Downloads

Create project structures effortlessly with a single command.

๐Ÿ“œ Overview

Maketree is a powerful CLI tool that generates directories and files based on a predefined structure. Instead of manually creating folders and files, just define your structure and let Maketree handle the rest.

๐Ÿ’ก Why Maketree?

  • Saves Time: No more manually creating directories and files.
  • Consistency: Maintain a standard project structure across all your projects.
  • Easy to Use: Define a structure in plain text and generate it instantly.

๐Ÿง Features:

  • Supports nested directory structures
  • Automatically creates missing parent directories
  • Flexible file handling with warning, skip, and overwrite options
  • Preview the directory tree before creation
  • Color support
  • Simple and easy to write structure syntax
  • Lightweight, fast, and has zero dependencies
  • Simple and user-friendly CLI

๐Ÿ› ๏ธ Installation:

Install via pip:

Maketree is available on PyPI. (Recommended if you're a python developer and have python already installed on your system)

You can install it using:

pip install maketree

python>=3.8 must be installed on your system.

Install from Source:

If you are installing from source, you will need python>=3.8.

git clone https://github.com/Anas-Shakeel/maketree-cli.git
cd maketree-cli
pip install .

Download Standalone Executable: (No Python Required)

Maketree provides standalone binaries for Linux, macOS, and Windows. (Recommended if you don't want to install Python.)

  • Download the latest release from the Releases page.

  • (Optional) Move the executable to a directory in your system's PATH (e.g., /usr/local/bin on Linux/macOS OR C:\maketree on Windows).

  • Run maketree from the terminal.

    maketree -h
    

โšก Quickstart:

Define your project structure in a .tree file:

structure.tree

my_project/
    src/
        main.py
        utils.py
    tests/
        test_main.py
    README.md
    .gitignore

Then, run:

maketree structure.tree

This will instantly generate the entire structure in your current directory.

๐Ÿ“– Usage

You can maketree from any location in your terminal. (If installed via pip or if moved the executable to a directory recognized by system's PATH)

๐Ÿ”น Display Help

maketree -h

This will show the available commands and options:

usage: maketree [OPTIONS]

Create complex project structures effortlessly.

positional arguments:
  src                source file (with .tree extension)
  dst                where to create the tree structure (default: .)

options:
  -h, --help         show this help message and exit
  -cd, --create-dst  create destination folder if it doesn't exist.
  -g, --graphical    show source file as graphical tree and exit
  -o, --overwrite    overwrite existing files
  -s, --skip         skip existing files
  -nc, --no-color    don't use colors in output
  -nC, --no-confirm  don't ask for confirmation
  -v, --verbose      enable verbose mode

Maketree 1.1.0

๐Ÿ”น Creating a Directory Structure

Maketree reads .tree file that defines the folder and file structure and then creates the corresponding structure on your filesystem.

1๏ธโƒฃ Define the Structure

Create a file named myapp.tree:

src/
    style.css
    app.js
    index.html

This will create a src folder with three files: index.html, style.css, and app.js.

2๏ธโƒฃ Generate the Structure

To generate the structure, Run:

maketree myapp.tree

It will ask for confirmation with a graphical representation of the structure.

.
โ””โ”€โ”€โ”€ src/
โ”‚   โ”œโ”€โ”€โ”€ app.js
โ”‚   โ”œโ”€โ”€โ”€ index.html
โ”‚   โ””โ”€โ”€โ”€ style.css
Create this structure? (y/N):

Output:

1 directory and 3 files have been created.

By default, maketree creates the structure in the current directory.

๐Ÿ”น Rules for Writing a .tree File

To ensure correctness, follow these three rules:

  1. Directories must end with /
  2. Indentation must be exactly 4 spaces (other indentations may cause unexpected results)
  3. File and folder names must be valid according to your OS

Example: (Not so) Complex Structure

myapp.tree

node_modules/
public/
    favicon.ico
    index.html
    robots.txt
src/
    index.css
    index.js
.gitignore
package.json
README.md

Now, run:

maketree myapp.tree

Output: (After confirming)

3 directories and 8 files have been created.

๐Ÿ”น Specifying a Destination Folder

You can specify a destination folder instead of creating the structure in the current directory.

maketree myapp.tree myapp/

It will throw an error if myapp/ does not exist.

Error: destination path 'myapp' does not exist.

Use --create-dst or -cd flag, maketree then creates the destination directory if it doesn't exists.

maketree myapp.tree myapp/ --create-dst

Output:

3 directories and 8 files have been created.

๐Ÿ”น Handling Existing Files

If you run maketree again in the same directory without deleting files, youโ€™ll see an error:

maketree myapp.tree myapp

Output:

Error: Found 8 existing files, cannot proceed. (try --skip or --overwrite)

By default, maketree does not overwrite or skip existing files.

1๏ธโƒฃ Overwrite Existing Files

Use the --overwrite or -o flag to overwrite existing files:

maketree myapp.tree myapp --overwrite

Output:

0 directories and 8 files have been created.

2๏ธโƒฃ Skip Existing Files

Use the --skip or -s flag to keep existing files but create missing ones:

maketree myapp.tree myapp --skip

Output: (After deleting 3 files)

0 directories and 3 files have been created.

๐Ÿ”น Preview the Structure

Use --graphical or -g to visualize the myapp.tree file:

maketree myapp.tree -g

Output:

.
โ”œโ”€โ”€โ”€ node_modules/
โ”œโ”€โ”€โ”€ public/
โ”‚   โ”œโ”€โ”€โ”€ favicon.ico
โ”‚   โ”œโ”€โ”€โ”€ index.html
โ”‚   โ””โ”€โ”€โ”€ robots.txt
โ”œโ”€โ”€โ”€ src/
โ”‚   โ”œโ”€โ”€โ”€ index.css
โ”‚   โ””โ”€โ”€โ”€ index.js
โ”œโ”€โ”€โ”€ .gitignore
โ”œโ”€โ”€โ”€ package.json
โ””โ”€โ”€โ”€ README.md

It is also shown before you create a structure for confirmation.

๐Ÿ”น Avoid Confirming:

By default, maketree confirms before creating the structure. But this can sometimes be anoyying. Use --no-confirm or -nC flag to create the structure without confirming. (Notice the C is capital in -nC)

maketree myapp.tree myapp --no-confirm

๐Ÿ”น Avoid Color Output:

By default, maketree uses ANSI escape codes to color the output.

maketree myapp.tree myapp/

If you're seeing something like this:

โ†[1mโ†[3mโ†[92msrc/โ†[0m
โ†[90mโ”œโ”€โ”€โ”€โ†[0m โ†[1mโ†[3mโ†[92mnode_modules/โ†[0m
โ†[90mโ”œโ”€โ”€โ”€โ†[0m โ†[1mโ†[3mโ†[92mpublic/โ†[0m
โ†[90mโ”‚   โ†[0mโ†[90mโ”œโ”€โ”€โ”€โ†[0m favicon.ico
โ†[90mโ”‚   โ†[0mโ†[90mโ”œโ”€โ”€โ”€โ†[0m index.html
โ†[90mโ”‚   โ†[0mโ†[90mโ””โ”€โ”€โ”€โ†[0m robots.txt
โ†[90mโ”œโ”€โ”€โ”€โ†[0m โ†[1mโ†[3mโ†[92msrc/โ†[0m
โ†[90mโ”‚   โ†[0mโ†[90mโ”œโ”€โ”€โ”€โ†[0m index.css
โ†[90mโ”‚   โ†[0mโ†[90mโ””โ”€โ”€โ”€โ†[0m index.js
โ†[90mโ”œโ”€โ”€โ”€โ†[0m .gitignore
โ†[90mโ”œโ”€โ”€โ”€โ†[0m package.json
โ†[90mโ””โ”€โ”€โ”€โ†[0m README.md
โ†[95mCreate this structure? (y/N): โ†[0m

Then your terminal doesn't support ANSI escape codes by default. (there are workarounds but they require extra python dependencies).

You will have to disable colors using --no-color or -nc flag.

maketree myapp.tree myapp/ --no-color

This will disable colors and you'll see normal text again.

๐Ÿš€ Summary

Feature Command Example
Create structure maketree myapp.tree
Set destination maketree myapp.tree myapp -cd
Overwrite files maketree myapp.tree myapp -o
Skip existing maketree myapp.tree myapp -s
Graphical preview maketree myapp.tree -g
Avoid Confirm maketree myapp.tree myapp -nC
Avoid Colors maketree myapp.tree myapp -nc

๐Ÿ”— Compatibility

Maketree is compatible with the following operating systems and Python versions:

OS Compatibility
Linux โœ… Supported
macOS โœ… Supported
Windows โœ… Supported

๐Ÿ Python Version Support

Maketree works with Python 3.8 and later, ensuring compatibility with the latest Python releases.

Python Version Compatibility
3.8 โœ… Supported
3.9 โœ… Supported
3.10 โœ… Supported
3.11 โœ… Supported
3.12 โœ… Supported
3.13 โœ… Supported (Latest)

โ“ FAQ

โ“ What is Maketree?

Maketree is a command-line tool that helps developers quickly generate a predefined folder and file structures for your projects. It eliminates the need to manually create directories and files, allowing developers to start coding right away with a well-organized project structure.

โ“ Do I have to be a Software Developer to use Maketree?

No, you can be anyone. You can be a lawyer, student, or heck even Yavascript programmer.

โ“ Why should I use Maketree?

If you frequently create CLI applications, Maketree saves you time by setting up a standardized project structure instantly. It follows best practices and helps you maintain consistency across different projects.

โ“ How do I install Maketree?

You can install Maketree via pip. (for python developers)

pip install maketree

Or download the executable for your OS from Releases page.

โ“ How do I use Maketree to generate a project structure?

Simply create a file like anything.tree and define your project structure in it:

anything.tree

src/
    app.js
    index.html
    style.css

then run the following command:

maketree anything.tree

This will create the files and folders you specified in anything.tree file.

โ“ What should I do if I find a bug?

If you encounter a bug, please open an issue on GitHub with details about the problem. Be sure to include:

  • A description of the issue
  • Steps to reproduce
  • Expected vs. actual behavior
  • Any error messages you received

โ“ How do I uninstall Maketree?

To uninstall Maketree (installed via pip), Run:

pip uninstall maketree

Contributing

Contributions to Maketree are welcome and highly appreciated. However, before you jump right into it, i would like you to review Contribution Guidelines to make sure you have a smooth experience contributing to Maketree.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

maketree-1.1.0.tar.gz (23.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

maketree-1.1.0-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

File details

Details for the file maketree-1.1.0.tar.gz.

File metadata

  • Download URL: maketree-1.1.0.tar.gz
  • Upload date:
  • Size: 23.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.0

File hashes

Hashes for maketree-1.1.0.tar.gz
Algorithm Hash digest
SHA256 ffc9f0bfe919e6ba210cf6ffb540e6505b17e9352087f7b6e6e27fd1d9a165a0
MD5 9202b73ffab3b80155c8baeee23cfbd9
BLAKE2b-256 4ab426c00eaf0e41c3c98bcc5ae862f91f5e54ebe891da0e078d7ff86c3c95df

See more details on using hashes here.

File details

Details for the file maketree-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: maketree-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 22.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.0

File hashes

Hashes for maketree-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 adc24e25d30a3683c1e0ae42c53bc6585db39b017663974576afcd13e980cfa5
MD5 3dfb229ca4d95bf7f340de41833225c9
BLAKE2b-256 778d528482bf1c8ded426525b9e71c66399eb5992e7739e0326ce36f3981c5a2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page