compat.CLI11
#includeModern C++ command line parser (header-only)
#include <CLI/CLI.hpp>
mcpp add compat.CLI11@2.7.2
Usage
From this repository's own test project — built and run by CI, not written for the website.
// Behavioral test: parse synthetic argv with CLI11 and assert what came out.
// Covers the four things a parser has to get right — values and defaults,
// flags, a multi-value option, a subcommand — plus the two failure paths
// (unknown option, failed validator), which is what proves the parse actually
// ran rather than silently doing nothing. Returns non-zero on any mismatch.
//
// It also calls the package's anchor symbol. compat.CLI11 is header-only, so
// its lib target holds exactly that one translation unit: if the reference
// resolves, the package really was built and linked, not just included.
#include <CLI/CLI.hpp>
#include <string>
#include <vector>
int mcpp_compat_cli11_headers_anchor(void);
namespace {
// Values, default, flag, multi-value option and a subcommand, in one parse.
bool parses_a_full_command_line() {
CLI::App app{"mcpp-index CLI11 member"};
// …
tests/examples/cli11/tests/parse.cpp · project tests/examples/cli11
Build
- targets
CLI11 (lib)- language
c++23- import std
- no
- include dirs
*/include
Sources (1)
mcpp_generated/cli11_anchor.cpp
Generated files
mcpp_generated/cli11_anchor.cpp