struct
Struct: tree with a developer brain. Stop drowning in site-packages — struct shows you the code you care about.
The Problem
Running tree in a project directory gives you this:
I needed something that shows project structure without drowning me in dependency folders.
What This Does
struct shows your project's actual structure while automatically hiding the noise:
)
The folder still appears, but you get a clean file count instead of thousands of irrelevant paths.
Installation
Option 1: Install from crates.io
View on crates.io
Option 2: Install from source
&&
Uninstallation
&&
&&
Quick Start
Complete Usage Guide
Syntax
struct [DEPTH] [PATH] [FLAGS]
struct search "PATTERN" [PATH] [DEPTH] [FLAGS]
struct 0 [PATH] → detailed summary view
Both DEPTH and PATH are optional positional arguments — no flags needed.
Order doesn't matter: struct 2 ~/dir and struct ~/dir 2 both work.
struct 0 — Directory Summary Mode
Output:
/home/user/projects/myproject (main)
src/
/home/user/projects/myproject/src
total: 10 dirs · 45 files · 125.3K
visible: 8 dirs · 42 files · 120.1K
types: rs(30) toml(5) md(3) json(2) txt(2)
ignored: target(948 files)
README.md
12.5K
── ignored (top level) ──
.git(60 files), target(948 files) · 1008 files · 45.2M
Git Integration
Filter output by git status. All git flags can be combined with any other flag.
When multiple git flags conflict, priority is: --gc > --gs > --gu > -g > --gh
-g, --git — tracked files only
--gu — untracked files only
--gs — staged files only
--gc — changed/modified files only
--gh — last commit per directory
Root variants — start from git root regardless of current directory
Examples:
Flags
-z, --size — show file sizes
Output:
main.rs (8.5K)
venv/ (156.3M, 2741 files ignored)
-s, --skip-large SIZE — skip large directories
-i, --ignore PATTERNS — inline ignore patterns
Comma-separated, wildcards supported. Merged with config patterns.
-n, --no-ignore TARGET — un-ignore
Show things that are normally hidden. Can be given multiple times.
| Value | Effect |
|---|---|
all |
Disable ALL ignores |
defaults |
Disable built-in defaults (venv, node_modules, etc.) |
config |
Disable config file patterns only |
PATTERN |
Un-ignore one specific name (e.g. venv, __pycache__) |
Config File Management
Save ignore patterns permanently so you don't have to type -i every time.
Location: ~/.config/struct/ignores.txt
Output of struct list:
custom ignore patterns:
chrome_profile
*.log
config file: /home/user/.config/struct/ignores.txt
Search
Find files and directories by pattern. Respects the same ignore rules as the tree view.
struct search "PATTERN" [PATH] [DEPTH] [FLAGS]
Pattern matching rules:
- Plain text (no
*or?) → case-insensitive substring matchsearch "gui"findsgui.py,gui_utils.rs,penguin.txtsearch "cache"finds__pycache__,.cache,cache.json
- Glob patterns (has
*or?) → exact glob matchsearch "*.py"finds only files ending in.pysearch "test*"finds files starting withtest
Basic examples:
Search flags:
[DEPTH] — limit search depth (positional, default: infinite)
-f, --flat — flat list instead of tree
Tree output (default):
found 6 item(s) matching *.py
timebomb/
└── Linux/
└── python/
├── app_manager.py (11.1K)
├── gui.py (19.4K)
└── timer.py (18.5K)
Flat output (-f):
found 6 item(s) matching *.py
timebomb/Linux/python/app_manager.py (11.1K)
timebomb/Linux/python/gui.py (19.4K)
timebomb/Linux/python/timer.py (18.5K)
-i, --ignore PATTERNS — ignore patterns during search
Auto-Ignored Directories
These are hidden by default (shown with file count instead):
Python: __pycache__, .pytest_cache, .mypy_cache, venv, .venv, env, virtualenv, *.egg-info, dist, build
JavaScript: node_modules, .npm, .yarn
Version Control: .git, .svn, .hg
IDEs: .vscode, .idea, .obsidian
Build Artifacts: target, bin, obj, .next, .nuxt
Caches: chrome_profile, GPUCache, ShaderCache, Cache, blob_storage
macOS: .DS_Store
Use -n all to show everything, or -n PATTERN to peek at one specific folder.
Real-World Examples
# Check project structure without clutter
# Find all config files in current dir
# See what's actually tracked in git
# Peek inside an ignored folder
# Find large folders
# Search with flat output for piping
|
# Find __pycache__ dirs across your project
# Git: see what you're about to commit
Features
- Clean by default: hides noise (venv, node_modules, .git, caches, build artifacts)
- Smart search: substring match for plain text, glob match for patterns with wildcards
- Git integration: filter to tracked / untracked / staged / changed files
- Size awareness: show sizes with
-z, skip large dirs with-s - Configurable ignores: save patterns permanently with
struct add - Flexible output: tree or flat format for search
- Color-coded: directories in blue, executables in green
- Fast: written in Rust
Why Rust
Started as a learning project. Turned out to be genuinely useful, so it got polished up. The performance is a nice bonus.
Contributing
Found a bug? Want a feature? Open an issue. PRs welcome.
Drop a star if you find it useful — it helps!
License
MIT