static struct blob_buf b;
static int timeout = 30;
static bool simple_output = false;
+static int verbose = 0;
static const char *format_type(void *priv, struct blob_attr *attr)
{
char *s;
int rem;
- if (simple_output) {
+ if (simple_output || !verbose) {
printf("%s\n", obj->path);
return;
}
return;
blob_for_each_attr(cur, obj->signature, rem) {
- s = blobmsg_format_json_with_cb(cur, false, format_type, NULL);
+ s = blobmsg_format_json_with_cb(cur, false, format_type, NULL, -1);
printf("\t%s\n", s);
free(s);
}
if (!msg)
return;
- str = blobmsg_format_json(msg, true);
+ str = blobmsg_format_json_indent(msg, true, simple_output ? -1 : 0);
printf("%s\n", str);
free(str);
}
" -s <socket>: Set the unix domain socket to connect to\n"
" -t <timeout>: Set the timeout (in seconds) for a command to complete\n"
" -S: Use simplified output (for scripts)\n"
+ " -v: More verbose output\n"
"\n"
"Commands:\n"
" - list [<path>] List objects\n"
progname = argv[0];
- while ((ch = getopt(argc, argv, "s:t:S")) != -1) {
+ while ((ch = getopt(argc, argv, "vs:t:S")) != -1) {
switch (ch) {
case 's':
ubus_socket = optarg;
case 'S':
simple_output = true;
break;
+ case 'v':
+ verbose++;
+ break;
default:
return usage(progname);
}