A powerful CLI tool to visualize project directory structure with smart exclusions and multiple output formats
Project description
Structure Viewer
A powerful CLI tool to visualize project directory structure with smart exclusions, multiple output formats, and colorized output.
โจ Features
- ๐ณ Beautiful Tree Output - ASCII art tree representation with colorized output
- ๐ซ Smart Exclusions - Automatically excludes common development artifacts (
.git,node_modules,__pycache__, etc.) - ๐ Multiple Formats - Output as tree, JSON, or YAML
- ๐จ Colorized Output - File type-aware syntax highlighting in terminal
- ๐ง Highly Configurable - Custom exclusions, depth limiting, extension filtering
- ๐ฅ๏ธ Cross-Platform - Works on Windows, macOS, and Linux
๐ฆ Installation
Using pip
pip install structure-viewer
Using pipx (recommended for CLI tools)
pipx install structure-viewer
From source
git clone https://github.com/crrrowz/structure-viewer.git
cd structure-viewer
pip install -e .
๐ Usage
Basic Usage
# Show structure of current directory
structure
# Show structure of a specific directory
structure ./my-project
# Show structure with limited depth
structure -d 2
Output Formats
# Default tree format
structure
# JSON output
structure -f json
# YAML output (requires PyYAML)
structure -f yaml
Filtering
# Only show Python files
structure -I py
# Exclude log and tmp files
structure -E log -E tmp
# Add custom exclusion patterns
structure -e "*.bak" -e "*.tmp"
# Show hidden files
structure -a
Other Options
# Show only directories
structure -q
# Show file/directory statistics
structure -s
# Disable colors
structure --no-color
๐ Example Output
my-project/
โโโ src/
โ โโโ __init__.py
โ โโโ cli.py
โ โโโ core.py
โ โโโ utils.py
โโโ tests/
โ โโโ conftest.py
โ โโโ test_cli.py
โ โโโ test_core.py
โโโ LICENSE
โโโ README.md
โโโ pyproject.toml
2 directories, 10 files
โ๏ธ CLI Reference
usage: structure [OPTIONS] [DIRECTORY]
Visualize project directory structure.
positional arguments:
directory Directory to scan (default: current directory)
options:
-h, --help Show this help message
-V, --version Show version number
-d, --depth N Maximum depth to display (default: unlimited)
-e, --exclude PATTERN Additional patterns to exclude (can be repeated)
-I, --include-ext EXT Only show files with these extensions
-E, --exclude-ext EXT Exclude files with these extensions
-f, --format FORMAT Output format: tree, json, yaml (default: tree)
-a, --all Show hidden files
--no-color Disable colorized output
-q, --quiet Only show directories
-s, --stats Show statistics
๐ Default Exclusions
Structure Viewer automatically excludes common development artifacts:
| Category | Patterns |
|---|---|
| Version Control | .git, .hg, .svn |
| Python | __pycache__, .pytest_cache, .mypy_cache, *.egg-info |
| Node.js | node_modules, .npm, .yarn |
| Build | dist, build, out, target |
| IDEs | .idea, .vscode, .vs |
| OS | .DS_Store, Thumbs.db |
๐ Python API
You can also use structure-viewer as a library:
from structure_viewer import walk_directory, format_tree
# Get the directory tree
tree = walk_directory("./my-project", max_depth=3)
# Format as ASCII tree
output = format_tree(tree, colorize=False)
print(output)
# Or as JSON
from structure_viewer import format_json
json_output = format_json(tree)
๐ค Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
Inspired by the classic tree command and modern directory visualization tools.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file structure_viewer-1.0.1.tar.gz.
File metadata
- Download URL: structure_viewer-1.0.1.tar.gz
- Upload date:
- Size: 354.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4dc5870326e4f6309351095f73de906135d1a3bd3548dd048e3fd5e640ae9796
|
|
| MD5 |
ef59704f559acfd4cf71b39e4300cc6c
|
|
| BLAKE2b-256 |
d0e8a5c40f85e6f31d75303aac9d80f44805e4a090d98b76d9d50c656db465cc
|
Provenance
The following attestation bundles were made for structure_viewer-1.0.1.tar.gz:
Publisher:
publish.yml on crrrowz/structure-viewer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
structure_viewer-1.0.1.tar.gz -
Subject digest:
4dc5870326e4f6309351095f73de906135d1a3bd3548dd048e3fd5e640ae9796 - Sigstore transparency entry: 779064876
- Sigstore integration time:
-
Permalink:
crrrowz/structure-viewer@86192ad3b8b8b1f1987d40f6fbc6857671b60684 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/crrrowz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@86192ad3b8b8b1f1987d40f6fbc6857671b60684 -
Trigger Event:
release
-
Statement type:
File details
Details for the file structure_viewer-1.0.1-py3-none-any.whl.
File metadata
- Download URL: structure_viewer-1.0.1-py3-none-any.whl
- Upload date:
- Size: 14.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a12a9d8ec558ff78a060e7fc556430ce80ef8067c4c25cf7b122e0b8e461fd94
|
|
| MD5 |
766216b2354ffa43b42d3d0930e487e2
|
|
| BLAKE2b-256 |
93ac8711f69c4709d367350752754ecd29cc40e5c272d19066976333ed9a459d
|
Provenance
The following attestation bundles were made for structure_viewer-1.0.1-py3-none-any.whl:
Publisher:
publish.yml on crrrowz/structure-viewer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
structure_viewer-1.0.1-py3-none-any.whl -
Subject digest:
a12a9d8ec558ff78a060e7fc556430ce80ef8067c4c25cf7b122e0b8e461fd94 - Sigstore transparency entry: 779064877
- Sigstore integration time:
-
Permalink:
crrrowz/structure-viewer@86192ad3b8b8b1f1987d40f6fbc6857671b60684 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/crrrowz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@86192ad3b8b8b1f1987d40f6fbc6857671b60684 -
Trigger Event:
release
-
Statement type: