blob: 73a5d2e5d600ec1d90072bc402964d157c7ad800 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
// Copyright Epic Games, Inc. All Rights Reserved.
#include "info_cmd.h"
#include <zencore/fmtutils.h>
#include <zencore/logging.h>
#include <zencore/string.h>
#include <zenhttp/httpclient.h>
using namespace std::literals;
namespace zen {
InfoCommand::InfoCommand()
{
m_Options.add_options()("h,help", "Print help");
m_Options.add_option("", "u", "hosturl", "Host URL", cxxopts::value(m_HostName)->default_value(""), "<hosturl>");
}
InfoCommand::~InfoCommand()
{
}
int
InfoCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
{
ZEN_UNUSED(GlobalOptions);
if (!ParseOptions(argc, argv))
{
return 0;
}
m_HostName = ResolveTargetHostSpec(m_HostName);
if (m_HostName.empty())
{
throw OptionParseException("unable to resolve server specification");
}
HttpClient Http(m_HostName);
if (HttpClient::Response Result = Http.Get("/admin/info", HttpClient::Accept(ZenContentType::kJSON)))
{
ZEN_CONSOLE("{}", Result.ToText());
}
return 0;
}
} // namespace zen
|