// Copyright Epic Games, Inc. All Rights Reserved. #include "info_cmd.h" #include "zenserviceclient.h" #include #include #include #include using namespace std::literals; namespace zen { InfoCommand::InfoCommand() { m_Options.add_options()("h,help", "Print help"); m_Options.add_option("", "u", "hosturl", kHostUrlHelp, cxxopts::value(m_HostName)->default_value(""), ""); } InfoCommand::~InfoCommand() { } void InfoCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) { ZEN_UNUSED(GlobalOptions); if (!ParseOptions(argc, argv)) { return; } ZenServiceClient Service({.HostSpec = m_HostName, .CommandName = Name}); HttpClient& Http = Service.Http(); if (HttpClient::Response Result = Http.Get("/admin/info", HttpClient::Accept(ZenContentType::kJSON))) { ZEN_CONSOLE("{}", Result.ToText()); } else { Result.ThrowError(fmt::format("Failed getting info from {}", Service.HostSpec())); } } } // namespace zen