diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2016-06-23 19:59:40 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2016-06-29 20:28:42 +0200 |
commit | 86ffc0877523cb9d4f2a67c00650f1fbddd3183e (patch) | |
tree | 3dd79fa24c1663a8ac272df2ebaa2bce1ffa7963 | |
parent | 88c305000067339fedf1bc0cbcd7cdf3082af491 (diff) | |
download | NetworkManager-86ffc0877523cb9d4f2a67c00650f1fbddd3183e.tar.gz |
cli/connections: only do completion for the last argument
Completing the property when we stop parsing due to error is not the
right thing to do.
-rw-r--r-- | clients/cli/connections.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/clients/cli/connections.c b/clients/cli/connections.c index 834a4e463c..caf151fc51 100644 --- a/clients/cli/connections.c +++ b/clients/cli/connections.c @@ -4255,8 +4255,6 @@ read_connection_properties (NmCli *nmc, option = **argv; if (!option) { - if (nmc->complete) - complete_property_name (nmc, connection, '\0', "", NULL); g_set_error_literal (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT, _("Error: <setting>.<property> argument is missing.")); return FALSE; @@ -4275,10 +4273,11 @@ read_connection_properties (NmCli *nmc, if (modifier) setting++; + if (*argc == 1 && nmc->complete) + complete_property_name (nmc, connection, modifier, setting, strv[1]); + setting_name = check_valid_name (setting, type_settings, slv_settings, &local); if (!setting_name) { - if (nmc->complete) - complete_property_name (nmc, connection, modifier, setting, strv[1]); g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT, _("Error: invalid or not allowed setting '%s': %s."), setting, local->message); @@ -4287,11 +4286,8 @@ read_connection_properties (NmCli *nmc, } next_arg (argc, argv); - if (!get_value (&value, argc, argv, option, error)) { - if (nmc->complete) - complete_property_name (nmc, connection, modifier, setting, strv[1]); + if (!get_value (&value, argc, argv, option, error)) return FALSE; - } if (!*argc && nmc->complete) complete_property (setting, strv[1], value ? value : ""); @@ -4318,19 +4314,19 @@ read_connection_properties (NmCli *nmc, if (!chosen) { if (modifier) option++; - if (nmc->complete) + if (*argc == 1 && nmc->complete) complete_property_name (nmc, connection, modifier, option, NULL); g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT, _("Error: invalid <setting>.<property> '%s'."), option); return FALSE; } + if (*argc == 1 && nmc->complete) + complete_property_name (nmc, connection, modifier, option, NULL); + next_arg (argc, argv); - if (!get_value (&value, argc, argv, option, error)) { - if (nmc->complete) - complete_property_name (nmc, connection, modifier, option, NULL); + if (!get_value (&value, argc, argv, option, error)) return FALSE; - } if (!*argc && nmc->complete) complete_option (chosen, value ? value : ""); |