From: Lennart Poettering Date: Mon, 27 May 2024 09:28:48 +0000 (+0200) Subject: varlinkctl: tell user we are expecting method call parameters on STDIN X-Git-Tag: v257-rc1~1166^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=273b96f9fa61adedbea22351293c78594c1af0fb;p=thirdparty%2Fsystemd.git varlinkctl: tell user we are expecting method call parameters on STDIN When calling a method and the user hasn't provided any method call parameters on the command line we expect them on stdin instead. This might be confusing for people using varlinkctl for the first time, since omitting the parameters will just throw you at a blinking cursor. Let's be a bit more helpful, and show a friendly message when we are connected to a TTY (i.e. run interactively). --- diff --git a/src/varlinkctl/varlinkctl.c b/src/varlinkctl/varlinkctl.c index 676fb930548..a994c640ca0 100644 --- a/src/varlinkctl/varlinkctl.c +++ b/src/varlinkctl/varlinkctl.c @@ -475,6 +475,9 @@ static int verb_call(int argc, char *argv[], void *userdata) { if (r < 0) return log_error_errno(r, "Failed to parse parameters at :%u:%u: %m", line, column); } else { + if (isatty(STDIN_FILENO) > 0 && !arg_quiet) + log_notice("Expecting method call parameter JSON object on standard input."); + r = sd_json_parse_file_at(stdin, AT_FDCWD, "", 0, &jp, &line, &column); if (r < 0) return log_error_errno(r, "Failed to parse parameters at :%u:%u: %m", line, column);