mirror of
https://github.com/owntracks/recorder.git
synced 2026-04-09 00:36:50 +00:00
--list now honours --format
This commit is contained in:
17
ocat.c
17
ocat.c
@@ -186,10 +186,21 @@ int main(int argc, char **argv)
|
||||
fprintf(stderr, "%s: cannot list\n", progname);
|
||||
exit(2);
|
||||
}
|
||||
js = json_stringify(json, " ");
|
||||
printf("%s\n", js);
|
||||
if (otype == JSON) {
|
||||
js = json_stringify(json, " ");
|
||||
printf("%s\n", js);
|
||||
free(js);
|
||||
} else {
|
||||
JsonNode *f, *arr;
|
||||
|
||||
if ((arr = json_find_member(json, "results")) != NULL) { // get array
|
||||
json_foreach(f, arr) {
|
||||
printf("%s\n", f->string_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
json_delete(json);
|
||||
free(js);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user