Home

Awesome

argparse

Build Status

argparse - A command line arguments parsing library in C (compatible with C++).

Description

This module is inspired by parse-options.c (git) and python's argparse module.

Arguments parsing is common task in cli program, but traditional getopt libraries are not easy to use. This library provides high-level arguments parsing solutions.

The program defines what arguments it requires, and argparse will figure out how to parse those out of argc and argv, it also automatically generates help and usage messages and issues errors when users give the program invalid arguments.

Features

There are basically three types of options:

There are basically two forms of options:

Short options may be bundled, e.g. -a -b can be specified as -ab.

Options are case-sensitive.

Options and non-option arguments can clearly be separated using the -- option.

Examples