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:
This commit is contained in:
Lubomir Rintel
2022-06-24 00:30:04 +02:00
parent 69e65a9b0e
commit ad7ac866db

View File

@@ -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);
}