Monitor data flowing through Unix pipes with progress bars, transfer rates, and ETAs. Pure Rust implementation of the classic pv utility using indicatif.
A Rust reimplementation of the Unix `pv` (pipe viewer) utility. Monitors data flowing through pipes and provides progress information including transfer rates, elapsed time, estimated completion time, and progress bars.
This skill helps you work with a Rust implementation of the `pv` utility. It provides guidance on building, testing, extending features, and understanding the architecture of this command-line tool that monitors data transfer through pipes.
1. Parse CLI arguments into `PipeViewConfig`
2. Determine input sources (stdin or files with `-f`)
3. Create chained readers for multiple input files
4. Configure progress bar based on CLI options and estimated size
5. Copy data from source to stdout with progress updates
6. Handle read/write errors based on skip flags
```bash
cargo build
cargo run
cargo run -- --help
cat large_file.txt | cargo run -- > output.txt
```
```bash
cargo test
cargo test --quiet
cargo check
```
The project includes comprehensive integration tests:
Tests use `assert_cmd` for CLI testing and `tempfile` for file-based tests.
```bash
cargo clippy
cargo fmt
```
The repository includes a Git pre-commit hook that automatically:
Ensure the hook is executable:
```bash
chmod +x .git/hooks/pre-commit
```
When implementing new features:
1. **Create a feature branch**
```bash
git checkout -b feature/feature-name
```
2. **Set up pre-commit hooks** (first time only)
```bash
chmod +x .git/hooks/pre-commit
```
3. **Implement with tests** - Add unit tests in `src/main.rs` or integration tests in `tests/`
4. **Run tests**
```bash
cargo test
```
5. **Run linting**
```bash
cargo clippy
```
6. **Format code**
```bash
cargo fmt
```
7. **Commit changes** with descriptive messages
8. **Push branch**
```bash
git push -u origin feature/feature-name
```
9. **Create PR**
```bash
gh pr create --title "Add feature" --body "Description"
```
The progress bar template is dynamically built based on CLI flags:
Default template shows: elapsed time, progress bar, percentage, transferred/total, rate, and ETA.
```bash
cat large_file.dat | cargo run -- > output.dat
cat large_file.dat | cargo run -- -L 1m > output.dat
cat log.txt | cargo run -- -l > filtered.txt
cargo run -- -f file1.txt -f file2.txt > combined.txt
```
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/pv-pipe-viewer-rust-implementation/raw