diff --git a/cli/cmdlinelogger.h b/cli/cmdlinelogger.h
index 97bb2821eb9..6f165785327 100644
--- a/cli/cmdlinelogger.h
+++ b/cli/cmdlinelogger.h
@@ -26,8 +26,12 @@ class CmdLineLogger
public:
virtual ~CmdLineLogger() = default;
+ /** print a regular message */
virtual void printMessage(const std::string &message) = 0;
+ /** print an error message */
virtual void printError(const std::string &message) = 0;
+ /** print to the output */
+ virtual void printRaw(const std::string &message) = 0;
};
#endif // CMD_LINE_LOGGER_H
diff --git a/cli/cmdlineparser.cpp b/cli/cmdlineparser.cpp
index e36e2421c0b..eb330b82f84 100644
--- a/cli/cmdlineparser.cpp
+++ b/cli/cmdlineparser.cpp
@@ -313,7 +313,7 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
<< info << "\n";
}
- std::cout << doc.str();
+ mLogger.printRaw(doc.str());
mExitAfterPrint = true;
return true;
}
@@ -1057,7 +1057,8 @@ void CmdLineParser::printHelp()
"https://cppcheck.sourceforge.io/manual.pdf" :
"https://files.cppchecksolutions.com/manual.pdf");
- std::cout << "Cppcheck - A tool for static C/C++ code analysis\n"
+ std::ostringstream oss;
+ oss << "Cppcheck - A tool for static C/C++ code analysis\n"
"\n"
"Syntax:\n"
" cppcheck [OPTIONS] [files or paths]\n"
@@ -1249,20 +1250,21 @@ void CmdLineParser::printHelp()
" Generate Clang-plist output files in folder.\n";
if (isCppcheckPremium()) {
- std::cout << " --premium=