3 Ways To Parse Command Line Arguments in C++: Quick, Do-It-Yourself, Or Comprehensive

This page summarizes the projects mentioned and recommended in the original post on /r/cpp

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • CLI11

    CLI11 is a command line parser for C++11 and beyond that provides a rich feature set with a simple and intuitive interface.

  • I use https://github.com/jarro2783/cxxopts.git or https://github.com/CLIUtils/CLI11, or if boost is involved anyway, boost.program_options.

  • args

    Simple and type-safe commandline argument parser for C++14 (by pfultz2)

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • args

    A simple header-only C++ argument parser library. Supposed to be flexible and powerful, and attempts to be compatible with the functionality of the Python standard argparse library (though not necessarily the API).

  • tclap

    Templatized C++ Command Line Parser mirror

  • TCLAP is my personal favorite.

  • jarro2783/cxxopts

    Lightweight C++ command line option parser

  • I use https://github.com/jarro2783/cxxopts.git or https://github.com/CLIUtils/CLI11, or if boost is involved anyway, boost.program_options.

  • text

    A spicy text library for C++ that has the explicit goal of enabling the entire ecosystem to share in proper forward progress towards a bright Unicode future. (by soasis)

  • The library you talk about is https://github.com/soasis/text and he has an account here.

  • docopt.cpp

    C++11 port of docopt

  • Available for many languages. Link to C++ version: https://github.com/docopt/docopt.cpp

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • argumentum

    C++ command line parsing library

  • There is also argumentum https://github.com/mmahnic/argumentum which is for C++ 17 and supports std::optional and sub-commands.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts