MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / parseGetPath

Function parseGetPath

source/json_tool/json_tool.cpp:219–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217}
218
219pair<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
237Maybe<ParsedArgs> parseArgs(int argc, char** argv) {
238 // Skip the program name

Callers 1

parseArgsFunction · 0.85

Calls 4

parsePathFunction · 0.85
endsWithMethod · 0.45
substrMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected