argparse is a header-only argument parser library for modern C++.
The tool solves the problem of parsing command-line arguments in C++ programs by providing a single-header library that handles positional arguments, optional arguments, subcommands, and mutually exclusive groups. It works by allowing developers to define an ArgumentParser object, add arguments with their properties and constraints, and then parse incoming command-line input against those definitions. The library supports features like default values, argument validation, help text generation, parent parsers for shared argument definitions, and the ability to detect whether a user explicitly provided a value.
Developers should choose this tool if they are working with C++17 or later and want to avoid external dependencies in their argument parsing logic. It suits projects ranging from simple command-line utilities to complex applications with subcommands and hierarchical argument structures. The header-only design means no compilation or linking steps are required beyond including the single file. The library handles common parsing scenarios including negative numbers, compound arguments, custom prefix characters, and gathering remaining arguments after a separator.
The project maintains active development with regular updates and bug fixes. The codebase demonstrates attention to edge cases and real-world usage patterns through its comprehensive feature set. Testing infrastructure is in place to validate behavior across supported toolchains. Documentation is thorough, with examples covering both basic and advanced usage patterns including custom value restrictions, JSON construction from arguments, and formatting customization.