mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 08:58:03 +02:00
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.
This commit is contained in:
parent
88c3050000
commit
86ffc08775
1 changed files with 9 additions and 13 deletions
|
|
@ -4255,8 +4255,6 @@ read_connection_properties (NmCli *nmc,
|
||||||
|
|
||||||
option = **argv;
|
option = **argv;
|
||||||
if (!option) {
|
if (!option) {
|
||||||
if (nmc->complete)
|
|
||||||
complete_property_name (nmc, connection, '\0', "", NULL);
|
|
||||||
g_set_error_literal (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
|
g_set_error_literal (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
|
||||||
_("Error: <setting>.<property> argument is missing."));
|
_("Error: <setting>.<property> argument is missing."));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
@ -4275,10 +4273,11 @@ read_connection_properties (NmCli *nmc,
|
||||||
if (modifier)
|
if (modifier)
|
||||||
setting++;
|
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);
|
setting_name = check_valid_name (setting, type_settings, slv_settings, &local);
|
||||||
if (!setting_name) {
|
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,
|
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
|
||||||
_("Error: invalid or not allowed setting '%s': %s."),
|
_("Error: invalid or not allowed setting '%s': %s."),
|
||||||
setting, local->message);
|
setting, local->message);
|
||||||
|
|
@ -4287,11 +4286,8 @@ read_connection_properties (NmCli *nmc,
|
||||||
}
|
}
|
||||||
|
|
||||||
next_arg (argc, argv);
|
next_arg (argc, argv);
|
||||||
if (!get_value (&value, argc, argv, option, error)) {
|
if (!get_value (&value, argc, argv, option, error))
|
||||||
if (nmc->complete)
|
|
||||||
complete_property_name (nmc, connection, modifier, setting, strv[1]);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
if (!*argc && nmc->complete)
|
if (!*argc && nmc->complete)
|
||||||
complete_property (setting, strv[1], value ? value : "");
|
complete_property (setting, strv[1], value ? value : "");
|
||||||
|
|
@ -4318,19 +4314,19 @@ read_connection_properties (NmCli *nmc,
|
||||||
if (!chosen) {
|
if (!chosen) {
|
||||||
if (modifier)
|
if (modifier)
|
||||||
option++;
|
option++;
|
||||||
if (nmc->complete)
|
if (*argc == 1 && nmc->complete)
|
||||||
complete_property_name (nmc, connection, modifier, option, NULL);
|
complete_property_name (nmc, connection, modifier, option, NULL);
|
||||||
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
|
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
|
||||||
_("Error: invalid <setting>.<property> '%s'."), option);
|
_("Error: invalid <setting>.<property> '%s'."), option);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (*argc == 1 && nmc->complete)
|
||||||
|
complete_property_name (nmc, connection, modifier, option, NULL);
|
||||||
|
|
||||||
next_arg (argc, argv);
|
next_arg (argc, argv);
|
||||||
if (!get_value (&value, argc, argv, option, error)) {
|
if (!get_value (&value, argc, argv, option, error))
|
||||||
if (nmc->complete)
|
|
||||||
complete_property_name (nmc, connection, modifier, option, NULL);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
if (!*argc && nmc->complete)
|
if (!*argc && nmc->complete)
|
||||||
complete_option (chosen, value ? value : "");
|
complete_option (chosen, value ? value : "");
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue