GrpcPrint/PrintS/main.cpp
2024-04-09 16:53:02 +08:00

42 lines
866 B
C++

#include "HBDSystem.h"
#include <iostream>
int main(int argc, char** argv) {
HBDSystem* hbd = new HBDSystem();
hbd->Init();
hbd->Usage();
std::string userInput;
bool unknowCmd = false;
while (true) {
if (!unknowCmd)printf("*请输入命令:");
std::getline(std::cin, userInput); // 读取用户输入
unknowCmd = false;
if (userInput == "r" || userInput == "run") {
printf("service is running...\n");
hbd->Run();
}
else if (userInput == "s" || userInput == "stop") {
hbd->Stop();
printf("service is stoped...\n");
}
else if (userInput == "e" || userInput == "exit") {
printf("service is exiting...\n");
break;
}
else if (userInput == "h" || userInput == "help") {
hbd->Usage();
}
else {
printf("未识别的命令,请重新输入命令:");
unknowCmd = true;
}
}
DELP(hbd);
return 0;
}