MCPcopy Create free account
hub / github.com/baidu/tera / ExecuteCommand

Function ExecuteCommand

src/lbcli_main.cc:232–257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

230}
231
232int ExecuteCommand(Client* client, int argc, char** arg_list) {
233 int ret = 0;
234 ErrorCode error_code;
235
236 std::vector<std::string> parsed_arg_list;
237 if (!ParseCommand(argc, arg_list, &parsed_arg_list)) {
238 return 1;
239 }
240 std::string* argv = &parsed_arg_list[0];
241
242 CommandTable& command_table = GetCommandTable();
243 std::string cmd = argv[1];
244 if (cmd == "version") {
245 PrintSystemVersion();
246 } else if (command_table.find(cmd) != command_table.end()) {
247 ret = command_table[cmd](client, argc, argv, &error_code);
248 } else {
249 PrintUnknownCmdHelpInfo(argv[1].c_str());
250 ret = 1;
251 }
252
253 if (error_code.GetType() != ErrorCode::kOK) {
254 LOG(ERROR) << "fail reason: " << error_code.ToString();
255 }
256 return ret;
257}
258
259int main(int argc, char* argv[]) {
260 FLAGS_minloglevel = 2;

Callers 1

mainFunction · 0.70

Calls 4

ParseCommandFunction · 0.70
PrintUnknownCmdHelpInfoFunction · 0.70
GetTypeMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected