summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2022-06-24 00:30:04 +0200
committerLubomir Rintel <lkundrak@v3.sk>2022-06-24 00:30:04 +0200
commita5e099d0085c86954f6821bd4aa07faee09f9591 (patch)
treed60b2842f6dfb49ec398695595489364c4172b59
parentd51140d2abcde0a77b1bbc5d7be664161f498060 (diff)
downloadNetworkManager-a5e099d0085c86954f6821bd4aa07faee09f9591.tar.gz
nmcli/connections: allow empty lists with "--ask c add"
The interactive add is not too enthusiastic about not providing a value in a list. That is before on getting an empty line in ask_option() we take a shortcut instead of dispatching to set_option(). That way we skip setting the PROPERTY_INF_FLAG_DISABLED flag, causing the option to be included in questionnaire_one_optional()'s info list. There's no reason to avoid calling set_option() if we don't get a value; set_option() handles NULL value just fine. $ nmcli -a c add Connection type: dummy There is 1 optional setting for General settings. Do you want to provide it? (yes/no) [yes] Interface name [*]: lala There are 2 optional settings for IPv4 protocol. Do you want to provide them? (yes/no) [yes] You can specify this option more than once. Press <Enter> when you're done. IPv4 address (IP[/plen]) [none]: You can specify this option more than once. Press <Enter> when you're done. IPv4 address (IP[/plen]) [none]: You can specify this option more than once. Press <Enter> when you're done. IPv4 address (IP[/plen]) [none]: ...
-rw-r--r--src/nmcli/connections.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/src/nmcli/connections.c b/src/nmcli/connections.c
index eda68139bb..7208abcc75 100644
--- a/src/nmcli/connections.c
+++ b/src/nmcli/connections.c
@@ -5591,8 +5591,6 @@ ask_option(NmCli *nmc, NMConnection *connection, const NMMetaAbstractInfo *abstr
again:
value = nmc_readline(&nmc->nmc_config, "%s", prompt);
- if (multi && !value)
- return;
if (!set_option(nmc, connection, abstract_info, value, FALSE, &error)) {
g_printerr("%s\n", error->message);