A fast, customizable command-line tool for generating tree-like representations of directory structures, with intelligent handling of .gitignore rules and cross-platform compatibility.
- This project is a fork from chrisw-org/tree-view-cli
- π Fast execution: Optimized Python implementation for quick directory processing
- π Gitignore support: Automatically respects .gitignore rules to match version-controlled projects
- π² Customizable depth: Control how many levels of directories to display
- π Cyclic detection: Prevents infinite loops from symbolic links
- π₯οΈ Cross-platform: Works consistently across Windows, macOS, and Linux
- Python 3.6 or higher
uv tool install "git+https://github.com/kaiosilva-dataeng/tree-view-cli.git@main"# Clone the repository
git clone https://github.com/kaiosilva-dataeng/tree-view-cli.git
cd tree-view-cli
# Install dependencies using uv
uv syncIn case the project is not installed automatically, please refer to the following steps to resolve the issue:
uv tool install .Basic usage:
tree-view /path/to/directoryLimiting directory depth:
tree-view /path/to/directory --max-depth 2directory: The path to the directory you want to visualize (required)--max-depth: Maximum depth to display (optional, default is unlimited)
my-project/
βββ src/
β βββ main.py
β βββ utils/
β βββ helper.py
β βββ config.py
βββ tests/
β βββ test_main.py
β βββ test_utils.py
βββ README.md
βββ requirements.txt
# Create and activate a virtual environment
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install development dependencies
uv sync --dev# Run tests
task test
# Run linting
task lint
# Format code
task formatThe project uses taskipy to manage common development tasks:
task lint: Run Ruff linting checkstask format: Format code with Rufftask run: Run the tree-view-cli on the current directorytask test: Run the test suite with coverage reporting
For Docker-based development and deployment, see Docker Setup.
The Docker setup provides:
- Multi-stage builds for efficient image size
- Development environment with hot reloading
- Separate services for testing and coverage viewing
- Security-focused production configuration
This project uses GitHub Actions for continuous integration. The workflow includes:
- Linting and code formatting checks using Ruff
- Running tests with pytest
- Coverage reporting
tree-view-cli/
βββ .github
β βββ workflows
β βββ ci.yml # GitHub Actions CI workflow
βββ .vscode # VS Code configuration
βββ src
β βββ tree_view_cli
β βββ tree_view_cli.py # Main application module
βββ tests
β βββ conftest.py # Test fixtures and setup
β βββ test_tree_view_cli.py # Test suite
βββ .dockerignore # Files to exclude from Docker context
βββ .gitignore # Files to exclude from git
βββ .pre-commit-config.yaml # Pre-commit hooks configuration
βββ .python-version # Python version specification
βββ compose.yaml # Docker Compose configuration
βββ Dockerfile # Docker configuration
βββ LICENSE # Project license
βββ Makefile # Make commands for Docker
βββ pyproject.toml # Project metadata and dependencies
βββ README.Docker.md # Docker-specific documentation
βββ README.md # Project documentation
βββ uv.lock # Dependency lock file
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add some amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Thanks to the Python community for the robust standard library functions that make this tool possible
- Inspired by the Unix
treecommand, but with additional features for modern development workflows