| 69 | } |
| 70 | |
| 71 | ChannelLinter::ChannelLinter(AppConfig config) : |
| 72 | m_Config(std::move(config)), |
| 73 | m_ChannelData(GetChannelInfo(*m_Config.m_ChannelName)), |
| 74 | m_ChannelCapability(GetChannelCapability(m_ChannelData)), |
| 75 | m_CreateForm{ [this] |
| 76 | { |
| 77 | std::cout << "Parsing create arguments ... " << std::flush; |
| 78 | decltype(m_CreateForm) form(m_ChannelCapability.at("/create/arguments"_json_pointer)); |
| 79 | std::cout << "OK" << std::endl; |
| 80 | return form; |
| 81 | }() |
| 82 | } |
| 83 | { |
| 84 | std::cout << "Parsing command definitions ... " << std::flush; |
| 85 | for (auto&& command : m_ChannelCapability.at("commands")) |
| 86 | { |
| 87 | auto parsedCommand = ChannelCommand(command); |
| 88 | auto id = parsedCommand.m_Id; |
| 89 | if(m_ChannelCommands.count(id)) |
| 90 | throw std::invalid_argument("Command with id = " + std::to_string(id) + " already exists."); |
| 91 | m_ChannelCommands.emplace(id, std::move(parsedCommand)); |
| 92 | } |
| 93 | std::cout << "OK" << std::endl; |
| 94 | std::cout << "Registered commands: \nid\tname\n"; |
| 95 | for (auto [k, v] : m_ChannelCommands) |
| 96 | std::cout << k << '\t' << v.m_Name << '\n'; |
| 97 | std::cout << std::flush; |
| 98 | } |
| 99 | |
| 100 | void ChannelLinter::Process() |
| 101 | { |
nothing calls this directly
no test coverage detected