| 217 | } |
| 218 | |
| 219 | pair<JsonPath::PathPtr, bool> parseGetPath(String path) { |
| 220 | // --get and --opt have a special syntax for getting the child values of |
| 221 | // the value at the given path. These end with *, e.g.: |
| 222 | // /foo/bar/* |
| 223 | // foo.bar.* |
| 224 | // foo.bar[*] |
| 225 | |
| 226 | bool children = false; |
| 227 | if (path.endsWith("/*") || path.endsWith(".*")) { |
| 228 | path = path.substr(0, path.size() - 2); |
| 229 | children = true; |
| 230 | } else if (path.endsWith("[*]")) { |
| 231 | path = path.substr(0, path.size() - 3); |
| 232 | children = true; |
| 233 | } |
| 234 | return make_pair(parsePath(path), children); |
| 235 | } |
| 236 | |
| 237 | Maybe<ParsedArgs> parseArgs(int argc, char** argv) { |
| 238 | // Skip the program name |