1
0
Fork
You've already forked argparse
0
Command-line arguments parsing library in C. Forked from https://github.com/cofyc/argparse.
  • C 51.4%
  • Shell 25.9%
  • Makefile 20.6%
  • CMake 2.1%
luxanna c345f704f9 Formatting
- Improve formatting
- Reduced comments for readability
- Removed LICENSE notice since there is a LICENSE file already
2026年03月14日 10:13:30 +01:00
build Updated project 2026年03月12日 22:06:40 +01:00
src Formatting 2026年03月14日 10:13:30 +01:00
tests subcommand: must pass ARGPARSE_STOP_AT_NON_OPTION to argparse_init in main program 2022年02月11日 10:49:45 +08:00
.gitignore add sub command test and example 2022年02月10日 16:25:36 +08:00
CMakeLists.txt Updated project 2026年03月12日 22:06:40 +01:00
FAQs.md fix typo 2018年11月26日 09:31:48 +08:00
LICENSE Updated project 2026年03月12日 22:06:40 +01:00
Makefile add sub command test and example 2022年02月10日 16:25:36 +08:00
README.md Updated project 2026年03月12日 22:06:40 +01:00

argparse

Command line arguments parsing library in C (compatible with C++). This was forked from here because the developer started using LLM generated code.

Description

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

Arguments parsing is a 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

  • handles both optional and positional arguments
  • produces highly informative usage messages
  • issues errors when given invalid arguments

There are basically three types of options:

  • boolean options
  • options with mandatory argument
  • options with optional argument

There are basically two forms of options:

  • short option consist of one dash (-) and one alphanumeric character.
  • long option begin with two dashes (--) and some alphanumeric characters.

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