dropshell/source/src/commands/shared_commands.hpp
Your Name 1d3bb634f0
Some checks failed
Dropshell Test / Build_and_Test (push) Has been cancelled
Refact0r
2025-05-17 19:40:51 +12:00

64 lines
1.8 KiB
C++

#ifndef SHARED_COMMANDS_HPP
#define SHARED_COMMANDS_HPP
#include "servers.hpp"
#include "command_registry.hpp"
#include "server_env_manager.hpp"
namespace dropshell
{
namespace shared_commands
{
typedef enum HealthStatus
{
HEALTHY,
UNHEALTHY,
NOTINSTALLED,
ERROR,
UNKNOWN
} HealthStatus;
typedef struct ServiceStatus
{
HealthStatus health;
std::vector<int> ports;
} ServiceStatus;
// expose routines used by multiple commands.
class cRemoteTempFolder
{
public:
cRemoteTempFolder(const server_env_manager &server_env); // create a temp folder on the remote server
~cRemoteTempFolder(); // delete the temp folder on the remote server
std::string path() const; // get the path to the temp folder on the remote server
private:
std::string mPath;
const server_env_manager &mServerEnv;
};
bool rsync_tree_to_remote(
const std::string &local_path,
const std::string &remote_path,
server_env_manager &server_env,
bool silent);
std::string get_arch();
std::map<std::string, ServiceStatus> get_all_services_status(std::string server_name);
std::string healthtick(const std::string &server, const std::string &service);
std::string HealthStatus2String(HealthStatus status);
HealthStatus is_healthy(const std::string &server, const std::string &service);
std::string healthmark(const std::string &server, const std::string &service);
void std_autocomplete(const CommandContext &ctx);
void std_autocomplete_allowall(const CommandContext &ctx);
} // namespace shared_commands
} // namespace dropshell
#endif