Skip to main content

Display directory structure as a tree in your terminal

Project description

slither-cli

A Python CLI tool for displaying directory structure as ASCII art trees in your terminal.

Features

  • Display directory trees with beautiful ASCII art formatting
  • Customizable depth limiting
  • Pattern-based file filtering (include/exclude)
  • Show/hide hidden files
  • Display file sizes in bytes or human-readable format
  • Reverse sort order
  • Directories-only mode

Installation

Prerequisites

  • Python 3.13 or higher
  • uv package manager

Install from source

git clone https://github.com/jesshart/slither-cli.git
cd slither-cli
uv sync

Usage

Basic usage

# Display current directory
uv run slither

# Display specific directory
uv run slither /path/to/dir

Options

# Limit depth to 2 levels
uv run slither -L 2

# Show hidden files
uv run slither -a

# Show directories only
uv run slither -d

# Show only Python files
uv run slither -P "*.py"

# Ignore compiled Python files
uv run slither -I "*.pyc"

# Show file sizes in human-readable format
uv run slither -s -h

# Reverse sort order
uv run slither -r

# Combine multiple options
uv run slither -L 3 -a -P "*.py" -s -h

All available options

Option Long form Description
-L --level Max display depth of the directory tree
-a --all Print all files, including hidden files
-d --dirs-only List directories only
-P --pattern List only files that match the pattern (wildcard)
-I --ignore Do not list files that match the pattern
-s --size Print file sizes in bytes
-h --human Print file sizes in human-readable format
-r --reverse Sort output in reverse order

Example Output

/Users/jesse/Repos/personal/slither-cli
├── slither
│   ├── __init__.py
│   ├── cli.py
│   └── tree.py
├── main.py
├── pyproject.toml
├── README.md
└── uv.lock

1 directory, 6 files

Development

Project structure

slither-cli/
├── slither/           # Main package
│   ├── __init__.py   # Package initialization
│   ├── cli.py        # Typer-based CLI interface
│   └── tree.py       # Core tree building and rendering logic
├── main.py           # Alternative entry point
├── pyproject.toml    # Project configuration
└── uv.lock           # Dependency lock file

Built with

  • Typer - CLI framework
  • Rich - Terminal formatting

License

This project is open source and available under the MIT License.

Author

Created by Jesse Hart

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

slither_cli-0.1.1.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

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

slither_cli-0.1.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file slither_cli-0.1.1.tar.gz.

File metadata

  • Download URL: slither_cli-0.1.1.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.17

File hashes

Hashes for slither_cli-0.1.1.tar.gz
Algorithm Hash digest
SHA256 75d7b09aca71051eaf63544b105248d07bfd9435b5cd60a78bd32cc57b752cc9
MD5 552d30834d74033447e5c0b2e1ec270b
BLAKE2b-256 1ce77fd988596db7556fe6c73052819ae424289588e6011bba1cccec951b31fd

See more details on using hashes here.

File details

Details for the file slither_cli-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for slither_cli-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2f9f491942a9555cef6ce09b60b102d41ef893ef5381b758aa98bafc328d6eab
MD5 c1ccb0f1c4a3db4dfe351c7585ac4630
BLAKE2b-256 9f8d8d653baf2b77136d18c33cc60e59d3adf533f4cd478902013f90d5f5c985

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