| 1904 | } |
| 1905 | |
| 1906 | CliStatus ExecuteCommand(Client* client, int argc, char** arg_list) { |
| 1907 | CliStatus ret = CliStatus::kOk; |
| 1908 | ErrorCode error_code; |
| 1909 | |
| 1910 | std::vector<std::string> parsed_arg_list; |
| 1911 | if (!ParseCommand(argc, arg_list, &parsed_arg_list)) { |
| 1912 | return CliStatus::kError; |
| 1913 | } |
| 1914 | std::string* argv = &parsed_arg_list[0]; |
| 1915 | |
| 1916 | CommandTable& command_table = GetCommandTable(); |
| 1917 | std::string cmd = argv[1]; |
| 1918 | if (cmd == "version") { |
| 1919 | PrintSystemVersion(); |
| 1920 | } else if (command_table.find(cmd) != command_table.end()) { |
| 1921 | ret = command_table[cmd](client, argc, argv, &error_code); |
| 1922 | } else { |
| 1923 | PrintUnknownCmdHelpInfo(argv[1].c_str()); |
| 1924 | ret = CliStatus::kError; |
| 1925 | } |
| 1926 | |
| 1927 | if (error_code.GetType() != ErrorCode::kOK) { |
| 1928 | LOG(ERROR) << "fail reason: " << error_code.ToString(); |
| 1929 | } |
| 1930 | return ret; |
| 1931 | } |
| 1932 | |
| 1933 | int main(int argc, char* argv[]) { |
| 1934 | FLAGS_minloglevel = 2; |
no test coverage detected