๐ณ maram
A blazing-fast, modern alternative to the Unix tree command written in Rust
maram (เดฎเดฐเด) - Malayalam word for "tree" - is a high-performance filesystem tree visualizer with advanced features like inline file sizes, line counts, powerful filtering, and beautiful visualizations.
โจ Features
๐ Performance
- Blazing Fast - Custom iterative walker with parallelism
- Smart Filtering - Early pruning for efficiency
- Memory Efficient - Iterative traversal, no stack limits
- Platform Optimized - Direct syscalls on Unix/Linux
๐จ Rich Display
- Beautiful Trees - ASCII/Unicode visualization
- Inline Metrics - File sizes and line counts
- Size Charts - Visual disk usage distribution
- Colored Output - Syntax highlighting for clarity
๐ Advanced Filtering
- Regex Patterns - Include/exclude with regex
- Size Ranges - Filter by file size
- Time-based - Filter by modification time
- Gitignore - Respect
.gitignorefiles
๐ ๏ธ Flexibility
- Multiple Formats - Tree, JSON, CSV, plain text
- Configurable - Via
~/.maram.toml - Cross-Platform - Linux, macOS, Windows
- Sorting Options - By name, size, time, type
๐ฆ Installation
# Coming soon
๐ Quick Start
# Display current directory
# Show files with sizes and line counts
# Beautiful Unicode tree with colors
# Filter and sort Rust files by size
# Show disk usage distribution
๐ธ Screenshots
๐ Basic Tree View
๐ Size Distribution Chart
๐ฏ Powerful Filtering
๐จ Unicode Tree with Colors
๐ Project Overview with Limits
๐ Usage
Basic Commands
| Command | Description |
|---|---|
maram |
Display current directory tree |
maram /path/to/dir |
Display specific directory |
maram -u |
Use Unicode characters for tree |
maram --show-lines |
Show line counts for text files |
maram --show-size |
Show file sizes inline |
Filtering Options
| Option | Example | Description |
|---|---|---|
--include |
--include='\.rs$' |
Include files matching regex |
--exclude |
--exclude='node_modules' |
Exclude paths matching regex |
--only-dirs |
--only-dirs |
Show only directories |
--min-size |
--min-size=1MB |
Show files larger than size |
--newer-than |
--newer-than=1d |
Show files modified recently |
--gitignore |
--gitignore |
Respect .gitignore files |
Display Options
| Option | Example | Description |
|---|---|---|
--sort |
--sort=size --reverse |
Sort by size (descending) |
--max-files |
--max-files=10 |
Limit files per directory |
-L, --depth |
-L 3 |
Maximum depth to traverse |
--output |
--output=json |
Output format (tree/json/csv/plain) |
Size Distribution
# Show size distribution by file type
# Show top 20 largest files by extension
# Show distribution grouped by size buckets
๐งฑ Use as a Library (crate)
maram v0.2.0 exposes an ergonomic library API suitable for embedding in Rust projects. The library returns output to your code (as String or into any Write) instead of printing to stdout.
Quick start
use ;
Streaming to a writer
use File;
use ;
let mut opts = default;
opts.output = Plain;
let mut file = create?;
generate_to_writer?;
Structured traversal + rendering
use ;
let opts = default;
let entries = collect?; // build structured tree
let mut json_opts = opts.clone;
json_opts.output = Json; // choose format at render time
let json = render?;
Configuration via MaramOptions
output:OutputFormat::{Tree, Json, Csv, Plain}filter:FilterOptions(regex include/exclude, depth, per-dir limits, sort,.gitignore, hidden files)format:FormatOptions(unicode, color, full path, show size/lines/dir sizes)threads: parallelism (0 = auto)max_file_size: limit for line countingtotal_size: add a total summary (Tree output)dir_sizes: compute recursive dir sizesdistribution: optional(DistributionType, top: usize, DistributionFormat)
Convenience helpers:
let opts = default
.with_line_counting // 10MB
.with_dir_sizes
.with_total_size;
Programmatic CLI behavior
If you still want to reuse the CLIโs Args + Config merging, but capture the output instead of printing to stdout:
use ;
use Path;
let args = default;
let config = default;
let out = run_tree_output?;
Examples
Comprehensive examples live under examples/:
examples/basic.rsโ quick start tree rendering to Stringexamples/json.rsโ JSON outputexamples/filters.rsโ filtering and depth limitsexamples/writer.rsโ writing to a fileexamples/all.rsโ full showcase of filters, formatting, distributions, and all APIs
Run any example:
โก Performance
maram is designed for speed and efficiency:
| Benchmark | maram | tree | find | fd |
|---|---|---|---|---|
| Small directory (318 files) | 2.2ms | 4.1ms | 3.0ms | 29.6ms |
| Large directory (7,234 files) | 12.4ms | 89.5ms | 29.8ms | 198.3ms |
Why is maram so fast?
- ๐ง Custom Walker - Optimized filesystem traversal with inline filtering
- ๐ Zero Allocations - Pre-allocated buffers in hot paths
- โก Direct Syscalls - Bypasses standard library overhead on Unix
- ๐ Parallelism - Multi-threaded processing with rayon
- ๐ฏ Smart Pruning - Skip branches that don't match filters early
โ๏ธ Configuration
Create ~/.maram.toml to customize defaults:
[]
= true # Use Unicode tree characters
= true # Always show file sizes
= false # Show line counts
= false # Calculate directory sizes
= true # Show total size summary
[]
= false # Show hidden files
= true # Respect .gitignore
= 10 # Maximum traversal depth
= 100 # Max files per directory
= "name" # Sort by: name, size, time, type
[]
= 0 # CPU threads (0 = auto-detect)
= 1073741824 # Max file size for line counting (1GB)
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.