Loading editor/CMakeLists.txt +1 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ else() netplus::netplus htmlpp::htmlpp confplus::confplus cmdplus::cmdplus dbpp::dbpp json-c::json-c tinyxml2::tinyxml2 Loading editor/src/main.cpp +22 −13 Original line number Diff line number Diff line Loading @@ -30,9 +30,11 @@ #include <string> #include <csignal> #include <cmdplus/cmdplus.h> #include <netplus/exception.h> #include <httppp/httpd.h> #include <httppp/exception.h> #include <confplus/exception.h> #include "plugin.h" #include "webedit_config.h" Loading @@ -44,19 +46,23 @@ static void signalHandler(int sig) { } int main(int argc, char *argv[]) { std::string configPath = "/etc/blogi-webedit/config.yaml"; // Parse arguments for (int i = 1; i < argc; ++i) { std::string arg = argv[i]; if ((arg == "--config" || arg == "-c") && i + 1 < argc) { configPath = argv[++i]; } else if (arg == "--help" || arg == "-h") { std::cout << "Usage: blogi-webedit [OPTIONS]\n" << " -c, --config <path> Path to config.yaml\n" << " -h, --help Show this help\n"; cmdplus::CmdController cmdCtl(cmdplus::CmdController::getInstance()); cmdCtl.registerCmd("help", 'h', false, "", "Show this help"); cmdCtl.registerCmd("config", 'c', true, "", "Path to config file"); cmdCtl.registerCmd("foreground", 'f', false, "", "Run in foreground"); cmdCtl.parseCmd(argc, argv); if (cmdCtl.getCmdbyKey("help")->getFound()) { cmdCtl.printHelp(); return 0; } std::string configPath = cmdCtl.getCmdbyKey("config")->getValue(); if (configPath.empty()) { configPath = "yaml:/etc/blogi-editor/config.yaml"; } signal(SIGPIPE, signalHandler); Loading Loading @@ -103,6 +109,9 @@ int main(int argc, char *argv[]) { server.runEventloop(); } catch (confplus::ConfException &e) { std::cerr << "Config error: " << e.what() << std::endl; return 1; } catch (netplus::NetException &e) { std::cerr << "Network error: " << e.what() << std::endl; return 1; Loading Loading
editor/CMakeLists.txt +1 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ else() netplus::netplus htmlpp::htmlpp confplus::confplus cmdplus::cmdplus dbpp::dbpp json-c::json-c tinyxml2::tinyxml2 Loading
editor/src/main.cpp +22 −13 Original line number Diff line number Diff line Loading @@ -30,9 +30,11 @@ #include <string> #include <csignal> #include <cmdplus/cmdplus.h> #include <netplus/exception.h> #include <httppp/httpd.h> #include <httppp/exception.h> #include <confplus/exception.h> #include "plugin.h" #include "webedit_config.h" Loading @@ -44,19 +46,23 @@ static void signalHandler(int sig) { } int main(int argc, char *argv[]) { std::string configPath = "/etc/blogi-webedit/config.yaml"; // Parse arguments for (int i = 1; i < argc; ++i) { std::string arg = argv[i]; if ((arg == "--config" || arg == "-c") && i + 1 < argc) { configPath = argv[++i]; } else if (arg == "--help" || arg == "-h") { std::cout << "Usage: blogi-webedit [OPTIONS]\n" << " -c, --config <path> Path to config.yaml\n" << " -h, --help Show this help\n"; cmdplus::CmdController cmdCtl(cmdplus::CmdController::getInstance()); cmdCtl.registerCmd("help", 'h', false, "", "Show this help"); cmdCtl.registerCmd("config", 'c', true, "", "Path to config file"); cmdCtl.registerCmd("foreground", 'f', false, "", "Run in foreground"); cmdCtl.parseCmd(argc, argv); if (cmdCtl.getCmdbyKey("help")->getFound()) { cmdCtl.printHelp(); return 0; } std::string configPath = cmdCtl.getCmdbyKey("config")->getValue(); if (configPath.empty()) { configPath = "yaml:/etc/blogi-editor/config.yaml"; } signal(SIGPIPE, signalHandler); Loading Loading @@ -103,6 +109,9 @@ int main(int argc, char *argv[]) { server.runEventloop(); } catch (confplus::ConfException &e) { std::cerr << "Config error: " << e.what() << std::endl; return 1; } catch (netplus::NetException &e) { std::cerr << "Network error: " << e.what() << std::endl; return 1; Loading