| 230 | } |
| 231 | |
| 232 | int 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 | |
| 259 | int main(int argc, char* argv[]) { |
| 260 | FLAGS_minloglevel = 2; |
no test coverage detected