📃 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.6.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.6.tar.gz",
.hash = "args-0.0.6-8hzgbvpJCAARh1mzvE8ZwHQE2zOTjRVQM_d5XTzAWrzH",
},
},Option B — Manual
zig fetch --hash https://github.com/muhammad-fiaz/args.zig/archive/refs/tags/0.0.6.tar.gzCopy that hash into your build.zig.zon:
.hash = "args-0.0.6-8hzgbvpJCAARh1mzvE8ZwHQE2zOTjRVQM_d5XTzAWrzH"📊 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) | 1355381 | 738 |
| Multiple Options (3 options) | 1155700 | 865 |
| Positional Arguments (3 positionals) | 1679340 | 595 |
| Counters (-vvv -dd) | 1535224 | 651 |
Advanced Features
| Benchmark | Ops/sec (higher is better) | Avg Latency (ns) (lower is better) |
|---|---|---|
| Subcommands (2 subcommands) | 1477035 | 677 |
| Mixed Arguments (complex CLI) | 663260 | 1508 |
| Argument Groups | 1505001 | 664 |
| Callbacks | 1715354 | 583 |
| Expect Validation | 2115412 | 473 |
| Declarative Structs | 1308605 | 764 |
Workflow Helpers
| Benchmark | Ops/sec (higher is better) | Avg Latency (ns) (lower is better) |
|---|---|---|
| Negated Flags | 1966031 | 509 |
| Select/All Helpers | 1833386 | 545 |
| Select/All CSV Strict Resolve | 1276093 | 784 |
| Include/Exclude Strict Resolve | 988158 | 1012 |
| Prompt Resolution (Parsed) | 2037115 | 491 |
| Suggestion Lookup | 1238452 | 807 |
| Subcommand Suggestion Lookup | 1965946 | 509 |
Validation
| Benchmark | Ops/sec (higher is better) | Avg Latency (ns) (lower is better) |
|---|---|---|
| File Extension Validation | 2192877 | 456 |
| File Name Policy Validation | 2106918 | 475 |
| Typed Input Validation | 59678 | 16757 |
| Decryption Option (Base64) | 1819212 | 550 |
Generation
| Benchmark | Ops/sec (higher is better) | Avg Latency (ns) (lower is better) |
|---|---|---|
| Help Text Generation | 1146271 | 872 |
| Shell Completion Generation (Bash) | 3522800 | 284 |
| Shell Completion Generation (Zsh) | 3588108 | 279 |
📈 Benchmark Summary
- Total benchmarks run: 24
- Average throughput: 1677140 ops/sec
- Maximum throughput: 3588108 ops/sec (Shell Completion Generation (Zsh))
- Minimum throughput: 59678 ops/sec (Typed Input Validation)
- Average latency: 596 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");