| 43 | }; |
| 44 | |
| 45 | static std::string format(const char *format, const tsl::ordered_map<std::string, std::string> &variables) { |
| 46 | std::string s = format; |
| 47 | for (const auto &itr : variables) { |
| 48 | size_t start_pos = 0; |
| 49 | while ((start_pos = s.find(itr.first, start_pos)) != std::string::npos) { |
| 50 | s.replace(start_pos, itr.first.length(), itr.second); |
| 51 | start_pos += itr.second.length(); |
| 52 | } |
| 53 | } |
| 54 | return s; |
| 55 | } |
| 56 | |
| 57 | static std::string quoted(const std::string &str) { |
| 58 | return "\"" + str + "\""; |