static bool arg_fsck = true;
static bool arg_aggressive_gc = false;
static bool arg_tmpfs = false;
+static sd_json_format_flags_t arg_json_format_flags = SD_JSON_FORMAT_OFF;
STATIC_DESTRUCTOR_REGISTER(arg_mount_what, freep);
STATIC_DESTRUCTOR_REGISTER(arg_mount_where, freep);
" -l --full Do not ellipsize output\n"
" --no-ask-password Do not prompt for password\n"
" -q --quiet Suppress information messages during runtime\n"
+ " --json=pretty|short|off Generate JSON output\n"
" --user Run as user unit\n"
" -H --host=[USER@]HOST Operate on remote host\n"
" -M --machine=CONTAINER Operate on local container\n"
ARG_AUTOMOUNT_PROPERTY,
ARG_BIND_DEVICE,
ARG_LIST,
+ ARG_JSON,
};
static const struct option options[] = {
{ "unmount", no_argument, NULL, 'u' }, /* Compat spelling */
{ "collect", no_argument, NULL, 'G' },
{ "tmpfs", no_argument, NULL, 'T' },
+ { "json", required_argument, NULL, ARG_JSON },
{},
};
arg_tmpfs = true;
break;
+ case ARG_JSON:
+ r = parse_json_argument(optarg, &arg_json_format_flags);
+ if (r <= 0)
+ return r;
+
+ break;
+
case '?':
return -EINVAL;
if (r < 0)
return log_error_errno(r, "Failed to set sort index: %m");
- table_set_header(table, arg_legend);
table_set_ersatz_string(table, TABLE_ERSATZ_DASH);
FOREACH_DEVICE(e, d) {
}
}
- pager_open(arg_pager_flags);
-
- r = table_print(table, NULL);
- if (r < 0)
- return table_log_print_error(r);
-
- return 0;
+ return table_print_with_pager(table, arg_json_format_flags, arg_pager_flags, arg_legend);
}
static int run(int argc, char* argv[]) {