static struct blob_buf b;
static int timeout = 30;
+static bool simple_output = false;
static const char *format_type(void *priv, struct blob_attr *attr)
{
char *s;
int rem;
+ if (simple_output) {
+ printf("%s\n", obj->path);
+ return;
+ }
+
printf("'%s' @%08x\n", obj->path, obj->id);
if (!obj->signature)
char *str;
str = blobmsg_format_json(msg, true);
- printf("\"%s\": %s\n", type, str);
+ printf("{ \"%s\": %s }\n", type, str);
free(str);
}
"Usage: %s [<options>] <command> [arguments...]\n"
"Options:\n"
" -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"
"\n"
"Commands:\n"
" - list [<path>] List objects\n"
progname = argv[0];
- while ((ch = getopt(argc, argv, "s:t:")) != -1) {
+ while ((ch = getopt(argc, argv, "s:t:S")) != -1) {
switch (ch) {
case 's':
ubus_socket = optarg;
case 't':
timeout = atoi(optarg);
break;
+ case 'S':
+ simple_output = true;
+ break;
default:
return usage(progname);
}