1 unstable release
| 0.1.0 | Jul 27, 2025 |
|---|
#1868 in Development tools
22KB
179 lines
VeryPretty
A high-performance file prettifier built with Rust that automatically formats minified code and copies the result to your clipboard.
Features
- Extremely Fast: Uses SWC (Speedy Web Compiler) for JavaScript/TypeScript parsing - one of the fastest parsers available
- Auto-detection: Automatically detects file types (JavaScript, TypeScript, JSON) based on extension and content
- Clipboard Integration: Automatically copies prettified content to your clipboard
- Linux Optimized: Enhanced clipboard support for both X11 and Wayland with proper timing
- Large File Support: Optimized for handling very large minified files with async I/O
- Cross-platform: Works on Linux, macOS, and Windows
Supported File Types
- JavaScript (
.js,.mjs,.cjs) - TypeScript (
.ts,.mts,.cts) - JSON (
.json)
Installation
From crates.io (Recommended)
cargo install verypretty
After installation, you can use the pretty command from anywhere:
pretty myfile.js
From Source
# Clone and build
git clone https://github.com/RanMewo/verypretty
cd verypretty
cargo build --release
# The binary will be at target/release/pretty
# Optionally copy to your PATH
sudo cp target/release/pretty /usr/local/bin/
Usage
Basic Usage
# Prettify a minified JavaScript file
pretty bundle.min.js
# Prettify a JSON file
pretty package.json
# Prettify TypeScript
pretty app.ts
# Just print without clipboard
pretty large-file.js --no-clipboard
# Force file type
pretty myfile --type js
pretty myfile --type json
Performance
VeryPretty is designed for maximum performance:
- Uses SWC parser (written in Rust) - significantly faster than Node.js-based tools
- Async I/O for handling large files efficiently
- Optimized release builds
- Minimal memory footprint
Linux Clipboard Support
VeryPretty includes enhanced Linux clipboard support:
- X11 Support: Works with traditional X11 clipboard managers
- Wayland Support: Full Wayland clipboard integration via
wl-clipboard-rs - Auto-detection: Automatically uses the appropriate clipboard backend
The clipboard functionality has been specifically optimized for Linux environments to avoid the common "clipboard dropped too quickly" issues.
Command Line Options
Usage: pretty [OPTIONS] <FILE>
Arguments:
<FILE> Path to the file to prettify
Options:
-t, --type <TYPE> Force a specific file type (js, ts, json)
-n, --no-clipboard Don't copy to clipboard, just print to stdout
-h, --help Print help
-V, --version Print version
Building
# Development build
cargo build
# Optimized release build
cargo build --release
# Run tests
cargo test
License
MIT License
Dependencies
~22–45MB
~620K SLoC