https://github.com/ceyhunkerti/argz
command line argument parser for zig
https://github.com/ceyhunkerti/argz
argument-parser cli zig
Last synced: 3 months ago
JSON representation
command line argument parser for zig
- Host: GitHub
- URL: https://github.com/ceyhunkerti/argz
- Owner: ceyhunkerti
- Created: 2023-08-22T17:57:21.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-27T20:40:15.000Z (11 months ago)
- Last Synced: 2024-12-27T21:25:35.064Z (11 months ago)
- Topics: argument-parser, cli, zig
- Language: Zig
- Homepage:
- Size: 9.6 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# argz: CLI application helper for Zig
Supports:
- Subcommands `app sub1 sub2`
- Input options for primitive types `string` `integer` `boolean`
- Chained options for boolean types `-abc` is same as `-a -b -c`
- Flags for on/off behavior types
- Typed arguments
- Builtin and customizable help system
- Hooks for attaching user functions to specified locations.
## Installation
Use zig fetch --save to pull a version of the library into your `build.zig.zon`. (This requires at least Zig 0.11.)
```sh
zig fetch --save "https://github.com/ceyhunkerti/argz/archive/refs/tags/0.0.1.tar.gz"
```
Then in your `build.zig` file
```zig
...
const argz = b.dependency("argz", .{
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("argz", argz.module("argz"));
...
```
To access help, add `-h` or `--help` option. This will print the attached help for the current command.
See [examples/help.zig](./examples/help.zig)