./
Some checks failed
Dropshell Test / Build_and_Test (push) Failing after 21s

This commit is contained in:
Your Name
2025-05-11 13:54:13 +12:00
parent 64639adcf0
commit 25bc0b4655
4 changed files with 71 additions and 66 deletions

64
src/commands/health.cpp Normal file
View File

@ -0,0 +1,64 @@
#include "command_registry.hpp"
#include "config.hpp"
#include "utils/utils.hpp"
#include "service_runner.hpp"
#include "utils/directories.hpp"
#include "standard_autocomplete.hpp"
#include "templates.hpp"
#include "shared_commands.hpp"
namespace dropshell {
int health_handler(const CommandContext& ctx);
void health_autocomplete(const CommandContext& ctx);
static std::vector<std::string> health_name_list={"health","check","healthcheck","status"};
// Static registration
struct HealthCommandRegister {
HealthCommandRegister() {
CommandRegistry::instance().register_command({
health_name_list,
health_handler,
health_autocomplete,
false, // hidden
false, // requires_config
1, // min_args (after command)
2, // max_args (after command)
"health SERVER",
"Check the health of a server.",
R"(
health <server>
)"
});
}
} health_command_register;
// ------------------------------------------------------------------------------------------------
// health command implementation
std::string healthtick(const std::string& server, const std::string& service) {
return "OK";
}
// ------------------------------------------------------------------------------------------------
// health command implementation
// ------------------------------------------------------------------------------------------------
int health_handler(const CommandContext& ctx) {
if (ctx.args.size() < 1) {
}
return 0;
}
// ------------------------------------------------------------------------------------------------
// health autocomplete
// ------------------------------------------------------------------------------------------------
void health_autocomplete(const CommandContext& ctx) {
if (ctx.args.size() == 1) {
}
}
} // namespace dropshell

View File

@ -128,7 +128,7 @@ bool install_service(const std::string& server, const std::string& service, bool
}
// print health tick
std::cout << "Health: " << healthtick() << std::endl;
std::cout << "Health: " << healthtick(server,service) << std::endl;
return true;
}

View File

@ -15,5 +15,8 @@ namespace dropshell {
// defined in install.cpp
bool install_service(const std::string& server, const std::string& service, bool silent);
// defined in health.cpp
std::string healthtick(const std::string& server, const std::string& service);
} // namespace dropshell
#endif