zfish 0.1.8

Ultra-light, zero-dependency Rust CLI framework for building beautiful command-line applications
Documentation
# ๐ŸŸ 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
```

| Flag | Default | Description |
|------|---------|-------------|
| `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:

| Operation | Time (Ryzen 3600) |
|-----------|-------------------|
| 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

| Platform | Status | Notes |
|----------|--------|-------|
| 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

[![Stargazers over time](https://starchart.cc/JeetKarena/ZFish.svg)](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>