Skip to content

kaiosilva-dataeng/tree-view-cli

Β 
Β 

Repository files navigation

tree-view-cli

A fast, customizable command-line tool for generating tree-like representations of directory structures, with intelligent handling of .gitignore rules and cross-platform compatibility.

Features

  • πŸš€ 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

Requirements

  • Python 3.6 or higher

Installation

Automatic by Astral uv

uv tool install "git+https://github.com/kaiosilva-dataeng/tree-view-cli.git@main"

Manual

# Clone the repository
git clone https://github.com/kaiosilva-dataeng/tree-view-cli.git
cd tree-view-cli

# Install dependencies using uv
uv sync

Troubleshooting Project Installation Issues

In case the project is not installed automatically, please refer to the following steps to resolve the issue:

uv tool install .

Usage

Basic usage:

tree-view /path/to/directory

Limiting directory depth:

tree-view /path/to/directory --max-depth 2

Options

  • directory: The path to the directory you want to visualize (required)
  • --max-depth: Maximum depth to display (optional, default is unlimited)

Example Output

my-project/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.py
β”‚   └── utils/
β”‚       β”œβ”€β”€ helper.py
β”‚       └── config.py
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ test_main.py
β”‚   └── test_utils.py
β”œβ”€β”€ README.md
└── requirements.txt

Development

Setting Up Development Environment

# Create and activate a virtual environment
uv venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install development dependencies
uv sync --dev

Running Tests

# Run tests
task test

# Run linting
task lint

# Format code
task format

Development Tasks

The project uses taskipy to manage common development tasks:

  • task lint: Run Ruff linting checks
  • task format: Format code with Ruff
  • task run: Run the tree-view-cli on the current directory
  • task test: Run the test suite with coverage reporting

Docker Support

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

CI/CD

This project uses GitHub Actions for continuous integration. The workflow includes:

  • Linting and code formatting checks using Ruff
  • Running tests with pytest
  • Coverage reporting

Project Structure

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

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add some amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

License

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

Acknowledgments

  • Thanks to the Python community for the robust standard library functions that make this tool possible
  • Inspired by the Unix tree command, but with additional features for modern development workflows

About

A fast, cross-platform command-line utility for generating tree-like directory structure visualizations with smart .gitignore handling. Forked from chrisw-org/tree-view-cli, this version includes enhanced installation options via pip, uv, and manual installation methods, placing the CLI tool globally on your PATH for convenient access.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 81.0%
  • Dockerfile 11.6%
  • Makefile 7.4%