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.0.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.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: slither_cli-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 f3f0d4deecaf4ef6e162313452fd638b467d136310f4d9adf48a4ba6e57cfb1f
MD5 2d8bad4759bf4e84e757f0db8d61a341
BLAKE2b-256 130b6c3ade8d85051b9409bfa269b86cbb5af1e273054f2ba1ce3ed641bf640f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for slither_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eb8516165005fddd89443af9dfa01938155cd3a16af1c2064ee35aa6bc6c147d
MD5 acba6433f04d4755551fcb14ffa5a523
BLAKE2b-256 4a6513142fb268aafd2be3d66502c3a25467ccb39219e6adb8b05760440c54af

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