| 1026 | return 0; |
| 1027 | } |
| 1028 | char** CliImpl::json_completion(const char* text, int start, int end) |
| 1029 | { |
| 1030 | if (start == 0) // beginning of line, match a command |
| 1031 | return rl_completion_matches(text, &json_command_completion_generator_function); |
| 1032 | else |
| 1033 | { |
| 1034 | // not the beginning of a line. figure out what the type of this argument is |
| 1035 | // and whether we can complete it. First, look up the method |
| 1036 | string command_line_to_parse(rl_line_buffer, start); |
| 1037 | string trimmed_command_to_parse(boost::algorithm::trim_copy(command_line_to_parse)); |
| 1038 | |
| 1039 | if (!trimmed_command_to_parse.empty()) |
| 1040 | { |
| 1041 | auto alias_iter = _method_alias_map.find(trimmed_command_to_parse); |
| 1042 | if (alias_iter != _method_alias_map.end()) |
| 1043 | { |
| 1044 | auto method_data_iter = _method_data_map.find(alias_iter->second); |
| 1045 | if (method_data_iter != _method_data_map.end()) |
| 1046 | { |
| 1047 | } |
| 1048 | } |
| 1049 | try |
| 1050 | { |
| 1051 | const thinkyoung::api::MethodData& method_data = cli_impl_instance->_rpc_server->get_method_data(trimmed_command_to_parse); |
| 1052 | if (method_data.name == "help") |
| 1053 | { |
| 1054 | return rl_completion_matches(text, &json_command_completion_generator_function); |
| 1055 | } |
| 1056 | } |
| 1057 | catch (const thinkyoung::rpc::unknown_method&) |
| 1058 | { |
| 1059 | // do nothing |
| 1060 | } |
| 1061 | } |
| 1062 | |
| 1063 | return rl_completion_matches(text, &json_argument_completion_generator_function); |
| 1064 | } |
| 1065 | } |
| 1066 | |
| 1067 | #endif |
| 1068 | void CliImpl::display_status_message(const std::string& message) |
no test coverage detected