Skip to content

Commit

Permalink
WIP: initial draft for server cli refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
WOLFI3654 committed Oct 21, 2023
1 parent ccb9e45 commit b085481
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/murmur/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
#include "ServerDB.h"
#include "Version.h"

#include <boost/optional.hpp>
#include <boost/optional/optional_io.hpp>
#include <boost/tuple/tuple_io.hpp>
#include <boost/logic/tribool.hpp>
#include <csignal>
#include <iostream>
Expand Down Expand Up @@ -208,7 +209,7 @@ auto parseCLI(int argc, char **argv) {
struct {
bool quit = false;
boost::optional< std::string > ini_file;
boost::optional< std::tuple< std::string, int > > supw_srv;
boost::optional< boost::tuple< std::string, int > > supw_srv;
boost::optional< int > disable_su_srv;
bool verbose_logging = false;
#ifdef QT_NO_DEBUG
Expand All @@ -233,7 +234,7 @@ auto parseCLI(int argc, char **argv) {
->option_text("<inifile>")
->expected(1, 2)
->check(CLI::ExistingFile);
app.add_option_no_stream("-w,--supw", options.supw_srv, "Set password for 'SuperUser' account on server srv.")
app.add_option("-w,--supw", options.supw_srv, "Set password for 'SuperUser' account on server srv.")
->option_text("<pw> [srv]")
->expected(1, 2);
#ifdef Q_OS_UNIX
Expand Down Expand Up @@ -386,8 +387,8 @@ int main(int argc, char **argv) {

if (cli_options.supw_srv.has_value()) {
auto tuple = cli_options.supw_srv.get();
supw = QString::fromStdString(std::get< 0 >(tuple));
sunum = std::get< 1 >(tuple);
supw = QString::fromStdString(tuple.get<0>());
sunum = tuple.get<1>();
#ifdef Q_OS_LINUX
} else if (cli_options.read_supw_srv.has_value()) {
// Note that it is essential to set detach = false here. If this is ever to be changed, the code part
Expand Down

0 comments on commit b085481

Please sign in to comment.