https://github.com/izenynn/mini-arg
A simple library for argument parsing in C.
https://github.com/izenynn/mini-arg
arg args args-parser argument-parser argument-parsing c lib library linux macos
Last synced: about 1 year ago
JSON representation
A simple library for argument parsing in C.
- Host: GitHub
- URL: https://github.com/izenynn/mini-arg
- Owner: izenynn
- Created: 2023-05-26T14:28:10.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-04T10:26:30.000Z (almost 3 years ago)
- Last Synced: 2025-01-22T05:15:32.000Z (over 1 year ago)
- Topics: arg, args, args-parser, argument-parser, argument-parsing, c, lib, library, linux, macos
- Language: C
- Homepage:
- Size: 27.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# mini-args
## Info
A simple library for argument parsing in C, inspired by `argp`.
## Features
- Long options.
- Short key for long options.
- Concatenated short options (`-abcDEF`).
- Required argument (throws an error if a required argument is not provided for an option that needs it).
- Required argument value (syntax: `-a VALUE` / `-aVALUE` / `--arg VALUE` / `--arg=VALUE`).
- Optional argument value (value can be present or not).
- Default value, useful for optional argument value (`miniarg_option->arg`).
- If short option requires argument, rest of the string will be treated as one.
- Automatic `-h` and `--help`.
- Automatic `--usage` (for now it doesn't print all options, just a simple usage message).
- Automatic `-V` and `--version`.
- Exposed function to print usage.
- Normal arguments.
- Count of normal arguments.
- Notify when arguments end so you can perform all necessary action.
- Supports `--`.
- Access to glabal variable `marg_err_exit_status` to customize the error exit code.
- Access to global varibale `marg_program_name` to help you with your own log functions.
- Group your options, `-h/--help` message will also show the group description.
## Usage
Define the following global vars:
```c
TODO...
```
TODO...
##
[](https://forthebadge.com)
[](https://forthebadge.com)