# ๐ 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://zfish-devdocs.vercel.app"><img src="https://img.shields.io/badge/dev%20docs-vercel-black.svg" alt="Developer Docs"/></a>
<a href="https://sprinkle-toque-13b.notion.site/ZFish-29d4eaaebc9d80bd82f3c27833a92232"><img src="https://img.shields.io/badge/roadmap-notion-000000.svg" alt="Roadmap"/></a>
<a href="https://github.com/JeetKarena/ZFish/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT 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>
---
> ๐ **[View the full roadmap and feature status on Notion โ](https://sprinkle-toque-13b.notion.site/ZFish-29d4eaaebc9d80bd82f3c27833a92232)**
---
## โจ 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
- ๐ฎ **Edition 2024** โ Built with the latest Rust features
### ๐ What's Included
| **Colors** | 16 ANSI + 256-color palette, 8 text styles | `Color::Red.paint("text")` |
| **Args** | Flag parsing, options, positional arguments | `--verbose`, `-abc`, `file.txt` |
| **Commands** | Git-style subcommands with auto-help | `app init`, `app build --release` |
| **Progress** | 4 bar styles (bar, spinner, dots, arrows) | Loading, downloading, processing |
| **Tables** | 5 box styles, alignment, Unicode-aware | Data display, reports, grids |
| **Prompts** | Text input, password, confirm dialogs | Interactive CLIs, wizards |
| **Logging** | 5 levels (error โ trace), timestamps | Debug output, application logs |
| **Terminal** | Clear, cursor control, size detection | TUI helpers, screen management |
> ๐ **See the [Feature Matrix](#-feature-matrix) below for detailed capabilities**
---
## ๐ Quick Start
### Installation
Add zfish to your `Cargo.toml`:
```toml
[dependencies]
zfish = "0.1.10"
```
**Alternative: Install from GitHub Packages**
Download the `.crate` file from [GitHub Releases](https://github.com/JeetKarena/ZFish/releases):
```bash
# Download the latest release
wget https://github.com/JeetKarena/ZFish/releases/download/v0.1.10/zfish-0.1.10.crate
# Verify checksum (optional)
wget https://github.com/JeetKarena/ZFish/releases/download/v0.1.10/zfish-0.1.10.crate.sha256
sha256sum -c zfish-0.1.10.crate.sha256
# Install from local crate
cargo install --path zfish-0.1.10.crate
```
### 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!");
}
```
### Subcommands (Git-Style CLI)
```rust
use zfish::command::{App, Command, Arg};
fn main() {
let app = App::new("myapp")
.version("1.0.0")
.about("My awesome CLI")
.arg(Arg::new("verbose").short('v').long("verbose"))
.subcommand(
Command::new("init")
.about("Initialize a new project")
.arg(Arg::new("name").required(true))
)
.subcommand(
Command::new("build")
.about("Build the project")
.arg(Arg::new("release").long("release"))
);
let matches = app.get_matches();
match matches.subcommand() {
Some(("init", sub_matches)) => {
let name = sub_matches.value_of("name").unwrap();
println!("Initializing: {}", name);
}
Some(("build", sub_matches)) => {
if sub_matches.is_present("release") {
println!("Building in release mode");
}
}
_ => println!("Use --help for usage"),
}
}
```
### 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!();
}
}
}
```
### Beautiful Tables
```rust
use zfish::table::{Table, BoxStyle, Alignment};
use zfish::Color;
fn main() {
let mut table = Table::new(vec!["Name", "Language", "Stars"]);
table.set_box_style(BoxStyle::Rounded);
table.set_column_alignment(2, Alignment::Right);
table.add_row(vec!["zfish", "Rust", "โญโญโญโญโญ"]);
table.add_row(vec!["clap", "Rust", "โญโญโญโญ"]);
table.add_row(vec!["cobra", "Go", "โญโญโญ"]);
table.print();
// Output:
// โญโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโฎ
// โ Name โ Language โ Stars โ
// โโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโค
// โ zfish โ Rust โ โญโญโญโญโญ โ
// โ clap โ Rust โ โญโญโญโญ โ
// โ cobra โ Go โ โญโญโญ โ
// โฐโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโฏ
}
```
---
## ๐ Documentation
- **Developer Docs**: [zfish-devdocs.vercel.app](https://zfish-devdocs.vercel.app) โ Interactive guides and tutorials
- **API Docs**: [docs.rs/zfish](https://docs.rs/zfish) โ Generated Rust documentation
- **Roadmap**: [ROADMAP.md](./ROADMAP.md) โ Detailed feature roadmap
- **Public Roadmap**: [Notion Roadmap](https://sprinkle-toque-13b.notion.site/ZFish-29d4eaaebc9d80bd82f3c27833a92232) โ Live feature status & timeline
- **Installation Guide**: [PACKAGES.md](./PACKAGES.md) โ Multiple installation methods
- **Release Process**: [.github/RELEASE_PROCESS.md](./.github/RELEASE_PROCESS.md) โ How we create releases
- **Examples**: [examples/](./examples/) โ 18 comprehensive examples covering all features
- `01_hello_world.rs` โ Basic usage
- `02_argument_parsing.rs` โ CLI argument handling
- `03_colored_text.rs` โ 16 + 256 color palette
- `04_progress_bar.rs` โ 4 progress bar styles
- `05_logger.rs` โ Leveled logging
- `06_terminal_control.rs` โ Terminal manipulation
- `07_interactive_prompts.rs` โ User input
- `08_complete_cli.rs` โ Full-featured CLI app
- `09_subcommands.rs` โ Nested command structures
- `10_arg_features_v2.rs` โ Advanced argument features
- `11_core_features_demo.rs` โ Core functionality showcase
- `12_beautiful_reports.rs` โ Styled report generation
- `13_table_examples.rs` โ **12 automated table examples** with all box styles
- `14_alignment_test.rs` โ Table emoji alignment verification
- `15_debug_emoji_width.rs` โ Unicode width debugging
- `16_comprehensive_unicode_test.rs` โ Full Unicode support test
- `17_unicode_edge_cases.rs` โ Complex emoji sequences
- `18_manual_table_drawing.rs` โ **Manual table fallback** for custom layouts
---
## ๐ฏ 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.10` (Active Development)
> ๐ **For detailed feature status, implementation notes, and roadmap, visit our [Notion Roadmap โ](https://sprinkle-toque-13b.notion.site/ZFish-29d4eaaebc9d80bd82f3c27833a92232)**
See [ROADMAP.md](./ROADMAP.md) for version plans.
## ๐ Feature Matrix
| **Colors & Styling** | 16 ANSI Colors | โ
| `style` | Black, Red, Green, Yellow, Blue, Magenta, Cyan, White + Bright variants |
| | 256-Color Palette | โ
| `style` | `Color::Custom(0-255)` |
| | Text Styles | โ
| `style` | Bold, Italic, Underline, Dim, Blink, Reverse, Hidden, Strikethrough |
| | Chained Styling | โ
| `style` | `.style(Style::Bold).style(Style::Italic)` |
| **Argument Parsing** | Flags & Options | โ
| `args` | `--flag`, `-f`, `--option value` |
| | Positional Args | โ
| `args` | Automatic capture of non-flag arguments |
| | Short Flag Combos | โ
| `args` | `-abc` โ `-a -b -c` |
| **Commands & Subcommands** | Subcommand System | โ
| `command` | Git-style nested commands |
| | Auto-generated Help | โ
| `command` | `--help` for all commands |
| | Argument Validation | โ
| `command` | Required args, possible values, custom validators |
| | Environment Fallbacks | โ
| `command` | `.env("VAR_NAME")` for options |
| | Value Delimiters | โ
| `command` | `--tags rust,cli,tool` |
| | Argument Dependencies | โ
| `command` | `.requires("other_arg")` |
| | Conflict Detection | โ
| `command` | `.conflicts_with("other_arg")` |
| | Variadic Arguments | โ
| `command` | `[FILES]...` capture multiple values |
| | Command Aliases | โ
| `command` | Multiple names for same command |
| **Progress Bars** | Bar Style | โ
| `progress` | Classic progress bar |
| | Spinner Style | โ
| `progress` | Rotating spinner |
| | Dots Style | โ
| `progress` | Animated dots |
| | Arrow Style | โ
| `progress` | Moving arrows |
| | Custom Width | โ
| `progress` | `.width(50)` |
| **Interactive Prompts** | Text Input | โ
| `prompt` | `Prompt::text("Question?")` |
| | Password Input | โ
| `prompt` | Hidden input for sensitive data |
| | Confirmation | โ
| `prompt` | Yes/No prompts |
| | Multi-select | ๐จ | - | Coming in v0.3.0 |
| **Tables** | 5 Box Styles | โ
| `table` | Single, Double, Heavy, Rounded, ASCII |
| | Column Alignment | โ
| `table` | Left, Right, Center per column |
| | Unicode-Aware Width | โ
| `table` | Handles emojis, CJK, combining marks |
| | Header/Footer Separators | โ
| `table` | Toggle separators on/off |
| | Manual Drawing | โ
| `table` | `draw_box()`, `draw_separator()` for custom layouts |
| | Custom Indentation | โ
| `table` | `.set_indent(n)` |
| **Logging** | 5 Log Levels | โ
| `log` | Error, Warn, Info, Debug, Trace |
| | Timestamp Support | โ
| `log` | Optional timestamps |
| | Level Filtering | โ
| `log` | `.level(Level::Debug)` |
| **Terminal Control** | Clear Screen | โ
| `term` | `Terminal::clear_screen()` |
| | Cursor Movement | โ
| `term` | `Terminal::move_cursor(row, col)` |
| | Terminal Size | โ
| `term` | `Terminal::size()` (cross-platform) |
| | Print at Position | โ
| `term` | `Terminal::print_at(row, col, text)` |
| **Platform Support** | Linux | โ
| `os` | Tier 1 support |
| | macOS | โ
| `os` | Tier 1 support |
| | Windows | โ
| `os` | Tier 1 support (cmd.exe, PowerShell) |
| | BSD | ๐ก | `os` | Should work, not officially tested |
| **Development** | Zero Dependencies | โ
| - | Only uses Rust `std` library |
| | No Unsafe Code | โ
| - | `#![forbid(unsafe_code)]` in public API |
| | Edition 2024 | โ
| - | Uses latest Rust features |
| | Feature Flags | โ
| - | `colour`, `raw`, `progress`, `interactive` |
### Completed Features (v0.1.x - v0.2.x)
#### Core Styling & Colors
- โ
16 standard ANSI colors
- โ
256-color palette (0-255)
- โ
Text styling (bold, italic, underline, dim, blink, reverse, hidden, strikethrough)
#### Argument Parsing & Commands
- โ
Basic argument parser (flags, options, positional args)
- โ
**Subcommand system** (git-style, multi-level hierarchies)
- โ
**Auto-generated `--help`** text for all commands
- โ
**Argument validation** (required args, possible values, custom validators)
- โ
**Advanced arg features** (environment variable fallbacks, delimiters, dependencies, conflicts)
- โ
**Variadic arguments** (capture multiple values)
#### Progress & Interactive
- โ
4 progress bar styles (bar, spinner, dots, arrows)
- โ
Interactive prompts (text, confirm, password)
#### Terminal Control
- โ
Terminal control (clear screen, cursor movement)
- โ
Terminal size detection (Windows + Unix)
#### Logging & Tables
- โ
Leveled logging (error, warn, info, debug, trace)
- โ
**Table module** with 5 box styles (Single, Double, Heavy, Rounded, ASCII)
- โ
**Unicode-aware** width calculation (emojis, CJK, combining marks)
- โ
**Manual table drawing** fallback for custom layouts
- โ
**Column alignment** (Left, Right, Center)
#### Development & Examples
- โ
Feature flags (colour, raw, progress, interactive)
- โ
Edition 2024 support
- โ
18 comprehensive examples
### Coming Next (v0.3.0+)
- ๐จ Multi-select prompts (checkbox lists)
- ๐จ Fuzzing tests for argument parser
- ๐จ Shell completion generation (bash, zsh, fish)
- ๐จ Configuration file support (TOML, JSON)
- ๐จ Spinner widgets with custom animations
> ๐ก **Want more details?** Check our **[Interactive Roadmap on Notion](https://sprinkle-toque-13b.notion.site/ZFish-29d4eaaebc9d80bd82f3c27833a92232)** for:
> - Detailed implementation notes for each feature
> - Release timelines and version planning
> - Known issues and workarounds
> - Feature request voting and discussions
---
## ๐ง 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 (16 + 256 colors) | โ
Available |
| `raw` | โ | Raw terminal mode for advanced I/O | โ
Available |
| `progress` | โ | Progress bars (4 styles: bar, spinner, dots, arrows) | โ
Available |
| `interactive` | โ | Interactive prompts (text, password, confirm) | โ
Available |
**Note**: `progress` and `interactive` features require `raw` mode and are automatically enabled when you use them.
---
## ๐ค 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
### Documentation
- **[API Documentation](https://docs.rs/zfish)** โ Complete API reference on docs.rs
- **[Developer Docs](https://zfish-devdocs.vercel.app)** โ Interactive guides, examples, and tutorials
- **[Roadmap](https://sprinkle-toque-13b.notion.site/ZFish-29d4eaaebc9d80bd82f3c27833a92232)** โ Feature status and upcoming releases
### 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
cargo run --example 01_hello_world
cargo run --example 02_argument_parsing
cargo run --example 03_colored_text
cargo run --example 04_progress_bar
cargo run --example 05_logger
cargo run --example 06_terminal_control
cargo run --example 07_interactive_prompts
cargo run --example 08_complete_cli
```
---
## ๐ 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
Licensed under the **MIT License**.
See [LICENSE](LICENSE) for details or visit http://opensource.org/licenses/MIT.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in zfish shall be licensed under the MIT License, 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 [@user_0xJeet](https://x.com/user_0xJeet) for updates
---
## ๐ Stargazers over time
[](https://starchart.cc/JeetKarena/ZFish)
---
<div align="center">
**Created with โค๏ธ by Jeet Karena**
```text
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ zfish v0.1.10 โ
โ Copyright ยฉ 2025 Jeet Karena โ
โ Licensed under MIT License โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
```
[โฌ Back to Top](#-zfish--ultra-light-cli-framework-for-rust)
</div>