diff options
| author | Stefan Boberg <[email protected]> | 2026-04-23 18:16:57 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2026-04-23 18:16:57 +0200 |
| commit | 0232b991cd7d8e3a2114ea30e4591dd3e7b65c36 (patch) | |
| tree | 94730e7594fd09ae1fa820391ce311f6daf13905 /src/zen/cmds/trace_cmd.cpp | |
| parent | Fix forward declaration order for s_GotSigWinch and SigWinchHandler (diff) | |
| parent | trace: declare Region event name fields as AnsiString (#1012) (diff) | |
| download | archived-zen-sb/zen-help.tar.xz archived-zen-sb/zen-help.zip | |
Merge branch 'main' into sb/zen-helpsb/zen-help
- Combine HelpCommand (this branch) with HistoryCommand (main) in zen CLI dispatcher
- Keep filter-aware TuiPickOne rewrite; adopt main's ASCII arrow glyphs in doc comment
Diffstat (limited to 'src/zen/cmds/trace_cmd.cpp')
| -rw-r--r-- | src/zen/cmds/trace_cmd.cpp | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/src/zen/cmds/trace_cmd.cpp b/src/zen/cmds/trace_cmd.cpp deleted file mode 100644 index 54c0f080d..000000000 --- a/src/zen/cmds/trace_cmd.cpp +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright Epic Games, Inc. All Rights Reserved. - -#include "trace_cmd.h" -#include <zencore/logging.h> -#include <zenhttp/httpclient.h> -#include <zenhttp/httpcommon.h> - -using namespace std::literals; - -namespace zen { - -TraceCommand::TraceCommand() -{ - m_Options.add_options()("h,help", "Print help"); - m_Options.add_option("", "u", "hosturl", kHostUrlHelp, cxxopts::value(m_HostName)->default_value(""), "<hosturl>"); - m_Options.add_option("", "s", "stop", "Stop tracing", cxxopts::value(m_Stop)->default_value("false"), "<stop>"); - m_Options.add_option("", "", "host", "Start tracing to host", cxxopts::value(m_TraceHost), "<hostip>"); - m_Options.add_option("", "", "file", "Start tracing to file", cxxopts::value(m_TraceFile), "<filepath>"); -} - -TraceCommand::~TraceCommand() = default; - -void -TraceCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) -{ - ZEN_UNUSED(GlobalOptions); - - if (!ParseOptions(argc, argv)) - { - return; - } - - m_HostName = ResolveTargetHostSpec(m_HostName); - - if (m_HostName.empty()) - { - throw OptionParseException("Unable to resolve server specification", m_Options.help()); - } - - zen::HttpClient Http = CreateHttpClient(m_HostName); - - if (m_Stop) - { - if (zen::HttpClient::Response Response = Http.Post("/admin/trace/stop"sv)) - { - ZEN_CONSOLE("OK: {}", Response.ToText()); - } - else - { - Response.ThrowError("Trace stop failed"); - } - return; - } - - std::string StartArg; - if (!m_TraceHost.empty()) - { - StartArg = fmt::format("host={}", m_TraceHost); - } - else if (!m_TraceFile.empty()) - { - StartArg = fmt::format("file={}", m_TraceFile); - } - - if (!StartArg.empty()) - { - if (zen::HttpClient::Response Response = Http.Post(fmt::format("/admin/trace/start?{}"sv, StartArg))) - { - ZEN_CONSOLE("OK: {}", Response.ToText()); - } - else - { - Response.ThrowError("Trace start failed"); - } - } - else - { - if (zen::HttpClient::Response Response = Http.Get("/admin/trace"sv)) - { - ZEN_CONSOLE("OK: {}", Response.ToText()); - } - else - { - Response.ThrowError("Trace status failed"); - } - } -} - -} // namespace zen |