# ๐ zfish โ Ultra-Light CLI Framework for Rust
<p align="center">
<img src="Logo.svg" alt="zfish Logo" width="200"/>
</p>
<p align="center">
<strong>Soar above the complexity</strong>
</p>
<p align="center">
<a href="https://crates.io/crates/zfish"><img src="https://img.shields.io/crates/v/zfish.svg" alt="Crates.io"/></a>
<a href="https://docs.rs/zfish"><img src="https://docs.rs/zfish/badge.svg" alt="Documentation"/></a>
<a href="https://github.com/JeetKarena/ZFish/blob/main/LICENSE"><img src="https://img.shields.io/crates/l/zfish.svg" alt="License"/></a>
<a href="https://blog.rust-lang.org/2023/06/01/Rust-1.70.0.html"><img src="https://img.shields.io/badge/MSRV-1.90-blue.svg" alt="MSRV"/></a>
<a href="https://github.com/JeetKarena/ZFish/actions"><img src="https://github.com/JeetKarena/ZFish/workflows/CI/badge.svg" alt="CI Status"/></a>
</p>
<p align="center">
<a href="https://sonarcloud.io/dashboard?id=JeetKarena_ZFish"><img src="https://sonarcloud.io/api/project_badges/measure?project=JeetKarena_ZFish&metric=alert_status" alt="Quality Gate"/></a>
<a href="https://sonarcloud.io/dashboard?id=JeetKarena_ZFish"><img src="https://sonarcloud.io/api/project_badges/measure?project=JeetKarena_ZFish&metric=security_rating" alt="Security Rating"/></a>
<a href="https://sonarcloud.io/dashboard?id=JeetKarena_ZFish"><img src="https://sonarcloud.io/api/project_badges/measure?project=JeetKarena_ZFish&metric=sqale_rating" alt="Maintainability Rating"/></a>
<a href="https://sonarcloud.io/dashboard?id=JeetKarena_ZFish"><img src="https://sonarcloud.io/api/project_badges/measure?project=JeetKarena_ZFish&metric=coverage" alt="Coverage"/></a>
<a href="https://sonarcloud.io/dashboard?id=JeetKarena_ZFish"><img src="https://sonarcloud.io/api/project_badges/measure?project=JeetKarena_ZFish&metric=bugs" alt="Bugs"/></a>
</p>
---
## โจ Features
- ๐ **Zero Dependencies** โ No third-party crates, only `std`
- ๐จ **Rich Styling** โ 16 ANSI colors + 256-color palette
- โก **Blazing Fast** โ Cold start <5ms, parse 1M flags in ~200ms
- ๐ **Memory Safe** โ `#![forbid(unsafe_code)]` in public API
- ๐ **Cross-Platform** โ Linux, macOS, Windows (tier-1 support)
- ๐ฆ **Lightweight** โ Minimal binary size, fast compile times
- ๐ฏ **Intuitive API** โ Ergonomic design, great docs
---
## ๐ Quick Start
Add zfish to your `Cargo.toml`:
```toml
[dependencies]
zfish = "0.1"
```
### Hello, Colorful World!
```rust
use zfish::Color;
fn main() {
println!("{}", Color::Green.paint("โ Success!"));
println!("{}", Color::Red.paint("โ Error!"));
println!("{}", Color::Yellow.paint("โ Warning!"));
}
```
### Argument Parsing
```rust
use zfish::Args;
fn main() {
let args = Args::parse();
if args.has_flag("verbose") || args.has_flag("v") {
println!("Verbose mode enabled");
}
if let Some(file) = args.get_option("file") {
println!("Processing: {}", file);
}
for arg in &args.positional {
println!("Positional argument: {}", arg);
}
}
```
### Progress Bar
```rust
use zfish::ProgressBar;
use std::thread;
use std::time::Duration;
fn main() {
let mut pb = ProgressBar::new(100);
for i in 0..=100 {
pb.set(i);
thread::sleep(Duration::from_millis(50));
}
pb.finish("โ Complete!");
}
```
### Interactive Prompts
```rust
use zfish::Prompt;
fn main() {
let name = Prompt::text("What's your name?");
println!("Hello, {}!", name);
if Prompt::confirm("Continue?") {
println!("Let's go!");
}
let password = Prompt::password("Enter password:");
println!("Password length: {}", password.len());
}
```
### 256-Color Palette
```rust
use zfish::Color;
fn main() {
// Use any color from 0-255
println!("{}", Color::Custom(196).paint("Bright red"));
println!("{}", Color::Custom(46).paint("Bright green"));
println!("{}", Color::Custom(21).paint("Deep blue"));
// Show all 256 colors
for i in 0..=255 {
print!("{} ", Color::Custom(i).paint(format!("{:3}", i)));
if (i + 1) % 16 == 0 {
println!();
}
}
}
```
---
## ๐ Documentation
- **API Docs**: [docs.rs/zfish](https://docs.rs/zfish)
- **Roadmap**: [ROADMAP.md](./ROADMAP.md)
- **Examples**: [examples/](./examples/) (coming soon)
---
## ๐ฏ Design Philosophy
### Why zfish?
Most CLI frameworks pull in dozens of dependencies, increasing:
- **Compile times** (minutes instead of seconds)
- **Binary size** (MBs instead of KBs)
- **Supply chain risk** (trust dozens of crates)
- **Maintenance burden** (breaking changes cascade)
zfish takes a different approach:
```text
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Other CLI Frameworks โ zfish โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ 50+ dependencies โ 0 dependencies โ
โ ~10 second compile โ ~1 second compile โ
โ ~2 MB binary โ ~200 KB binary โ
โ Complex API โ Intuitive API โ
โ ANSI escape codes manual โ Auto color detection โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
```
### Core Principles
1. **Zero Dependencies** โ Only Rust std library
2. **Safety First** โ No unsafe code in public API
3. **Performance** โ Optimized for speed and size
4. **Simplicity** โ Easy to learn, hard to misuse
5. **Cross-Platform** โ Works everywhere Rust works
---
## ๐๏ธ Project Status
**Current Version**: `0.1.0` (Foundation Release)
See [ROADMAP.md](./ROADMAP.md) for detailed version plans.
### Completed Features (v0.1.0)
- โ
16 standard ANSI colors
- โ
256-color palette
- โ
Text styling (bold, italic, underline, etc.)
- โ
Basic argument parser
- โ
Progress bars
- โ
Interactive prompts
- โ
Terminal control utilities
- โ
Leveled logging
### Coming Next (v0.2.0)
- ๐จ Subcommand support
- ๐จ Auto-generated `--help`
- ๐จ Argument validation
- ๐จ Fuzzing tests
---
## ๐ง Feature Flags
zfish uses Cargo feature flags for optional functionality:
```toml
[dependencies.zfish]
version = "0.1"
default-features = false # Disable all defaults
features = ["colour"] # Enable only what you need
```
| `colour` | โ
| ANSI color support |
| `raw` | โ | Raw terminal mode (coming in 0.3.0) |
| `progress` | โ | Progress bars (coming in 0.4.0) |
| `interactive` | โ | Interactive prompts (coming in 0.3.0) |
---
## ๐ค Contributing
Contributions are welcome! Here's how you can help:
1. **Report Bugs** โ Open an issue with details
2. **Request Features** โ Discuss in GitHub Discussions
3. **Submit PRs** โ Check open issues labeled "good first issue"
4. **Improve Docs** โ Fix typos, add examples
### Development Setup
```bash
# Clone the repository
git clone https://github.com/JeetKarena/ZFish.git
cd zfish
# Run tests
cargo test
# Run tests (single-threaded to avoid env var conflicts)
cargo test -- --test-threads=1
# Build documentation
cargo doc --open
# Run examples (coming soon)
cargo run --example basic_colors
```
---
## ๐ Performance
zfish is designed for speed:
| Cold start | ~3ms |
| Parse 1M flags | ~180ms |
| Render progress bar | 60 FPS |
| Color detection | <1ยตs (cached) |
Benchmarks run on:
- CPU: AMD Ryzen 5 3600
- RAM: 16GB DDR4-3200
- OS: Windows 11 / Ubuntu 22.04
---
## ๐ Platform Support
| Linux | โ
Tier 1 | Tested on Ubuntu 20.04+ |
| macOS | โ
Tier 1 | Tested on macOS 12+ |
| Windows | โ
Tier 1 | Tested on Windows 10/11 |
| BSD | ๐ก Should work | Not officially tested |
| WASM | โ Not supported | Terminal I/O not available |
---
## ๐ License
Dual-licensed under your choice of:
- **MIT License** ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
- **Apache License 2.0** ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in zfish shall be dual-licensed as above, without any additional terms or conditions.
---
## ๐ Acknowledgments
Inspired by:
- **clap** โ Excellent API design patterns
- **colored** โ Color API inspiration
- **indicatif** โ Progress bar concepts
- **dialoguer** โ Interactive prompt ideas
Built with zero dependencies as a proof-of-concept that powerful CLIs don't need to pull in half of crates.io.
---
## ๐ฌ Community
- **GitHub Discussions** โ Ask questions, share ideas
- **Issues** โ Report bugs, request features
- **Twitter** โ Follow [@jeetkarena](https://twitter.com/jeetkarena) for updates
---
## ๐ Stargazers over time
[](https://starchart.cc/JeetKarena/ZFish)
---
<div align="center">
**Created with โค๏ธ by Jeet Karena**
```text
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ zfish v0.1.0 โ
โ Copyright ยฉ 2025 Jeet Karena โ
โ Licensed under MIT OR Apache-2.0 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
```
[โฌ Back to Top](#-zfish--ultra-light-cli-framework-for-rust)
</div>