From ad7ac866dbf57e1c06bf427f9aa48fea3460dfd4 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Fri, 24 Jun 2022 00:30:04 +0200 Subject: [PATCH] nmcli/connections: don't ask to ask with --ask This is slightly annoying: $ nmcli -a c add type ethernet There is 1 optional setting for General settings. No point in asking if there's just one option. Just ask right away: $ nmcli -a c add type ethernet Interface name: --- src/nmcli/connections.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/nmcli/connections.c b/src/nmcli/connections.c index 92613739b..5b167738f 100644 --- a/src/nmcli/connections.c +++ b/src/nmcli/connections.c @@ -5696,16 +5696,14 @@ want_provide_opt_args(const NmcConfig *nmc_config, const char *type, guint num) { gs_free char *answer = NULL; + /* Don't ask to ask. */ + if (num == 1) + return TRUE; + /* Ask for optional arguments. */ - g_print(ngettext("There is %d optional setting for %s.\n", - "There are %d optional settings for %s.\n", - num), - (int) num, - type); - answer = nmc_readline( - nmc_config, - ngettext("Do you want to provide it? %s", "Do you want to provide them? %s", num), - prompt_yes_no(TRUE, NULL)); + g_print(_("There are %d optional settings for %s.\n"), (int) num, type); + answer = + nmc_readline(nmc_config, _("Do you want to provide them? %s"), prompt_yes_no(TRUE, NULL)); nm_strstrip(answer); return !answer || matches(answer, WORD_YES); }