From 1884f06ae6f24325127035d0e5ae5933717523f6 Mon Sep 17 00:00:00 2001 From: clockblocker Date: Fri, 27 Nov 2026 11:02:58 +0100 Subject: [PATCH 1/2] Migrate CLI option parsing and help generation to reflect-cpp rfl::cli --- cli/cmdlineparser.cpp | 1687 ++++++++++++++++------------------------- 1 file changed, 663 insertions(+), 1024 deletions(-) diff --git a/cli/cmdlineparser.cpp b/cli/cmdlineparser.cpp index 6e2bc67cd10..96e28e8f7d5 100644 --- a/cli/cmdlineparser.cpp +++ b/cli/cmdlineparser.cpp @@ -41,6 +41,9 @@ #include "frontend.h" +#include +#include + #include #include #include @@ -50,10 +53,14 @@ #include #include #include +#include #include #include +#include +#include #include #include +#include #ifdef HAVE_RULES #include "regex.h" @@ -119,6 +126,321 @@ static bool addPathsToSet(const std::string& fileName, std::set& se } namespace { + using rfl::cli::Opt; + using namespace rfl::cli::attr; + + using CppcheckCliProcessors = rfl::Processors< + rfl::DefaultIfMissing, + rfl::NoExtraFields, + rfl::cli::PureFlags, + rfl::cli::LastValueWins, + rfl::cli::RequireEquals, + rfl::cli::ListDelimiter<"">>; + + struct CppcheckArgs { + Opt, ValueName<"addon">, + Desc<"Execute addon, e.g. --addon=misra. If options must be provided a json configuration is needed.">> + addon{}; + Opt, ValueName<"python interpreter">, + Desc<"Python interpreter for addons (default tries \"python3\", then \"python\").">> + addon_python{}; + Opt