A high-performance tree command-line tool written in Rust, featuring gitignore support and flexible filtering capabilities.
- 🚀 High Performance - Written in Rust for fast traversal of large directories
- 🎯 Smart Filtering - Support for include/exclude patterns and filename pattern matching
- 🔍 Gitignore Support - Respects .gitignore rules by default, with option to disable
- 🎨 Colored Output - Automatic terminal detection with different colors for directories and files
- 📁 Flexible Display - Support for both tree format and full path format
- ⚙️ Rich Options - Depth control, hidden files, directory/file-only display, and more
cargo install treee
# or binstall
cargo binstall treeegit clone https://github.com/Latias94/treee.git
cd treee
cargo install --path .# Display tree structure of current directory
treee
# Display specific directory
treee /path/to/directory
# Limit display depth
treee -L 3
# Show hidden files
treee -a# Show only .rs files
treee --include "*.rs"
# Exclude target directory and .lock files
treee --exclude "target" --exclude "*.lock"
# Use filename pattern matching
treee --pattern "*.toml" --pattern "*.md"
# Show directories only
treee --directories-only
# Show files only
treee --files-only# Disable gitignore rules
treee --no-git-ignore
# By default, .gitignore rules are automatically applied
treee # Automatically excludes files in gitignore# Display full paths instead of tree format
treee --full-path
# Disable colored output
treee --no-colorUsage: treee [OPTIONS] [PATH]
Arguments:
[PATH] Directory to traverse [default: .]
Options:
-L, --depth <DEPTH> Maximum depth to traverse [default: 10]
-a, --all Show hidden files
--no-color Don't use colors
-d, --directories-only Show directories only
-I, --include <INCLUDE_PATTERNS> Include paths matching these glob patterns (can be used multiple times)
-E, --exclude <EXCLUDE_PATTERNS> Exclude paths matching these glob patterns (can be used multiple times)
-P, --pattern <FILE_PATTERNS> File name patterns to match (glob patterns, can be used multiple times)
--no-git-ignore Disable gitignore rules
-f, --files-only Show only files (opposite of --directories-only)
--full-path Print full paths instead of tree format
-h, --help Print help
-V, --version Print version
treee --include "*.rs" --full-pathtreee --exclude "target" --exclude "node_modules" --exclude "*.lock"treee --pattern "*.toml" --pattern "*.json" --pattern "*.yaml"treee -L 5 --directories-onlytreee --exclude "target" --include "*.rs" --include "*.toml" --depth 3treee uses efficient file system traversal algorithms and parallel processing, delivering excellent performance on large codebases. Compared to traditional tree commands, it provides richer filtering options and better Git integration.
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License