feat(common): introduce common networking and CLI infrastructure

This commit is contained in:
Ваше Имя
2025-09-30 18:33:06 +04:00
parent ad9b11cdbd
commit ba91359db3
12 changed files with 385 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
#include "cli_base.hpp"
#include <boost/program_options/parsers.hpp>
#include <iostream>
CliBase::CliBase(const std::string &title)
: desc_(title)
, help_(false)
{
}
void CliBase::parse(int argc, char *argv[])
{
using namespace boost::program_options;
setupOptions(); // must be first
parsed_options parsed = parse_command_line(argc, argv, desc_);
store(parsed, vm_);
notify(vm_);
if (vm_.count("help")) {
help_ = true;
}
}
bool CliBase::isHelp() const
{
return help_;
}
void CliBase::printHelp() const
{
std::cout << desc_ << "\n";
}