diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2022-06-24 00:30:04 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2022-06-24 00:30:04 +0200 |
commit | ad7ac866dbf57e1c06bf427f9aa48fea3460dfd4 (patch) | |
tree | 11d9a3dbf3ebfb1367639cc2d7f1165eceb044fe | |
parent | 69e65a9b0eec02ee41a3b6f0f6605eed57890106 (diff) | |
download | NetworkManager-ad7ac866dbf57e1c06bf427f9aa48fea3460dfd4.tar.gz |
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:
-rw-r--r-- | src/nmcli/connections.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/nmcli/connections.c b/src/nmcli/connections.c index 92613739bb..5b167738f7 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); } |