handler for ts runroot this function set up runroot_file
| 173 | // handler for ts runroot |
| 174 | // this function set up runroot_file |
| 175 | void |
| 176 | runroot_handler(const char **argv, bool json) |
| 177 | { |
| 178 | std::string prefix = "--run-root"; |
| 179 | std::string path; |
| 180 | |
| 181 | // check if we have --run-root... |
| 182 | std::string arg = {}; |
| 183 | |
| 184 | int i = 0; |
| 185 | while (argv[i]) { |
| 186 | std::string_view command = argv[i]; |
| 187 | if (command.substr(0, prefix.size()) == prefix) { |
| 188 | arg = command.data(); |
| 189 | break; |
| 190 | } |
| 191 | i++; |
| 192 | } |
| 193 | |
| 194 | // if --run-root is provided |
| 195 | if (!arg.empty() && arg != prefix) { |
| 196 | // 1. pass in path |
| 197 | prefix += "="; |
| 198 | std::string value = arg.substr(prefix.size(), arg.size() - 1); |
| 199 | path = get_yaml_path(value); |
| 200 | if (!path.empty()) { |
| 201 | if (!json) { |
| 202 | ink_notice("using command line path as RUNROOT"); |
| 203 | } |
| 204 | runroot_file = path; |
| 205 | return; |
| 206 | } else if (!json) { |
| 207 | ink_warning("Unable to access runroot: '%s'", value.c_str()); |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | runroot_extra_handling(argv[0], json); |
| 212 | } |
| 213 | |
| 214 | // return a map of all path with default layout |
| 215 | std::unordered_map<std::string, std::string> |
no test coverage detected