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


โœจ 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:

[dependencies]
zfish = "0.1"

Hello, Colorful World!

use zfish::Color;

fn main() {
    println!("{}", Color::Green.paint("โœ“ Success!"));
    println!("{}", Color::Red.paint("โœ— Error!"));
    println!("{}", Color::Yellow.paint("โš  Warning!"));
}

Argument Parsing

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

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

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

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


๐ŸŽฏ 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:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  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 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:

[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

# 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:

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 for updates

๐Ÿ“ˆ Stargazers over time

Stargazers over time


Created with โค๏ธ by Jeet Karena

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘  zfish v0.1.0                                                  โ•‘
โ•‘  Copyright ยฉ 2025 Jeet Karena                                 โ•‘
โ•‘  Licensed under MIT OR Apache-2.0                             โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

โฌ† Back to Top