📃 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.7.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.7.tar.gz",
.hash = "args-0.0.7-8hzgbvPiCAAcEM4R90pCppGhHBKi0Uiw90tbGvipjVfc",
},
},Option B — Manual
zig fetch --hash https://github.com/muhammad-fiaz/args.zig/archive/refs/tags/0.0.7.tar.gzCopy that hash into your build.zig.zon:
.hash = "args-0.0.7-8hzgbvPiCAAcEM4R90pCppGhHBKi0Uiw90tbGvipjVfc"📊 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) | 1275719 | 784 |
| Multiple Options (3 options) | 1018153 | 982 |
| Positional Arguments (3 positionals) | 1566826 | 638 |
| Counters (-vvv -dd) | 1533955 | 652 |
Advanced Features
| Benchmark | Ops/sec (higher is better) | Avg Latency (ns) (lower is better) |
|---|---|---|
| Subcommands (2 subcommands) | 1386278 | 721 |
| Mixed Arguments (complex CLI) | 583580 | 1714 |
| Argument Groups | 1367410 | 731 |
| Callbacks | 1553059 | 644 |
| Expect Validation | 2056053 | 486 |
| Declarative Structs | 1136829 | 880 |
Workflow Helpers
| Benchmark | Ops/sec (higher is better) | Avg Latency (ns) (lower is better) |
|---|---|---|
| Negated Flags | 1916845 | 522 |
| Select/All Helpers | 1788832 | 559 |
| Select/All CSV Strict Resolve | 1231765 | 812 |
| Include/Exclude Strict Resolve | 940844 | 1063 |
| Prompt Resolution (Parsed) | 1992917 | 502 |
| Suggestion Lookup | 1805347 | 554 |
| Subcommand Suggestion Lookup | 2929244 | 341 |
Validation
| Benchmark | Ops/sec (higher is better) | Avg Latency (ns) (lower is better) |
|---|---|---|
| File Extension Validation | 2131766 | 469 |
| File Name Policy Validation | 2016619 | 496 |
| Typed Input Validation | 77587 | 12889 |
| Decryption Option (Base64) | 1824987 | 548 |
Generation
| Benchmark | Ops/sec (higher is better) | Avg Latency (ns) (lower is better) |
|---|---|---|
| Help Text Generation | 972539 | 1028 |
| Shell Completion Generation (Bash) | 3298460 | 303 |
| Shell Completion Generation (Zsh) | 3410121 | 293 |
📈 Benchmark Summary
- Total benchmarks run: 24
- Average throughput: 1658989 ops/sec
- Maximum throughput: 3410121 ops/sec (Shell Completion Generation (Zsh))
- Minimum throughput: 77587 ops/sec (Typed Input Validation)
- Average latency: 603 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");