A single-header argument parsing library for modern C++17 applications.
argparse is a single-header argument parsing library for modern C++ that simplifies handling command-line arguments in applications. It provides a declarative API to define positional arguments, optional flags, subcommands, and complex parsing logic, replacing manual argc/argv processing with a robust, type-safe solution.
C++ developers building command-line tools, utilities, or applications that require sophisticated argument parsing, especially those using C++17 or newer standards.
Developers choose argparse for its ease of use, modern C++ design, and comprehensive feature set—including subcommands, custom actions, and automatic help—all in a single header with no external dependencies.
Argument Parser for Modern C++
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Just include argparse.hpp for instant integration, eliminating build system complexity and external dependencies, as highlighted in the Quick Start section.
Leverages C++17 features like scanning to numeric types and std::optional via .present(), ensuring compile-time checks and reducing runtime errors, as shown in argument handling examples.
Supports subcommands, mutually exclusive groups, parent parsers, and custom actions, matching the flexibility of Python's argparse, detailed in sections like Subcommands and Advanced Parsing.
Generates well-formatted usage messages with descriptions and epilogs, customizable via methods like set_usage_max_line_width and add_group, demonstrated in the help formatting examples.
Default --help and --version actions exit the program immediately without calling destructors, which the README admits can bypass resource cleanup in the Default Arguments section.
ArgumentParser copy and move constructors are deleted since v3.0, restricting usage patterns and requiring setup in a single scope, as noted in the Developer Notes on copying and moving.
Requires C++17 or newer, making it incompatible with legacy codebases or environments with older compiler toolchains, as stated in the Supported Toolchains table.