An open API service indexing awesome lists of open source software.

https://github.com/cameronmore/zarg

A command line argument parser for Zig applications
https://github.com/cameronmore/zarg

command-line-tool zig ziglang

Last synced: about 1 year ago
JSON representation

A command line argument parser for Zig applications

Awesome Lists containing this project

README

          

# ⚡ ZARG ⚡

ZARG is a lightweight Zig command ling argument module. Zarg offers a simple API and allows the user decide how to handle missing flags and values.

### Why ZARG?

ZARG is simple. This makes ZARG easy to drop in to an existing project and update as the Zig programming language evolves and updates. ZARG is also lightweight enough to remove relatively easily if your needs change or want to swap in a different argument parsing module.

Staying true to Zig's core principles, ZARG does not make any hidden allocators, leaving the user to decide how to store argument flags.

### Features

- ✅ Short and long flag matching
- ✅ Help message printing
- ✅ Boolean flag support
- ✅ Sub-command argument support
- ✅ Positional argument capturing
- ❌ Multiple same-flag arguments

### Documentation and Usage

Please see USAGE.md for documentation.

To pull and use, run:
```shell
zig fetch --save git+https://github.com/cameronmore/ZARG
```
And then in your build.zig file, add:
```zig
const zargDep = b.dependency("zarg", .{.target=target,.optimize=optimize});
exe_mod.addImport("zarg", zargDep.module("zarg"));
```

### Use of Artificial Intelligence

This project was developed with the aid of artificial intelligence (AI) but not AI code-completion. I started this project to solve a practical problem I was having as well as learning Zig, so I used AI sparingly in writing the actual code.

### Contributing and Licensing

ZARG welcomes bug reports, feature requests, and pull-requests! Please create a GitHub issue describing the problem or task and optionally link a pull request.

**NOTE: ZARG is an Apache-2.0 project, and all contributions to this repository must comply with that license.**