db9059e2fc3605bb1d7c9a9de6e53465405cdbc7
Refactored the application to improve performance, maintainability, and binary size. Key Changes: - **Core Algorithm**: Switched to a parallel, single-pass tree construction algorithm for O(N) traversal. - **Architecture**: Extract core logic from `main.rs` to `lib.rs` to enable unit testing. - **Testing**: Added comprehensive unit tests and integration tests (`tests/cli.rs`) covering CLI arguments and output formats. - **Benchmarking**: Added `criterion` benchmarks for performance tracking. - **Dependencies**: - Removed `walkdir` (logic replaced by `ignore` + custom tree). - Removed `humansize` (consolidated to `byte-unit`). - Replaced `chrono` with lightweight `time` crate. - Removed unused `atty`. - **Reporting**: Optimized CSV and JSON output for correctness and zero-copy performance. - **Documentation**: Updated CHANGELOG.md and bumped version to 0.2.0.
Sized
A fast, concurrent, and feature-rich command-line tool for visualizing disk usage, written in Rust.
Features
- Fast & Concurrent: Uses
rayonto process directories in parallel, making it extremely fast on modern multi-core systems. - Rich Output: Beautifully formatted tables with colors, distinguishing files and directories.
- Dual Units: Displays sizes in both Binary (MiB, GiB) and Decimal (MB, GB) units for clarity.
- Advanced Filtering: Filter by minimum size (
-m 10MB) to find large items quickly. - Sorting: Flexible sorting by name, type, size, or block count (
--sort). - Gitignore Support: Respects
.gitignoreand.ignorefiles to keep output clean (-i). - Export Options: Export data to CSV or JSON for further analysis (
--format csv/json). - Save to File: Automatically save reports with timestamped filenames (
--save).
Installation
From Source
Ensure you have Rust and Cargo installed. Clone the repository and install:
cargo install --path .
Usage
Basic Usage
Analyze the current directory:
sized
Analyze a specific path:
sized /path/to/directory
Options
| Flag | Description | Example |
|---|---|---|
-d, --depth |
Recursion depth (0 = current dir only) | sized -d 1 |
-m, --min-size |
Filter by minimum size | sized -m 100MB |
-s, --sort |
Sort columns (size, name, type, blocks) | sized --sort size:asc |
-f, --path-full |
Force absolute paths in headers | sized -f |
-i, --ignore |
Respect .gitignore files | sized -i |
-j, --threads |
Set number of threads | sized -j 4 |
--format |
Output format (text, csv, json) | sized --format json |
--save |
Save output to file | sized --save |
Examples
Find large directories (depth 1), respecting gitignore, and save to CSV:
sized . -d 1 -i -m 50MB --format csv --save
Generate Shell Completions
Bash:
Add the following to your .bashrc or .bash_profile:
# Option 1: Source directly
source <(sized --completions bash)
# Option 2: Save to file (safer startup time)
sized --completions bash > ~/.sized_completions.bash
echo "source ~/.sized_completions.bash" >> ~/.bashrc
Zsh:
# In your .zshrc
sized --completions zsh > /usr/local/share/zsh/site-functions/_sized
# OR
sized --completions zsh > ~/.zfunc/_sized
fpath+=~/.zfunc
autoload -Uz compinit && compinit
Fish:
sized --completions fish > ~/.config/fish/completions/sized.fish
License
Description
A fast, concurrent, and feature-rich command-line tool for visualizing disk usage, written in Rust.
https://gitea.speelman.ca/gamertan/sized
216 KiB
Releases
1
Languages
Rust
85.4%
Roff
6.7%
Shell
4.6%
Ruby
1.8%
Makefile
1.5%