// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "../zen.h" #include namespace zen { class ServiceCommand : public ZenCmdBase { public: static constexpr char Name[] = "service"; static constexpr char Description[] = "Manage zenserver as a service - status, install, uninstall, start and stop"; ServiceCommand(); ~ServiceCommand(); virtual void Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) override; virtual cxxopts::Options& Options() override { return m_Options; } private: cxxopts::Options m_Options{Name, Description}; std::string m_Verb; // create, info, remove std::string m_ServiceName = "ZenServer"; std::string m_UserName; bool m_AllowElevation = false; cxxopts::Options m_StatusOptions{"status", "Show information about an installed zenserver service"}; cxxopts::Options m_InstallOptions{ "install", "Install zenserver as a service. Arguments following \" -- \" will be added as parameters to the installed service."}; std::filesystem::path m_ServerExecutable; std::filesystem::path m_InstallPath; bool m_FullInstall = false; #if ZEN_PLATFORM_WINDOWS std::string m_ServiceDisplayName = "Unreal Zen Storage Service"; std::string m_ServiceDescription; #endif // ZEN_PLATFORM_WINDOWS cxxopts::Options m_UninstallOptions{"uninstall", "Uninstall zenserver as a service"}; cxxopts::Options m_StartOptions{"start", "Start an installed zenserver service"}; cxxopts::Options m_StopOptions{"stop", "Start an installed zenserver service"}; cxxopts::Options* m_SubCommands[5] = {&m_StatusOptions, &m_InstallOptions, &m_UninstallOptions, &m_StartOptions, &m_StopOptions}; }; } // namespace zen