+static void
+print_usage(char *app)
+{
+ printf(
+ "== Usage ==\n\n"
+ " # %s [-i <file> | -s \"json...\"] {-t <pattern> | -e <pattern>}\n"
+ " -q Quiet, no errors are printed\n"
+ " -h, --help Print this help\n"
+ " -i path Specify a JSON file to parse\n"
+ " -s \"json\" Specify a JSON string to parse\n"
+ " -l limit Specify max number of results to show\n"
+ " -F separator Specify a field separator when using export\n"
+ " -t <pattern> Print the type of values matched by pattern\n"
+ " -e <pattern> Print the values matched by pattern\n"
+ " -e VAR=<pat> Serialize matched value for shell \"eval\"\n\n"
+ "== Patterns ==\n\n"
+ " Patterns are JsonPath: http://goessner.net/articles/JsonPath/\n"
+ " This tool implements $, @, [], * and the union operator ','\n"
+ " plus the usual expressions and literals.\n"
+ " It does not support the recursive child search operator '..' or\n"
+ " the '?()' and '()' filter expressions as those would require a\n"
+ " complete JavaScript engine to support them.\n\n"
+ "== Examples ==\n\n"
+ " Display the first IPv4 address on lan:\n"
+ " # ifstatus lan | %s -e '@[\"ipv4-address\"][0].address'\n\n"
+ " Extract the release string from the board information:\n"
+ " # ubus call system board | %s -e '@.release.description'\n\n"
+ " Find all interfaces which are up:\n"
+ " # ubus call network.interface dump | \\\n"
+ " %s -e '@.interface[@.up=true].interface'\n\n"
+ " Export br-lan traffic counters for shell eval:\n"
+ " # devstatus br-lan | %s -e 'RX=@.statistics.rx_bytes' \\\n"
+ " -e 'TX=@.statistics.tx_bytes'\n",
+ app, app, app, app, app);
+}
+