How cliutils/cli11 works
Project type and purpose
• CLI11 is an open-source, header-only C++11 library that provides a rich, extensible command-line parsing framework.
• It includes:
• Core code (public headers, minimal .cpp)
• Single-header generator
• Unit tests (Catch2), fuzz tests
• Examples / demo apps
• Documentation (Doxygen + GitBook)
• Multiple build systems (CMake, Bazel, Meson)
• CI/CD pipelines (GitHub Actions, Azure Pipelines)
A. Core Library
– include/CLI (App.hpp, Option.hpp, Validator.hpp, Formatter.hpp, Config.hpp, ... )
– src/Precompile.cpp
– single-include/CLI11.hpp (generated artifact)
B. Build & Packaging
– CMakeLists.txt, BUILD.bazel, meson.build
– CMakePresets.json, scripts/ (ExtractVersion.py, MakeSingleHeader.py, style checks)
C. Testing & Fuzzing
– tests/ (Catch2 tests, mesonTest/)
– fuzz/ (fuzz targets, dictionaries)
– subprojects/catch2.wrap
D. Examples & Samples
– examples/ (dozens of small demos)
– book/code/ (runnable code snippets for docs)
E. Documentation
– docs/ (Doxygen: Doxyfile, markup)
– book/ (GitBook sources, SUMMARY.md, chapters)
F. CI/CD & External Services
– .github/workflows/ (build/test/docs pipelines)
– .ci/ (Azure build/test YAML)
– azure-pipelines.yml, codecov.yml, codacy.yml, dependabot.yml
– External: GitHub Actions, Azure Pipelines, CodeCov, Codacy, Dependabot
Relationships & Data Flows
• Build tools (CMake, Bazel, Meson) ──► compile Core Library into tests, examples, fuzz targets
• scripts/ ──► generate single-include header
• Core Library ──► used by Examples & Tests
• Tests & Fuzz ──► report coverage to CodeCov; report status to CI
• Documentation sources ──► Doxygen & GitBook pipelines produce HTML/PDF; published via CI
• CI/CD pipelines ──► orchestrate builds, tests, docs, status badges; integrate with external services
Architectural patterns & principles
• Layered Modules
• Core parsing engine (App, Option, Validator, Formatter, Config)
• Utilities (Timer, AutoTimer)
• Interface‐generation (single header)
• Platform abstraction (Unicode handling)
• Header-only design for zero dependencies
• Plug-in validators & formatters via virtual / template interfaces
• Multiple build backends for portability