working commit
This commit is contained in:
+28
-5
@@ -5,19 +5,42 @@
|
||||
|
||||
#include <uxlogger.hpp>
|
||||
#include <uxclient.hpp>
|
||||
#include <cliconfig.hpp>
|
||||
|
||||
#include <defines.hpp>
|
||||
|
||||
std::expected<void, std::string> Run(void) {
|
||||
ClientConfig config;
|
||||
std::string confdir(SRV_CONFDIR);
|
||||
auto readRes = config.Read(confdir + "/" + "helmetcli.conf");
|
||||
if (!readRes) {
|
||||
return std::unexpected("Read config error: " + readRes.error());
|
||||
}
|
||||
auto validateRes = config.Validate();
|
||||
if (!validateRes) {
|
||||
return std::unexpected("Validate config error: " + validateRes.error());
|
||||
}
|
||||
auto servaddr = config.Servaddr();
|
||||
auto servport = config.Servport();
|
||||
auto localnets = config.Localnets();
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
UxClient client;
|
||||
auto connectRes = client.Connect("127.0.0.1", 1025);
|
||||
auto connectRes = client.Connect(servaddr, servport);
|
||||
if (!connectRes) {
|
||||
uxlogger.Error(connectRes.error());
|
||||
return 1;
|
||||
return std::unexpected(connectRes.error());
|
||||
}
|
||||
auto runRes = client.Run();
|
||||
if (!runRes) {
|
||||
return std::unexpected(runRes.error());
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
auto runRes = Run();
|
||||
if (!runRes) {
|
||||
uxlogger.Error(runRes.error());
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user