From: Lennart Poettering Date: Wed, 18 Feb 2026 13:07:45 +0000 (+0100) Subject: report: add -j shortcut X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=442040e7168dda8cb13e490c0fcc8473638bec54;p=thirdparty%2Fsystemd.git report: add -j shortcut json output is going to be used very frequently, hence provide a shortcut for it, like many our tools do it. --- diff --git a/man/systemd-report.xml b/man/systemd-report.xml index 530dac1e142..010cf2e2f16 100644 --- a/man/systemd-report.xml +++ b/man/systemd-report.xml @@ -90,6 +90,7 @@ + diff --git a/src/report/report.c b/src/report/report.c index d6c52b6ff9e..bf216dd2e39 100644 --- a/src/report/report.c +++ b/src/report/report.c @@ -607,6 +607,8 @@ static int verb_help(int argc, char *argv[], void *userdata) { " --system Connect to system service manager (default)\n" " --json=pretty|short\n" " Configure JSON output\n" + " -j Equivalent to --json=pretty (on TTY) or --json=short\n" + " (otherwise)\n" "\nSee the %2$s for details.\n", program_invocation_short_name, link, @@ -642,7 +644,7 @@ static int parse_argv(int argc, char *argv[]) { assert(argc >= 0); assert(argv); - while ((c = getopt_long(argc, argv, "h", options, NULL)) >= 0) + while ((c = getopt_long(argc, argv, "hj", options, NULL)) >= 0) switch (c) { case 'h': return verb_help(/* argc= */ 0, /* argv= */ NULL, /* userdata= */ NULL); @@ -669,6 +671,10 @@ static int parse_argv(int argc, char *argv[]) { break; + case 'j': + arg_json_format_flags = SD_JSON_FORMAT_PRETTY_AUTO|SD_JSON_FORMAT_COLOR_AUTO; + break; + case '?': return -EINVAL;