📃 Documentation
Full Documentation can be found at https://muhammad-fiaz.github.io/args.zig/
📦 Installation
Option A — Automatic (Recommended)
Run this to install the dependency and automatically save the hash:
zig fetch --save https://github.com/muhammad-fiaz/args.zig/archive/refs/tags/0.0.5.tar.gzNote
After running, Zig updates your build.zig.zon with the correct hash automatically.
The entry will look like:
.dependencies = .{
.args = .{
.url = "https://github.com/muhammad-fiaz/args.zig/archive/refs/tags/0.0.5.tar.gz",
.hash = "args-0.0.5-8hzgbiL8BgAMMKm-_k2qsm5TkTfQfNb0x_M9Ikws2SZx",
},
},Option B — Manual
zig fetch --hash https://github.com/muhammad-fiaz/args.zig/archive/refs/tags/0.0.5.tar.gzCopy that hash into your build.zig.zon:
.hash = "args-0.0.5-8hzgbiL8BgAMMKm-_k2qsm5TkTfQfNb0x_M9Ikws2SZx"📊 Benchmarks
The following benchmark results were captured during the release workflow:
Note
Benchmarks are automatically generated by GitHub Actions using bench/benchmark.zig. Results may vary based on the CI runner environment.
📊 ARGS.ZIG BENCHMARK RESULTS
Environment Details:
- Platform: linux
- Architecture: x86_64
- Warmup Iterations: 100
- Benchmark Iterations: 10000
Basic Parsing
| Benchmark | Ops/sec (higher is better) | Avg Latency (ns) (lower is better) |
|---|---|---|
| Simple Flags (3 flags) | 1635076 | 612 |
| Multiple Options (3 options) | 1247166 | 802 |
| Positional Arguments (3 positionals) | 1943340 | 515 |
| Counters (-vvv -dd) | 1708576 | 585 |
Advanced Features
| Benchmark | Ops/sec (higher is better) | Avg Latency (ns) (lower is better) |
|---|---|---|
| Subcommands (2 subcommands) | 1686200 | 593 |
| Mixed Arguments (complex CLI) | 717784 | 1393 |
| Argument Groups | 1614595 | 619 |
| Callbacks | 1880735 | 532 |
| Expect Validation | 2327922 | 430 |
| Declarative Structs | 1453389 | 688 |
Workflow Helpers
| Benchmark | Ops/sec (higher is better) | Avg Latency (ns) (lower is better) |
|---|---|---|
| Negated Flags | 2274822 | 440 |
| Select/All Helpers | 2108196 | 474 |
| Select/All CSV Strict Resolve | 1433866 | 697 |
| Include/Exclude Strict Resolve | 1101456 | 908 |
| Prompt Resolution (Parsed) | 2350057 | 426 |
| Suggestion Lookup | 1250529 | 800 |
| Subcommand Suggestion Lookup | 1987943 | 503 |
Validation
| Benchmark | Ops/sec (higher is better) | Avg Latency (ns) (lower is better) |
|---|---|---|
| File Extension Validation | 2385268 | 419 |
| File Name Policy Validation | 2305236 | 434 |
| Typed Input Validation | 64451 | 15516 |
| Decryption Option (Base64) | 2032847 | 492 |
Generation
| Benchmark | Ops/sec (higher is better) | Avg Latency (ns) (lower is better) |
|---|---|---|
| Help Text Generation | 1213123 | 824 |
| Shell Completion Generation (Bash) | 3545925 | 282 |
| Shell Completion Generation (Zsh) | 3689992 | 271 |
📈 Benchmark Summary
- Total benchmarks run: 24
- Average throughput: 1831604 ops/sec
- Maximum throughput: 3689992 ops/sec (Shell Completion Generation (Zsh))
- Minimum throughput: 64451 ops/sec (Typed Input Validation)
- Average latency: 546 ns
⬇️ Downloads (Prebuilt Library)
| Platform | Architecture | File |
|---|---|---|
| Windows | x86_64 | args-x86_64-windows.lib |
| Windows | x86 | args-x86-windows.lib |
| Linux | x86_64 | libargs-x86_64-linux.a |
| Linux | x86 | libargs-x86-linux.a |
| Linux | aarch64 (ARM64) | libargs-aarch64-linux.a |
| macOS | x86_64 (Intel) | libargs-x86_64-macos.a |
| macOS | aarch64 (Apple Silicon) | libargs-aarch64-macos.a |
| Bare Metal | x86_64 | libargs-x86_64-freestanding.a |
| Bare Metal | aarch64 | libargs-aarch64-freestanding.a |
| Bare Metal | RISC-V 64 | libargs-riscv64-freestanding.a |
| Bare Metal | ARM | libargs-arm-freestanding.a |
🛠️ Using Prebuilt Libraries
- Download the library for your platform.
- Place it in your project (e.g., in a
libs/folder). - Update your
build.zig:
// Assuming you placed the library in `libs/`
exe.addLibraryPath(b.path("libs"));
exe.linkSystemLibrary("args");