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

Function ExecuteCommand

src/admincli.cc:1906–1931  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1904}
1905
1906CliStatus 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
1933int main(int argc, char* argv[]) {
1934 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