Skip to content

AmirmasoudCS/Tree-Printer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

182 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌲 Tree Printer

GitHub Release Tests License Python

A lightweight and customizable command-line utility for generating beautiful directory tree structures directly from your terminal.

Tree Printer makes it easy to visualize project layouts, document repositories, create examples for documentation, and inspect filesystem structures with optional icons, metadata, filtering, sorting, and color themes.


✨ Features

  • 🌳 Generate recursive directory trees
  • πŸ“ Display directories only
  • πŸ‘οΈ Show or hide hidden files
  • 🚫 Exclude files, directories, or file extensions
  • πŸ“ Limit recursion depth
  • πŸ”€ Sort entries by:
    • Name
    • Size
    • Last modified date
  • πŸ“Š Display file size
  • πŸ•’ Display modification timestamps
  • 🎨 Multiple color themes
  • πŸ–ΌοΈ Optional file and folder icons
  • πŸ“ Export output to text files
  • 🚫 Respect .gitignore
  • ⚑ Fast and lightweight
  • πŸ§ͺ Fully tested with pytest
  • πŸ”„ Continuous Integration using GitHub Actions

πŸ“¦ Installation

From PyPI (Recommended)

pip install directory-tree-printer

From source

git clone https://github.com/AmirmasoudCS/Tree-Printer.git

cd Tree-Printer

pip install .

πŸš€ Quick Start

Print the current directory

tp .

Print another directory

tp path/to/project

Print only directories

tp --dirs-only

Show icons

tp --icons

Show file sizes

tp --size

Limit depth

tp --max-depth 2

Save output

tp --output tree.txt

πŸ“– Examples

Basic

tp .
project
β”œβ”€β”€ src
β”‚   β”œβ”€β”€ main.py
β”‚   └── utils.py
β”œβ”€β”€ README.md
└── pyproject.toml

Icons

tp --icons
πŸ“ project
β”œβ”€β”€ πŸ“ src
β”‚   β”œβ”€β”€ 🐍 main.py
β”‚   └── 🐍 utils.py
β”œβ”€β”€ πŸ“˜ README.md
└── βš™οΈ pyproject.toml

File Sizes

tp --size
README.md (5.8 KB)
main.py (4.2 KB)
config.py (831 B)

Modified Dates

tp --modified
README.md (2026-05-12 18:42)
main.py (2026-05-11 14:30)

Themes

tp --theme sunset

Sunset Theme


βš™οΈ CLI Options

Option Alias Description
--max-depth -md Limit recursion depth
--show-hidden -sh Include hidden files
--dirs-only -do Show only directories
--exclude-dirs -ed Exclude directories
--exclude-files -ef Exclude files
--exclude-suffixes -es Exclude file extensions
--sort -st Sort by name, size or modified
--size -s Display file sizes
--modified -m Display modified dates
--icons -i Display icons
--theme -th Select a color theme
--no-color -nc Disable colored output
--gitignore -gi Ignore files listed in .gitignore
--output -o Write output to a file
--version -v Show installed version

πŸ§ͺ Development

Clone the repository

git clone https://github.com/AmirmasoudCS/Tree-Printer.git

Install development dependencies

pip install -e ".[dev]"

Run the test suite

pytest

Run tests with coverage

pytest --cov=tree_printer --cov-report=term-missing

Build the package

python -m build

Verify the package

python -m twine check dist/*

πŸ“‚ Project Structure

 
β”œβ”€β”€ πŸ“ images
β”‚   └── πŸ–ΌοΈ themeImage1.png
β”œβ”€β”€ πŸ“ tests
β”‚   β”œβ”€β”€ 🐍 __init__.py
β”‚   β”œβ”€β”€ 🐍 test_cli.py
β”‚   β”œβ”€β”€ 🐍 test_formatter.py
β”‚   └── 🐍 test_printer.py
β”œβ”€β”€ πŸ“ tree_printer
β”‚   β”œβ”€β”€ 🐍 __init__.py
β”‚   β”œβ”€β”€ 🐍 cli.py
β”‚   β”œβ”€β”€ 🐍 config.py
β”‚   β”œβ”€β”€ 🐍 file_types.py
β”‚   β”œβ”€β”€ 🐍 formatter.py
β”‚   β”œβ”€β”€ 🐍 icons.py
β”‚   β”œβ”€β”€ 🐍 models.py
β”‚   β”œβ”€β”€ 🐍 printer.py
β”‚   └── 🐍 themes.py
β”œβ”€β”€ πŸ“˜ CHANGELOG.md
β”œβ”€β”€ βš–οΈ LICENSE
β”œβ”€β”€ 🐍 main.py
β”œβ”€β”€ βš™οΈ pyproject.toml
β”œβ”€β”€ πŸ“˜ README.md
└── πŸ“ requirements-dev.txt

πŸ›£οΈ Roadmap

Future improvements include:

  • Additional export formats
  • Custom icon packs
  • More color themes
  • Configuration file support
  • Improved Windows terminal support
  • Performance improvements for very large directories

Suggestions and pull requests are always welcome.


🀝 Contributing

Contributions, feature requests, and bug reports are welcome.

If you'd like to contribute:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run the test suite
  5. Submit a Pull Request

πŸ“œ Changelog

See CHANGELOG.md for release history.


βš–οΈ License

This project is licensed under the MIT License.

See LICENSE for details.


Packages

 
 
 

Contributors

Languages