static PagerFlags arg_pager_flags = 0;
static VarlinkMethodFlags arg_method_flags = 0;
static bool arg_collect = false;
+static bool arg_quiet = false;
static int help(void) {
_cleanup_free_ char *link = NULL;
" --oneway Do not request response\n"
" --json=MODE Output as JSON\n"
" -j Same as --json=pretty on tty, --json=short otherwise\n"
+ " -q --quiet Do not output method reply\n"
"\nSee the %2$s for details.\n",
program_invocation_short_name,
link,
{ "oneway", no_argument, NULL, ARG_ONEWAY },
{ "json", required_argument, NULL, ARG_JSON },
{ "collect", no_argument, NULL, ARG_COLLECT },
+ { "quiet", no_argument, NULL, 'q' },
{},
};
assert(argc >= 0);
assert(argv);
- while ((c = getopt_long(argc, argv, "hj", options, NULL)) >= 0)
+ while ((c = getopt_long(argc, argv, "hjq", options, NULL)) >= 0)
switch (c) {
arg_json_format_flags = SD_JSON_FORMAT_PRETTY_AUTO|SD_JSON_FORMAT_COLOR_AUTO;
break;
+ case 'q':
+ arg_quiet = true;
+ break;
+
case '?':
return -EINVAL;
} else
r = 0;
- sd_json_variant_dump(parameters, arg_json_format_flags, stdout, NULL);
+ if (!arg_quiet)
+ sd_json_variant_dump(parameters, arg_json_format_flags, stdout, NULL);
+
return r;
}
} else
r = 0;
+ if (arg_quiet)
+ return r;
+
pager_open(arg_pager_flags);
sd_json_variant_dump(reply, arg_json_format_flags, stdout, NULL);
return r;
} else
r = 0;
+ if (arg_quiet)
+ return r;
+
pager_open(arg_pager_flags);
sd_json_variant_dump(reply, arg_json_format_flags, stdout, NULL);
if (r < 0)
return log_error_errno(r, "Failed to check interface for consistency: %m");
+ if (arg_quiet)
+ return 0;
+
pager_open(arg_pager_flags);
r = varlink_idl_dump(stdout, /* use_colors= */ -1, vi);