|
| 1 | +/** |
| 2 | + * Tencent is pleased to support the open source community by making Tars available. |
| 3 | + * |
| 4 | + * Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved. |
| 5 | + * |
| 6 | + * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except |
| 7 | + * in compliance with the License. You may obtain a copy of the License at |
| 8 | + * |
| 9 | + * https://opensource.org/licenses/BSD-3-Clause |
| 10 | + * |
| 11 | + * Unless required by applicable law or agreed to in writing, software distributed |
| 12 | + * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| 13 | + * CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| 14 | + * specific language governing permissions and limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +#include "util/tc_mysql.h" |
| 18 | +#include "util/tc_option.h" |
| 19 | +#include "util/tc_file.h" |
| 20 | +#include "util/tc_common.h" |
| 21 | +#include "util/tc_config.h" |
| 22 | +#include <iostream> |
| 23 | +#include <string> |
| 24 | +#include "TarsClient.h" |
| 25 | +#include "command/ping.h" |
| 26 | + |
| 27 | +using namespace tars; |
| 28 | +using namespace std; |
| 29 | + |
| 30 | +int main(int argc, char *argv[]) |
| 31 | +{ |
| 32 | + TC_Option option; |
| 33 | + |
| 34 | + try |
| 35 | + { |
| 36 | + option.decode(argc, argv); |
| 37 | + |
| 38 | + TarsClient tarsClient(option); |
| 39 | + |
| 40 | + tarsClient.add("ping", ping); |
| 41 | + tarsClient.add("start", TarsClient::command_function()); |
| 42 | + tarsClient.add("stop", TarsClient::command_function()); |
| 43 | + tarsClient.add("restart", TarsClient::command_function()); |
| 44 | + tarsClient.add("patch", TarsClient::command_function()); |
| 45 | + |
| 46 | + tarsClient.call("ping"); |
| 47 | + } |
| 48 | + catch(exception &ex) |
| 49 | + { |
| 50 | + cout << "error: " << ex.what() << endl; |
| 51 | + exit(-1); |
| 52 | + } |
| 53 | + |
| 54 | + return 0; |
| 55 | +} |
| 56 | + |
| 57 | + |
0 commit comments